Some times you need to change the “hostname” of your CentOS Box, like for me I need to change the “hostname” when ever I clone my VM.
changing “hostname” involves easy steps
# nano /etc/sysconfig/network #
will show you some thing like
# HOSTNAME=HOST-NAME.DOMAIN-NAME.COM #
change the hostname to what ever you like, save the file and now You may need to edit the /etc/hosts (optional)
nano /etc/hosts
if you see output like following, you do not need to make changes in your host
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
but in case you see something like this
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 77.30.0.38 HOST-NAME.DOMAIN-NAME.COM HOST-NAME
change the hostname here as well.
You are done, just restart the network to take effect of changes.
service network restart
No Comments Yet