Change Hostname & FQDN in RHEL or CentOS

By | October 19, 2013

Step 1: Edit the /etc/hosts file and give IP Address,FQDN name and Server name

#vi /etc/hosts
ipaddress_of_system server1.kevinfatkin.net server1

Step 2: Edit /etc/sysconfig/network file ,give HOSTNAME as machine name i.e server1

# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server1

Step 3: Restart the network service.
/etc/init.d/network restart

Now check the hostname and FQDN with command called “hostname” and “hostname -f” respectively.

#hostname
server1
#hostname -f
server1.kevinfatkin.net