Menu Close

How to Change Hostname on Linux

This article show to change hostname in linux CentOS 7 and Ubuntu 18 :

Change hostname on linux Centos 7.7 :

# hostnamectl set-hostname centos77.linodelinux.com
# hostnamectl
hostnamectl
   Static hostname: centos77.linodelinux.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 341e401e827641bda8eac222c3988c65
           Boot ID: 0d2752d42a6a4325aa07f8d92162b852
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-957.27.2.el7.x86_64
      Architecture: x86-64

Change hostname on linux Ubuntu 18 :

# hostnamectl
   Static hostname: hostname.linodelinux.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 4bcc54714f99a80731bcef0157694ff4
           Boot ID: 697aaea6db184654a57ac7636523ba4b
    Virtualization: vmware
  Operating System: Ubuntu 18.04.4 LTS
            Kernel: Linux 4.15.0-91-generic
      Architecture: x86-64
# hostnamectl set-hostname ubuntu18.linodelinux.com
# hostnamectl
   Static hostname: ubuntu18.linodelinux.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 4bcc54714f99a80731bcef0157694ff4
           Boot ID: 697aaea6db184654a57ac7636523ba4b
    Virtualization: vmware
  Operating System: Ubuntu 18.04.4 LTS
            Kernel: Linux 4.15.0-91-generic
      Architecture: x86-64

Leave a Reply

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