Contact Premier Online Trainings Today
Premier Online Trainings

Oracle DBA - How to change the hostname on Linux 7.6

Date Added: 01 Apr.2020 Date Updated: 01 Apr.2020 Oracle DBA Full Blog
 
How to change the hostname on Linux 7.6
 
[oracle@ebs ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.6 (Maipo)
[oracle@ebs ~]$ 
 
We have been using this way for most of the Linux versions & it works fine in CentOS/RHEL 7 as well.
In this way,  we will manually add hostname by editing /etc/sysconfig/network,
 
HOSTNAME=ebsupg.premier.com
and add your hostname,
 
[oracle@ebs ~]$ cat /etc/sysconfig/network
# Created by anaconda
# oracle-ebs-server-R12-preinstall Add NOZEROCONF=yes
HOSTNAME=ebsupg.premier.com
NETWORKING=yes
#NOZEROCONF=yes
[oracle@ebs ~]$ 
 
 
[root@ebs ~]#  hostnamectl
   Static hostname: localhost.localdomain
Transient hostname: ebs.abc.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 9644f89eabf543efa831e1b0ef795480
           Boot ID: 35519b3dd22340e18966e92da40cd2b9
    Virtualization: kvm
  Operating System: Oracle Linux Server 7.6
       CPE OS Name: cpe:/o:oracle:linux:7:6:server
            Kernel: Linux 4.14.35-1818.3.3.el7uek.x86_64
      Architecture: x86-64
[root@ebs ~]# 
 
 
Restart network services to implement the changes.
$ systemctl restart network
 
 
[root@ebsupg ~]#  hostnamectl
   Static hostname: ebsupg.premier.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 9644f89eabf543efa831e1b0ef795480
           Boot ID: a2680ea860094c1b8f5191bfc1cb35b1
    Virtualization: kvm
  Operating System: Oracle Linux Server 7.6
       CPE OS Name: cpe:/o:oracle:linux:7:6:server
            Kernel: Linux 4.14.35-1818.3.3.el7uek.x86_64
      Architecture: x86-64
[root@ebsupg ~]# 
 
 
[root@ebsupg ~]# hostname
ebsupg.premier.com
[root@ebsupg ~]#