In the old days I could simply edit /etc/hostname, but here we are with the latest and greatest.
This is tested on an Ubuntu 18.04 LTS, ymmv.
sudo hostnamectl set-hostname YOURHOSTNAMEHERE
sudo nano /etc/cloud/cloud.cfg
> preserve_hostname: true
In the old days I could simply edit /etc/hostname, but here we are with the latest and greatest.
This is tested on an Ubuntu 18.04 LTS, ymmv.
sudo hostnamectl set-hostname YOURHOSTNAMEHERE
sudo nano /etc/cloud/cloud.cfg
> preserve_hostname: true