[CentOS] Changing hostname?

Sun Sep 14 01:11:23 UTC 2008
Bob Hoffman <bob at bobhoffman.com>

> [kikinovak at calimero ~]$ cat /etc/hosts

>       calimero.local calimero localhost.localdomain 
> localhost
> [kikinovak at calimero ~]$ hostname
> calimero.local
> [kikinovak at calimero ~]$ hostname --fqdn
> calimero.local
> 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
server too)

Change, for sendmail to work with it, the file local-hosts-names
Add the new name to it

Change /etc/hosts
First of all, leave all the original stuff and do not alter.
Underneath the original stuff, just add
<ipaddress>  server1.mydomain.com


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.