Change hostname / domain name

Q. I would like to change hostname and domain name for my Linux server. Where can I set the local hostname and domain name of my server?

A. You can use hostname command to show or set the system’s host name and dnsdomainname command to show the system’s DNS domain name. But the changes are temporary if you use these commands.

Local hostname and domain name of your server defined in text configuration located in /etc directory.

If you are using Red Hat or Fedora Linux
Use redhat-config-network GUI tool. Type following command and click on DNS tab > Setup hostname and domain name:
# redhat-config-network
On other hand you can edit a text file. Find out and set up the value for HOSTNAME in the file /etc/sysconfig/network:
# vi /etc/sysconfig/network
Setup/replace HOSTNAME
HOSTNAME=web.nixcraft.com
Where, web is hostname and nixcraft.com is your DNS domain name.

Jan D.
Jan D.

"The only real security that a man will have in this world is a reserve of knowledge, experience, and ability."

Articles: 673

Leave a Reply

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *