How To Change The Hostname On Your Ubuntu System

https://www.server-world.info/en/note?os=Ubuntu_16.04&p=hostname

1. Temporarily change hostname. (but if rebooting, it will be back).

show current hostname:

$ hostname
ubuntu      # output

change hostname (substitute ‘newname' with any name you choose):

$ hostname newname

verify the change:

$ hostname
newname     # output

2. Change hostname permanently.

$ hostnamectl set-hostname newname

verify settings:

$ hostnamectl

output example:

   Static hostname: newname
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 4146e8929ffa426ebdac4569cf024113
           Boot ID: fb2d71a7d85b44a39a8444a94e510b08
    Virtualization: kvm
  Operating System: Ubuntu 16.04 LTS
            Kernel: Linux 4.4.0-21-generic
      Architecture: x86-64

access the url at:
http://yourhostname

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.