CentOS:FirstSetting
lastmod 2025-02-14created 2015-04-2214 edits
A summary of what to do after first installing CentOS.
Rename the network interface
Following Ifconfig#CentOS7 : Change network interface name, change the default network name from enp0s3 to eth0.
Go to the /etc/sysconfig/network-scripts directory and rename the ifcfg-enp0s3 file to ifcfg-eth0.
Ethernet settings
Change it to the following format.
HWADDR=08:00:27:5A:B2:0F
TYPE=Ethernet
BOOTPROTO=static
#DEFROUTE=yes
#PEERDNS=yes
#PEERROUTES=yes
#IPV4_FAILURE_FATAL=no
#IPV6INIT=yes
#IPV6_AUTOCONF=yes
#IPV6_DEFROUTE=yes
#IPV6_PEERDNS=yes
#IPV6_PEERROUTES=yes
#IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=5afbaf02-c4d0-470a-b6e4-f7784a45e6d9
ONBOOT=yes
IPADDR=192.168.1.108
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
Note that if you need to regenerate the UUID above, you can use uuidgen.
host setting
Change the hostname by editing the /etc/hostname file.
If there is a list of hosts to register, add them to /etc/hosts.
Add access permissions for hosts. Usually, access to SSH is restricted as shown below.
Update
Update all installed packages.
If you installed it with VirtualBox, install the Guest Additions.
wheel user setting
If only the root account exists, create a new account with (delegated) administrator privileges and set its password.
Grant the wheel group permission to use the sudo command.
Around line 105, add or uncomment %wheel ALL=(ALL) ALL.
SSH Setting
Change port 22 if needed. If you change the port, add a port rule to firewalld on CentOS7, or to iptables on CentOS6 and earlier.
For issues with changing the port, see OpenSSH#SSH_PORT_CHANGE.
Prevent logging in to SSH as ROOT.
Around line 39, change it to PermitRootLogin no, then restart the service.
Then add the users allowed to log in.
Language setting
You can change the language settings at the path below.
Apache HTTPD
Install Apache httpd if needed.