[CentOS] hostname changes

Bob Hoffman bob at bobhoffman.com
Wed Jun 17 18:02:38 UTC 2009


>How do I change the hostname? 
>In particular, what is the difference between /etc/hosts and 
>/etc/sysconfig/network files?
> Where should I make the changes? 
	 

change
/etc/sysconfig/netowrk
and make the hostname=server.domain.com

change localhostnames
add the new hostname to the file

change etc/hosts
xx.xx.xx.xx server.domain.com server

restart the computer. You need to do this. Yes, you need to restart/reboot
it.

then run these commands.
(assumes your hostname is mail.example.com)


if any of these do not jibe, more to do until you get it right.

shell prompt> uname -n
mail.example.com
shell prompt> hostname -s
mail
shell prompt> hostname -d
example.com
shell prompt> hostname -f
mail.example.com
shell prompt> hostname
mail.example.com

Lastly, you need to redo your certifercates for your computer since they
(your openssh and maybe some others) are set up for the previous domain. In
actual practice you may seldom see any issues with this, but the error
messages will appear for some users trying to access different things....

Also, if you have stuff like logwatch or other system things going to a
local mail make sure spamassassin or procmail rules are updated to deal with
the change in localhost.localdomain so they are not junked.

Always make sure the normal things you are used to are still happening or
being received after you change the hostname....many things can be affected,
slightly or more, when doing it. Nothing usually server breaking.

This should do you well




More information about the CentOS mailing list