Friday, December 27, 2013

Change Host-Name in Linux

Display Hostname

To display the current hostname, we can use hostname command.


Change Hostname

We've to update two files:

/etc/sysconfig/network  or /etc/hostname

To add/remove hosts on Redhat / CentOS / Fedora / Debian / Ubuntu

#vim /etc/hosts
save and close :wq
Note: add all required hosts with IP

To add/remove hostname on Redhat / CentOS / Fedora

#vim /etc/sysconfig/network

save and close :wq


To add/remove hostname on Debian / Ubuntu

#vim /etc/hostname

save and close :wq


No comments: