Nov 30 2016

Change Hostname on OEL 7 CentOS 7

Category: Linux & UnixFatih Acar @ 10:24

You can use hostnamectl command to list and change hostname of operating system on OEL 7 or CentOS 7 version.

List Hostname Status


[root@localhost ~]# hostnamectl 

   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 6f021291e2384a219e1f23ca39eadc9a
           Boot ID: ec195c69cfde417b88b86f4d7419cf24
    Virtualization: vmware
  Operating System: Oracle Linux Server 7.3
       CPE OS Name: cpe:/o:oracle:linux:7:3:server
            Kernel: Linux 4.1.12-61.1.28.el7uek.x86_64
      Architecture: x86-64

Change Hostname Status


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

[root@localhost ~]# hostnamectl status

   Static hostname: pri
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 6f021291e2384a219e1f23ca39eadc9a
           Boot ID: ec195c69cfde417b88b86f4d7419cf24
    Virtualization: vmware
  Operating System: Oracle Linux Server 7.3
       CPE OS Name: cpe:/o:oracle:linux:7:3:server
            Kernel: Linux 4.1.12-61.1.28.el7uek.x86_64
      Architecture: x86-64

You can see new hostname when you logoff and again logon from current user.

12,575 total views, 15 views today

Tags: Linux Administration, System Administration

facebook comments:

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.