How to change Server Hostname

3 posts / 0 new
Last post
#1 Tue, 02/26/2008 - 15:27
scholzr

How to change Server Hostname

When I installed virtualmin on my server, I apparently accidently typed .com onto my hostname when I wasn't supposed to. My server's hostname is not showing as server1.mydomain.com.com. I changed the hostname using the terminal and the following script: [code:1]echo server1.mydomain.com > /etc/hostname[/code:1] This has corrected the domain name on my server status page, but all of my DNS entries are still showing server1.mydomain.com.com.

Also, when I query the hostname in the terminal (# hostname), it shows server1.mydomain.com.com. when I use (# hostname -f) it is giving a random name: c13-ss-2-lb.cnet.com

How do I change these?<br><br>Post edited by: scholzr, at: 2008/02/26 15:30

Wed, 02/27/2008 - 06:27
scholzr

OK, So I found the answer (or at least one which worked for me). The script which I was using in the terminal was correct, but I needed to completely restart the system after doing that. That took care of the hostname issues. To change the DNS Entries, I had to go into the DNS records for each virtual server on the machine and fix the DNS Entries.

Wed, 02/27/2008 - 07:19 (Reply to #2)
DanLong

I'm kind of confused why and what you're posting.

Are you using Virtualmin? If so then go to webmin, then the networking module, the network config, and then click the hostname module. Make sure the change hostname address is checked.

Restarting the machine after changing the hostname is correct to make sure it's attached to the interface. A more reliable method of Updating the DNS records would have been to turnoff and turn on DNS to the virtual server to make sure virtualmin knows what's going on. You may still want to do that to ensure that the slaves all get updated correctly (assuming you have a secondary server setup).

hope that helps,
Dan

Topic locked