Set FQDN/hostname

From 0xWIKI
Jump to: navigation, search

First we set the hostname in the hosts file; this file is used for local name resolution Remember to replace 'mybox' with the hostname you want and 'domain' with the domain info. If the machine is not on a domain network, I set this to 'local'

 echo -e "127.0.0.1\tmybox.domain mybox localhost" > /etc/hosts

Set the hostname in /etc/conf.d/hostname

 sed -i /'HOSTNAME\.*'/c'HOSTNAME\="mybox"' /etc/conf.d/hostname

Update the current hostname without rebooting

 hostname mybox

Confirm the hostname was set properly

 hostname -f

If it was sucessful, you will see the output like the following

 mybox.domain
Personal tools