Gojko

Well-Known Member
Nov 24, 2014
112
7
68
Macedonia
cPanel Access Level
Root Administrator
VPS, on HOST i set hostname, on /etc/hosts and /etc/sysconfig/network there is hostname what i want but in WHM in "change hostname" i have only "server1" of "server1.domain.tld"

When i change in WHM to "server1.domain.tld" everything is ok with change log... But when i reboot vps hostname back to "server1"

So what i need to do?
 

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
807
158
168
New Jersey
cPanel Access Level
DataCenter Provider
Are you using OpenVZ and Centos7? Its an issue with SolusVM I believe.

1. Set the hostname in WHM
2. in SSH run:
Code:
# chattr +i /etc/hostname
Reboot, it will stick.

In the future, if you need to change the hostname you have to run:

Code:
# chattr -i /etc/hostname
 
  • Like
Reactions: DjordjeB

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,220
463
Hello,

You may want to report the issue to your VPS hosting provider instead of adding the immutable attribute to the
/etc/hostname file. They should be able to provide you with instructions on how to save a new hostname to your VPS configuration.

Thank you.