Virtuozzo / OpenVZ cPanel VPS hostname keeps changing
This guide can only be completed if you have access to the hostnode. VPS users would need to contact their hosting providers.
It’s vital your server has an FQDM setup as its hostname. An FQDM (Fully Qualified Domain Name) will consist of two words and two full stops. Something like server.first2host.co.uk would be an FQDM whereas just server would be an invalid choice.
cPanel will use your hostname to send mail unless you have set up your server to send email via each accounts dedicated IP address. Not only mail, cPanel will also deploy SSL certificates to your server so you do not see any security warnings when logging in.
If you run a Virtuozzo cPanel VPS Server, formally OpenVZ then some settings on the hostnode can mean when you reboot your server your hostname will revert back to a single word. This will cause errors you’re your cPanel server and this needs to be addressed urgently.
If your cPanel servers hostname keeps changing then first check the configuration file for the server. The configuration file is usually located at
Find the CTID of the server that is having the hostname issues and inspect the configuration file by issuing
Look for the hostname= value and ensure the hostname is correct. If the hostname is what it should be then you will need to edit a file on the hostnode to stop Virtuozzo from making changes to the hostname on servers.
Open the file /etc/vz/dists/scripts/redhat-set_hostname.sh
Find the line that states
echo "$val" > /etc/hostname
And in front of this line place a comment. “#”
# echo "$val" > /etc/hostname
Next, save the file and set the hostname in the VPS server that keeps reverting back to a single word. Reboot that server from the command line
vzctl restart 9999
When you login to the VPS Server next you should see that the hostname has not changed at all and is still set to what you set it to before you rebooted the server.
How was this article? – Virtuozzo / OpenVZ cPanel VPS hostname keeps changing
You might also like
More from Linux VPS Servers
Create Docker Container And The Basic Docker Commands Now that you have Installed Docker on your First2Host KVM VPS it's time …