Customize DNS nameservers with DHCP setting by NetworkManger on CentOS 7

By default, Network Manager always changes the resolv.conf file if the interface is using DHCP. The NetworkManger puts the records from DHCP server on top and the customize DNS servers at bottom. It causes private DNS setting cannot be found. To fix it, just change the PEERDNS=no in /etc/sysconfig/network-scripts/ifcfg-eth0 and restart network

Change hostname on CentOS/Fedora

$ sudo hostnamectl set-hostname --static "YOUR-HOSTNAME-HERE"

If the hostname cannot be saved on Fedora after reboot, using the following command to fix it.

$ sudo restorecon -v /etc/hostname

This works on CentOS

$ sudo vi /etc/sysconfig/network

$ sudo vi /etc/hosts

$ sudo vi /etc/hostname