How To Change Your Linux Server’s Hostname

April 21st, 2008

To change your server’s hostname manually on CentOS / RHEL is quite easy. Simply edit the file /etc/sysconfig/network with your favorite text editor and change the value of the HOSTNAME parameter to the new hostname. Your configuration file should look something like this:

/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=”newhostname.domainname.com”
GATEWAY=”192.168.0.1″GATEWAYDEV=”eth0″
FORWARD_IPV4=”yes”

You’ll also need to replace all occurencies of your old hostname in /etc/hosts. If your Linux box uses DHCP to obtain its IP address, you’ll also need to edit /etc/dhclient-eth0.conf (assuming your ethernet adapter is named eth0) and adjust the send host-name parameter correctly.

When you’re done, reboot your computer for the change to take effect.

0 responses so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment




Webmaster Resources: Web Hosting Blog
© Copyright 2012 - TheWebHostingHero.com
Follow us on TwitterFacebookSubscribe to our RSS Feed