What is difference between those two methods for changing host name on CentOS 7? I want to setup this centOS with a FQDN.
The first way is vi /etc/sysconfig/network
and vi /etc/hosts
files. but this way somehow wont work, after I changed the host name in this 2 locations, rebooted, run hostname
it still shows me hostname as "localhost"
The second way after research is using hostnamectl set-hostname
or hostname set-hostname xxx.xxx --static
command.
If using 2nd way to change hostname, it modifies which file?