How to set/change a hostname on CoreOS Linux

The following config will provide you we a set of commands on how to updated a hostname on your CoreOS Linux server. Let’s start by displaying the current hostname:

localhost ~ # hostnamectl       
   Static hostname: n/a
Transient hostname: localhost
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: 1759d8fe862a4c17b50a56eebb7a1e26
           Boot ID: 0de6b2cfbf31454299af6729737fc648
  Operating System: CoreOS 723.3.0
            Kernel: Linux 4.0.5
      Architecture: x86-64

Using the hostnamectl command again we now set a new hostname to coreos:

 
localhost ~ # hostnamectl set-hostname coreos

Confirm a correct settings:

localhost ~ # hostnamectl
   Static hostname: coreos
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: 1759d8fe862a4c17b50a56eebb7a1e26
           Boot ID: 0de6b2cfbf31454299af6729737fc648
  Operating System: CoreOS 723.3.0
            Kernel: Linux 4.0.5
      Architecture: x86-64

Your prompt hostname will display a new hostname next time you login to your CoreOS system.