How to change the hostname / domainname on a Linux system
If you forget to set your correct hostname / domainname at your linux installation then you can easily fix it if you follow the next steps from this “tutorial”. Changing hostname/domainname is easy but first you will need to know what kind of linux distribution do you run: Debian or RedHat based. I will try to enumerate the most common distributions based on Debian and RedHat to help you find the roots of yours distribution.
Debian based distributions:
* Collax
* Damn Small Linux
* Debian JP
* Embedded Debian
* Euronode
* Floppix
* Gibraltar
* GNUstep LIVE CD
* Kanotix
* KNOPPIX
* Linspire
* Linex
* MEPIS
* M.N.I.S
* Morphix
* RAYS LX
* Stonegate
* Ubuntu, Kubuntu, Xubuntu
* Xandros
RedHat based distributions:
* Asianux
* CentOS
* ClarkConnect
* Scientific Linux
* SME Server
* White Box Enterprise Linux
* Cobalt RaQ4
* DomaTes Linux
Changing permanently the hostname / domainname on linux distributions based on RedHat:
1. You can use redhat-config-network GUI tool. Just go to DNS tab > Setup hostname and domain name. After just save your config and you are done.
2. Or you can edit /etc/sysconfig/network and replace the value of HOSTNAME with your domain name.
Edit /etc/sysconfig/network
nano /etc/sysconfig/network
Replace HOSTANAME with your hostname:
HOSTNAME=home.randombugs.com
Changing permanently the hostname / domainname on linux distributions based on Debian:
Just edit /etc/hostname and replace or add your hostname there.
Edit /etc/hostname:
nano /etc/hostname
Replace/Add your hostname:
home.randombugs.com
To make your changes active just run in console:
/etc/init.d/hostname.sh restart
On ALL Linux system is recommended to change domainname and hostname in /etc/hosts and /etc/resolv.conf, because all have an influence to your network settings. Just look in above files after your old hostname/domainname and just replace it.
Changing the hostname / domainname on any linux distributions:
You can also change your hostname temporarily on any disitribution with hostname comand:
hostname home.randombugs.com
and this will remain until next reboot.
To change your hostname permanently on any distribution just edit /etc/sysctl.conf and add:
kernel.hostname=[hostname]
and to make your changes active just run:
sysctl -p
Good luck !















I set my full host and domain name in /etc/hostname then I followed the steps for Ubuntu to change the domain name but still have the following results:
‘hostname -d’ returns a null string, but should be the domain name.
‘hostname –fqd’ returns only the hostname, but should be the full host and domain name string.
Any other suggestions?
Look in /etc/hosts and tell me if you have your host.domain configured there !
Regards
What company is the best Domain Registrar? i’ve heard that Godaddy and Moniker are the best.’;`
Leave your response!
Donate me a Beer!
Recognition Wall
Syndicate
Blogroll
Tags
Promote
Categories
Recent Posts
Most Commented
Recent Comments