I am new to ubuntu and I am trying to change hostname of my ubuntu server 18.04.2 LTS. I've already changed /etc/hostname and /etc/hosts and rebooted. But it didn't work.
My files: /etc/hostname:
127.0.0.1 localhost.localdomain ubuntu-s2
::1 localhost6.localdomain6 localhost6
::1 localhost ip6-localhost ip6-loopback
ff02::2 ip6-allrouters ff02::3 ip6-allhosts
Is the only way to do it to change preserve hostname to true in /etc/cloud/cloud.cfg?