Hostname Information

Changing hostname on OEL 7

Hostname change on RHEL

Additional Hostname Domain Stuff

In this post we will see how we can change the hostname on Linux 7 host. This article is demonstrated on Oracle Enterprise Linux 7.1 – 64 Bit.

Check the existing hostname:

We can use command “hostnamectl” to check the existing hostname.

[root@localhost ~]# hostnamectl status
Static hostname: localhost.localdomain
Icon name: computer
Chassis: n/a
Machine ID: fc456ff1ece743cfb79756356feaca35
Boot ID: c120fe1a556d4cf78f0cfe548800bb65
Virtualization: oracle
Operating System: Oracle Linux Server 7.1
CPE OS Name: cpe:/o:oracle:linux:7:1
Kernel: Linux 3.8.13-55.1.6.el7uek.x86_64
Architecture: x86_64
[root@localhost ~]#

It will read the value of static hostname from file “/etc/hostname”.

Update hostname in “/etc/hostname” file:

[root@localhost ~]# cat /etc/hostname
oraerp1
[root@localhost ~]# cat /etc/hostname.bkp
localhost.localdomain
[root@localhost ~]#
[root@localhost ~]# hostnamectl status
Static hostname: oraerp1
Icon name: computer
Chassis: n/a
Machine ID: fc456ff1ece743cfb79756356feaca35
Boot ID: c120fe1a556d4cf78f0cfe548800bb65
Virtualization: oracle
Operating System: Oracle Linux Server 7.1
CPE OS Name: cpe:/o:oracle:linux:7:1
Kernel: Linux 3.8.13-55.1.6.el7uek.x86_64
Architecture: x86_64

Verify the new hostname:

After connecting with the new session then new hostname will be reflected.

[root@localhost ~]# su -
Last login: Tue Nov 10 00:55:45 AST 2015 on pts/0
[root@oraerp1 ~]#