(Last Updated On: August 12, 2018)

After fresh installation of CentOS 7, the following are list of things that you may consider doing to get your server ready for any kind of setup. The list is not  comprehensive but it’s enough for new Server. We had talked about:
Top things to do after Fresh Installation of Fedora 23
Top Ten Must Do Things After Installing Kali Linux

1. If you installed the OS as root user and didn’t add any standard user account, do it here.

useradd "username"
passwd "username"

Give user a privilege to switch to root as administator.

usermod -G wheel "username"
vim  /etc/pam.d/su

Uncomment line 6 to look like one shown below.

auth            required        pam_wheel.so use_uid

Transfer root privilege to a user you added, here the username is “username”.

visudo

# add to the end of the file  the user added to use use all root privileges.

username  ALL=(ALL)       ALL

2. Disable SELinux (Security-Enhanced Linux) if you don’t need it.

sed -i 's/(^SELINUX=).*/SELINUX=disabled/' /etc/selinux/config

If you reboot your system and type

sestatus

You should get the output saying selinux have been disabled. See below

SELinux status:                 disabled

3. If you don’t need a firewall, disable it using commands below.

systemctl stop firewalld 
systemctl disable firewalld rolekit

4. Configure hostname for the server.

hostnamectl set-hostname "yourhostname"

5. Configure timezone for the server with the command below. Replace Africa/Nairobi with your correct timezone.

timedatectl list-timezones 
timedatectl set-timezone Africa/Nairobi

Confirm with

 timedatectl

If you Love what we do, support us by downloading this tutorial as pdf from the link below:
 Tags.
6. Configure Ethernet network connection to give it ip address and other network parameters.
First, you need to check the name of the Ethernet device before modifying its configurations. Use command below

 nmcli device

My Ethernet adapter is eno1.
I will configure my eno1 with ip address 192.168.1.4, subnet mask 255.255.255.0, gateway 192.168.1.1, DNS server 192.168.1.1 . The method of configuration will be set to manual.

nmcli connection modify eno1 ipv4.addresses 192.168.1.4/24
nmcli connection modify eno1 ipv4.gateway 192.168.1.1
nmcli connection modify eno1 ipv4.dns 192.168.1.1
nmcli connection modify eno1 ipv4.manual method

Make changes take effect by restarting the interface.

nmcli connection down eno1
nmcli connection up eno1

Confirm that the changes have been committed:

 ip addr show

7. If your network doesn’t use ipv6, you can disable it by opening grub configuration file and adding  ipv6.disable=1 to GRUB_CMDLINE_LINUX on Line 6.

vim  /etc/default/grub

Your results should look like one shown below.

GRUB_CMDLINE_LINUX=" ipv6.disable=1 rd.lvm.lv=fedora/root rd.lvm.lv=fedora/s    wap rhgb quiet"

Update grub configuration

grub2-mkconfig -o /boot/grub2/grub.cfg

8. Now do system update and upgrade.

yum -y update

7. Install tab completion package

yum install bash-completion 

8. Add additional essential repositories.

yum -y install yum-plugin-priorities
yum -y install epel-release
yum -y install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

Modify priorities.

sed -i -e "s/]$/]npriority=6/g" /etc/yum.repos.d/rpmforge.repo 
sed -i -e "s/]$/]npriority=4/g" /etc/yum.repos.d/epel.repo 
sed -i -e "s/]$/]npriority=1/g" /etc/yum.repos.d/CentOS-Base.repo 

9. Configure vim

yum -y install vim-enhanced 

a) Set global alias for vim by editing file /etc/profile.

vim  /etc/profile

b) Add the line below to the end

alias vi='vim'

c) Apply changes

source /etc/profile

d) To configure vim for your user account only, save configurations to ~/.vimrc file but for all user account write to /etc/vimrc.

vi ~/.vimrc 

Then add the following lines

set nocompatible
set fileformats=unix,dos
set history=100
set ignorecase
set number
set showmatch
syntax on
highlight Comment ctermfg=LightCyan
set wrap
set incsearch
set hlsearch
set smartcase

9. If you would like to do Virtualization with KVM, do thw following.

yum -y install qemu-kvm libvirt virt-install bridge-utils
yum -y install libguestfs-tools virt-top
yum -y install spice-server spice-protocol 

10. Install Apache,php, MariaDB and phpmyadmin.

yum -y install httpd
yum -y install php php-mbstring php-pear
systemctl  restart httpd
yum -y install mariadb-server 

Set up MariaDB password.

mysql_secure_installation

Say yes to set root password,remove anonymous users,disallow root login remotely and remove test database.Then reload privilege tables.
Try logging in with your password.

mysql -u root -p

Install phpMyAdmin

yum -y install phpMyAdmin php-mysql php-mcrypt

11. Install docker

yum -y install docker

12. Set keymap and locale settings.

 localectl set-locale LANG=en_US.UTF-8
 localectl
localectl set-keymap us

13 Changing Run-Level:
You can change runlevel by linking to /etc/systemd/system/default.target. You can change runlevels between graphical and multi-user using the following.

systemctl set-default graphical.target
reboot

To change to runlevel 3 type:

systemctl set-default multi-user.target 
reboot

If you Love what we do, support us by downloading this tutorial as pdf from the link below:
 Tags.
Must do things after installing CentOS 7 server
Basic CentOS 7 Server setup guide