Post

Ubuntu 18.04.1 – Change hostname

While I’d normally use “hostnamectl set-hostname ” to modify the hostname of a Linux box, that doesn’t work for Ubuntu 18.04. The hostname will remain unchanged. Instead, modify as follows.

In /etc/cloud/cloud.cfg, modify “preserve_hostname” from “false” to “true”:

1
vi /etc/cloud/cloud.cfg

Modify hostname to the value you want in /etc/hostname:

1
vi /etc/hostname

Reboot

This post is licensed under CC BY 4.0 by the author.