Wednesday, January 27, 2016

Set hostname for CentOS 7 using hostnamectl

1. Listing hostname using "hostnamectl" or "hostnamectl status"

[root@localhost ~]# hostnamectl
   Static hostname: helloworld.com
         Icon name: computer-server
           Chassis: server
        Machine ID: aaaaaaaaaaaaa
           Boot ID: ddddddddddd
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64

2.Setting static host-name using hostnamectl

# hostnamectl set-hostname "helloworld.com" --static

3. Delete static host-nameusing hostnamectl
# hostnamectl set-hostname "" --static

No comments: