How to change the hostname in linux

Jun 23, 2008 1 Replies

Hi, I am trying to change the host name of a linux machine. I have modified /etc/hosts as follows :


127.0.0.1 localhost.localdomain localhost ##< IP ADDRESS>

/etc/nsswitch.conf is modified as follows : #hosts: db files nisplus nis dns ##hosts: files nisplus dns hosts: files


/etc/sysconfig/network ##HOSTNAME= HOSTNAME=



Then I have executed these on the shell : hostname



service xinetd restart


After executing these steps, my machine is not taking the new hostname. If I execute #hostname



I get hostname as (none)



Can anyone tell me what is that which I am missing here. Thanks in Advance!



This is for the resolver only, not for the local hostname.

Depending on your distro it might be possible to edit /etc/hostname. You can always set the hostname manually by using "hostname "

Sven

"If you continue running Windows, your system may become unstable." (Windows 95 BSOD) /me is giggls@ircnet, http://sven.gegg.us/ on the Web

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required