HostOnNet Blog

Setting hostname On CentOS 7 Server

CentOS 7 come with a command hostnamectl to query and change the system hostname and related settings.

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

Set hostname

To set hostname, run

hostnamectl set-hostname HOST.YOUR-DOMAIN.EXTN


[root@localhost ~]# hostnamectl set-hostname
[root@localhost ~]# hostname
[root@localhost ~]# 

See also HostName

Posted in CentOS