Skip to content
Search

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.

# /etc/hosts.allow
sshd: 192.168.0.

# /etc/hosts.deny
sshd: ALL

Update

Update all installed packages.

$ yum -y update
$ yum install net-tools lsof git

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.

$ useradd -G wheel [사용자명]
$ passwd [사용자명]

Grant the wheel group permission to use the sudo command.

$ visudo

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.

$ vi /etc/ssh/sshd_config

Around line 39, change it to PermitRootLogin no, then restart the service.

$ service sshd restart

Then add the users allowed to log in.

AllowUsers username

Language setting

You can change the language settings at the path below.

$ vi etc/locale.conf

Apache HTTPD

Install Apache httpd if needed.

author Zer0 sitemap