Update hostname¶
Update hostname
sudo hostnamectl set-hostname <HOSTNAME>
Edit the /etc/cloud/cloud.cfg
file
sudo vim /etc/cloud/cloud.cfg
Search for preserve_hostname and change the value from false to true:
# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: true
To verify that the hostname was successfully changed, once again use the hostnamectl command:
hostnamectl
Then reboot
Last update: March 4, 2023