If by domain name you mean domain suffix, then
/etc/resolv.conf is where the domain goes. Just add a line
Then to set your server's hostname, there's only one good place for it, and it's
/etc/sysconfig/network. Add a line
HOSTNAME=yourhostname, and don't put the domain suffix in the hostname, as it will take it from
You do not need to add anything (and shouldn't) in
/etc/hosts to define your hostname. This is the wrong way to do it.
To test your setup, use the
hostname -s to get the short name (should reflect what you have in
hostname -d command to test your domain (should reflect what you have in
To test it all together, you can use
hostname -f or
hostname -A for the very long version.