[CentOS] Changing hostname?
bob at bobhoffman.com
Sun Sep 14 01:11:23 UTC 2008
> [kikinovak at calimero ~]$ cat /etc/hosts
> 127.0.0.1 calimero.local calimero localhost.localdomain
> [kikinovak at calimero ~]$ hostname
> [kikinovak at calimero ~]$ hostname --fqdn
> Wouldn't this be more correct?
I would suggest not making 'local' part of your server name.
Although localhost.localdomain, in a non network setting, can work
absolutely fine, there is an issue with your email headers. The use of
locahost, local, and stuff like that is a big red flag.
I changed, in my centos 5 server, where the host name was
(where the domain is one of my websites on the server, actually my name
Change, for sendmail to work with it, the file local-hosts-names
Add the new name to it
First of all, leave all the original stuff and do not alter.
Underneath the original stuff, just add
Then do this...
shell prompt> uname -n
shell prompt> hostname -s
shell prompt> hostname -d
shell prompt> hostname -f
shell prompt> hostname
All of these steps allows the mail headers, at least in sendmail, to
function properly. Other than that, unless you are in a network, or if you
are not sending mail, it is usually not a biggie if you miss some steps.
This is what I did to resolve a new hostname.
More information about the CentOS