How to permanent change hostname in OCI for OEL 7 and later version

 

Step 1.

Update the /etc/hostname file following command.

 

[root@uat-database-dr rman_bkp]# hostnamectl set-hostname ccuine1126.xxx.co.in

 

 

 

 Step 2.

 Edit the oci configuration file for hostnames and set the value to 2.
    vi /etc/oci-hostname.conf
    PRESERVE_HOSTINFO=2
    save the changes.

 

Note:- By setting Value 2, it preserve user configured hostname across instance reboots; no custom changes to /etc/hosts and /etc/resolv.conf from the metadata service,

but dhclient will still overwrite /etc/resolv.conf

  

Step 3.

Update /etc/hosts file with following

192.168.10.126 ccuine1126.xxx.co.in        ccuine1126

And save & exit.

 

Step 4.

Update FQDN in OCI Console

Login to OCI console and navigate to compute instance


Select the compute instance where the FQDN will be updated and click on Attached VNICs and click on the Edit vnic 



This open a window like below where we need to set the updated hostname.

Note: Only provide the sub domain name . Do not enter entire FQDN as it doesn’t accept it.


And click on save changes. 

Once done, bounce the instance from and it will show updated FQDN from OCI console as well.

 Check the hostname with hostname or hostnamectl command.

 

[root@ccuine1126]# hostname

ccuine1126.xxx.co.in

 

[root@ccuine1126]# hostnamectl

   Static hostname: ccuine1126.xxx.co.in

         Icon name: computer-vm

           Chassis: vm

        Machine ID: aef0b6747ebeb75af2d053485bed

           Boot ID: 3a4b979bdf3b4a3591328acc3e362

    Virtualization: kvm

  Operating System: Oracle Linux Server 7.9

       CPE OS Name: cpe:/o:oracle:linux:7:9:server

            Kernel: Linux 5.4.17-2136.304.4.1.el7uek.x86_64

      Architecture: x86-64







No comments:

Post a Comment