HOSTNAME resets after reboot... why?
1) Create a new linode (Centos 7).
2) login to the console as root (using Weblish).
3) set hostname using "hostname "my.host.com" (not actual name)
4) reboot
5) login to the console as root (using Weblish).
6) get hostname using "hostname"
7) hostname is no longer "my.host.com", it is the original hostname assigned by linode.
Why does this happen?
2 Replies
On CentOS7, changes to your hostname with the hostname
command won't persist upon reboot. Instead, use the following command (per our Getting Started Guide):
hostnamectl set-hostname my.host.com
Your hostname will now remain after reboots.
I would have never known this by searching the internet for why. I was later told to edit the /etc/hostname file with nano and change it there which I did. This also solved the mysterious changing hostname issue.
It's more acceptable to me to use the command line so I'll adopt that in the future.