Centos 7 mini installation process record

Turn on network connection#

The centos7 mini version has no network connection by default. We can view local ip information:

[ root@localhost ~]# ip addr
1: lo:<LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 inet 127.0.0.1/8 scope host lo
  valid_lft forever preferred_lft forever
 inet6 ::1/128 scope host
  valid_lft forever preferred_lft forever
2: eno16777728:<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
 link/ether 00:0c:29:ad:96:16 brd ff:ff:ff:ff:ff:ff
[ root@localhost ~]#

View network configuration files

[ root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777728
UUID=05d5a7d5-f16e-4492-9ea1-fa46b7134a8a
DEVICE=eth0
ONBOOT=no
[ root@localhost ~]#

If you want to enable DHCP, update the ONBOOT value of the ifcfg- file from no to yes, save and restart the service.

[ root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

The result is as follows

TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777728
UUID=05d5a7d5-f16e-4492-9ea1-fa46b7134a8a
DEVICE=eno16777728
ONBOOT=yes

Restart network service

[ root@localhost ~]# service network restart
Restarting network(via systemctl):[  OK  ]

View ip information:

[ root@localhost ~]# ip addr
1: lo:<LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 inet 127.0.0.1/8 scope host lo
  valid_lft forever preferred_lft forever
 inet6 ::1/128 scope host
  valid_lft forever preferred_lft forever
2: eth0:<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
 link/ether 00:0c:29:ad:96:16 brd ff:ff:ff:ff:ff:ff
 inet 172.16.1.136/24 brd 172.16.1.255 scope global dynamic eno16777728
  valid_lft 1626sec preferred_lft 1626sec
 inet6 fe80::20c:29ff:fead:9616/64 scope link
  valid_lft forever preferred_lft forever

If you have a fixed ip, you need to update ifcfg-eth0 and add static address IPADDR.

[ root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777728
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777728
UUID=05d5a7d5-f16e-4492-9ea1-fa46b7134a8a
DEVICE=eno16777728
ONBOOT=yes
DNS1=172.16.1.21
DOMAIN=2factor.net
IPADDR=172.16.1.25
PREFIX=24
GATEWAY=172.16.1.254

Restart network service

[ root@localhost ~]# service network restart
Restarting network(via systemctl):[ OK ]

Reference: https://wiki.centos.org/FAQ/CentOS7#head-a21a9e454157700367c9b7e9ccb1ff9954bec881

Open remote ssh

CentOS7 has installed openssh-server by default, if not, execute the installation command as follows;

yum install openssh-server -y

Edit ssh configuration file

[ root@centos-linux ~]# vim /etc/ssh/sshd_config

Open the following configuration:

Port 22
# AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::

# The default requires explicit activation of protocol 1
Protocol 2

# RSAAuthentication yes
PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile      .ssh/authorized_keys

Restart the service

systemctl restart sshd.service

More help about ssh: https://wiki.centos.org/HowTos/Network/SecuringSSH

Enable the function of sudo elevation of non-root users#

Edit the file /etc/sudoers
First increase the write permission of sudoers file

chmod 777/etc/sudoers

Then edit this file

vi /etc/sudoers

Add relevant user information

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
devid   ALL=(ALL)       ALL

devid is my username, just save the file.

Recommended Posts

Centos 7 mini installation process record
CentOS 6.x installation mysql5.7 record
Graphical centos installation detailed process
centos6.5: gcc upgrade (5.2.0) process record
Centos7 installation tomcat process introduction
CentOS8 Linux 8.0.1905 installation process (illustration)
2019-07-09 CentOS7 installation
centos7_1708 installation
Centos5 installation guide
Python - centos6 installation
Centos7.6 operating system installation and optimization record
Docker installation (CentOS7 installation)
CentOS7 docker installation
Ubuntu installation record
CentOS online installation RabbitMQ3.7
Zabbix 2.2.20 installation details (Centos6.9)
Centos source installation Python3
lamp (centos7) installation lamp environment
CentOS system startup process
Centos7 mqtt cluster installation
Graphical installation of CentOS8
Mysql8.0.15 installation configuration (centos7)
Linux notes (1): CentOS-7 installation
Redis3 installation under Centos7
Ubuntu 17.10 installation toss record
CentOS online installation RabbitMQ3.7
Docker CentOS installation method
Linux CentOS 7 installation tutorial
Centos system process management
Centos7 docker installation details
Discourse CentOS 8 new installation manual
Centos mysql installation and configuration
Glusterfs cluster installation on Centos7
Redis cluster installation under CentOS
Centos7 installation and configuration prometheus
CentOS 7 Galera Cluster installation guide
CentOS 7 installation and configuration PPTP
CentOS installation and configuration cmake
Detailed ubuntu 20.04 LTS installation record
Ubuntu16.04.5LTS installation process of SVN
Centos7.5 installation and configuration MongoDB4.0.4
Redis cluster installation under CentOS
CentOS 7 installation and configuration PPTP
Hyper-V + CentOS7 installation video tutorial
centos7 kvm installation and use
Centos7 silent installation of Oracle11g
CentOS 6.8 virtual machine installation details
CentOS7 postgresql installation and use
Centos7.2 deployment vnc service record
CentOS environment installation of Docker
Introduction to CentOS7 installation process of openjdk, tomcat and mysql
Centos backend system setup record
Centos7.4 environment installation lamp-php7.0 tutorial
Docker EE installation on centos7
Discourse CentOS 8 new installation manual
Centos6 system boot loading process
Linux centos system boot process
Centos7 elk7.1.1 installation and use
Centos7 installation and configuration of Jenkins
Analysis of Hyper-V installation CentOS 8 problem
VMware Ubuntu installation detailed process (pro-test)