Step 1: Check the host name using hostnamectl command
[root@localhost ~]# hostnamectl status
Static hostname: localhost.localdomain
Icon name: computer
Chassis: n/a
Machine ID: 0d922750ffd94b6b9bce4b2c2b45e8d8
Boot ID: 80bdfd10109148688a0dddb2cdee0f8a
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server
Kernel: Linux 3.10.0-123.el7.x86_64
Architecture: x86_64
Step 2: Change hostname to rhel7
[root@localhost ~]# hostnamectl set-hostname rhel7
Step 3: Now check the hostname status
[root@localhost ~]# hostnamectl status
Static hostname: rhel7
Icon name: computer
Chassis: n/a
Machine ID: 0d922750ffd94b6b9bce4b2c2b45e8d8
Boot ID: 80bdfd10109148688a0dddb2cdee0f8a
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server
Kernel: Linux 3.10.0-123.el7.x86_64
Architecture: x86_64
[root@localhost ~]# hostname
rhel7
Step 4: Reboot OS
[root@localhost ~]# reboot
login as: root
root@192.168.133.129's password:
Last login: Tue Jan 26 15:13:10 2016 from 192.168.133.1
[root@rhel7 ~]#
[root@localhost ~]# hostnamectl status
Static hostname: localhost.localdomain
Icon name: computer
Chassis: n/a
Machine ID: 0d922750ffd94b6b9bce4b2c2b45e8d8
Boot ID: 80bdfd10109148688a0dddb2cdee0f8a
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server
Kernel: Linux 3.10.0-123.el7.x86_64
Architecture: x86_64
Step 2: Change hostname to rhel7
[root@localhost ~]# hostnamectl set-hostname rhel7
Step 3: Now check the hostname status
[root@localhost ~]# hostnamectl status
Static hostname: rhel7
Icon name: computer
Chassis: n/a
Machine ID: 0d922750ffd94b6b9bce4b2c2b45e8d8
Boot ID: 80bdfd10109148688a0dddb2cdee0f8a
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server
Kernel: Linux 3.10.0-123.el7.x86_64
Architecture: x86_64
[root@localhost ~]# hostname
rhel7
Step 4: Reboot OS
[root@localhost ~]# reboot
Step 5: Check now the OS name changed or not
root@192.168.133.129's password:
Last login: Tue Jan 26 15:13:10 2016 from 192.168.133.1
[root@rhel7 ~]#