Unable to change hostname permanently

nobodyk

Well-Known Member
Aug 1, 2010
90
0
56
In whm, my hostname is "mydomain". I changed it to "server1.mydomain.com" as recommended by whm. When I change the hostname, I have to run "/scripts/rebuildhttpdconf" because some sites get the default cpanel homepage. The problem is that when I reboot my VPS, it changes the hostname back to "mydomain." I tried deleting my old hostname by doing pico to my host file, but still no luck.

I don't know if this means anything, but under "Nameserver IPs" I have only one nameserver. Which is ns1.mydomain.com
 

Deepika

Registered
Jul 23, 2010
4
0
51
Hi,

1. You need to change hostname by using following command on the server.
hostname server1.yourdomainname.com
2. Also need to change the entry in file the following file.
vi /etc/sysconfig/network
HOSTNAME=server1.yourdomainname.com
3. After correcting the hostname entries via shell login into your WHM go to the path and correct the hostname entry :
Main >> Server Configuration >> Basic cPanel/WHM Setup

4. Once this done go to the following path in your WHM.
Main >> Networking Setup >> Change Hostname
Click on the change tab next to "New Hostname"

5. Last step is go to the path
Main >> DNS Functions >> Add an A Entry for your Hostname
You will see the hostname and Server main IP click "Add Entry" Tab

Regards,
Deepika :)
 

nobodyk

Well-Known Member
Aug 1, 2010
90
0
56
I'm afraid I already had those settings. The problem is that when I reboot the hostname changes.
 

arunsv84

Well-Known Member
Oct 20, 2008
372
1
68
127.0.0.1
cPanel Access Level
Root Administrator
Hostname change

Hi,

Have you changed the hostname in /etc/hosts ?

Please edit /etc/hosts and enter the line

ipaddress hostname

Let me know the results.
 

nobodyk

Well-Known Member
Aug 1, 2010
90
0
56
Yes I have tried that already like I mentioned in my op. Is this something out of my hands and have to contact my VPS provider? or is this a whm misconfiguration?
 

Miraenda

Well-Known Member
Jul 28, 2004
243
6
168
Coralville, Iowa USA
cPanel Access Level
Root Administrator
It's the main VPS that's resetting it. You'll need to contact your VPS provider if you don't manage the main VPS to ask them to correct the hostname on the main node to the full name.
 

linux7802

Well-Known Member
Dec 14, 2007
232
1
68
cPanel Access Level
Root Administrator
Solution

When ever you reboot VPS, VPS will check hostname entry in VPS hosted main node config file for your VPS. There for you have to contact your VPS provider and ask them to set the proper hostname for your VPS from main node as well as its better if you also ask your VPS provider to set rDNS for your hostname, so that you will not face any E-mail problem in future. :)
 

jacampbe

Active Member
Mar 19, 2008
30
0
56
Unable to keep WHM / cPanel basic settings

We're having a similar problem. However, in our case the hostname is not lost when we reboot our (CentOS 5) dedicated virtual server .....

WHM >> Main >> Server Configuration >> Basic cPanel/WHM Setut
Server Contact E-Mail Address is lost
Nameservers are lost


WHM >> Main >> Networking Setup >> Resolver Configuration
The 2nd resolver server is lost

Any thoughts ?
 

nobodyk

Well-Known Member
Aug 1, 2010
90
0
56
yeah, I had to change my nameservers at the VPS level. That seem to worked.

I also notice that in my container you can change the network resolvers, you should check that the IP resolvers are corrently entered at the VPS level. Use your VPS control panel or contact your host. That's what I did. Hope that helps.