# hostnamectl

Static hostname: ubuntu
Icon name: computer-vm
Chassis: vm
Machine ID: ceb8b579410b472899a95049f8a61e05
Boot ID: 3f73eea15fb34a38937488149143d9d3
Virtualization: oracle
Operating System: Ubuntu Bionic Beaver
Kernel: Linux 4.13.0-32-generic
Architecture: x86-64

# sudo hostnamectl set-hostname linuxconfig

Futhermore, check for the existence of /etc/cloud/cloud.cfg configuration. If the file exists edit the file and change the settings within:

FROM:
preserve_hostname: false
TO:
preserve_hostname: true

# hostnamectl

Static hostname: linuxconfig
Icon name: computer-vm
Chassis: vm
Machine ID: ceb8b579410b472899a95049f8a61e05
Boot ID: 3f73eea15fb34a38937488149143d9d3
Virtualization: oracle
Operating System: Ubuntu Bionic Beaver
Kernel: Linux 4.13.0-32-generic
Architecture: x86-64

You may also want to update your /etc/hosts file so the system can resolve itself via new host name. Open /etc/hosts file:

# vi /etc/hosts

and append your new hostnane right after the old hostname:

# cat /etc/hosts

127.0.0.1 localhost
127.0.1.1 ubuntu linuxconfig

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters