Two files need to be updated to change host name in Linux. Perform the changes as root user.

1. Update file:
# vi /etc/sysconfig/network
Change the value of HOSTNAME according to your need.
HOSTNAME=mars

2. Update the file:
#vi /etc/hosts
If you have static IP then add as below:
127.0.0.1 localhost localhost.localdomain
192.168.0.20 mars hostname

3. Restart networking in server to apply changes:
#/etc/init.d/network restart

 

 

 

 

 

Advertisements