• Recent blogs

    How to Permanently Change Hostname in Oracle Cloud Infrastructure (OCI) Compute Environment on Oracle Linux

    By design, changes made in the /etc/hosts and resolv.conf files revert to their original values, after an instance restart, unless these steps are implemented.



    For Oracle Linux: (prior to Version 7)

    1: Edit /etc/sysconfig/network

    change the parameter value for "hostname"


    # cat /etc/sysconfig/network


    HOSTNAME=instance-ol6 <--------- change here

    2: In the file /etc/oci-hostname.conf change the value of PRESERVE_HOSTINFO to 2.



    This change will be persistent across reboots.

    For Oracle Linux 7 :

    Steps to be followed in order to change the hostname on oel7 server persistently hosted on OCI environment.

    1: Update the /etc/hostname file with below command.

        hostnamectl set-hostname <new name>

    2: Edit the oci configuration file for hostnames as given below to update the needed value to 2.

        vi /etc/oci-hostname.conf


        save the changes.

    3: Edit the FQDN from OCI console GUI

    go to compute instances

    --> select the instance

    --> scroll down

    --> at the left bottom corner select attached VNIC under resources

    --> edit appropriate VNIC

    --> change hostname to update FQDN

    --> update VNIC

    OCI Instance VNIC Attachments
    OCI Instance VNIC Attachments

    OCI Instance VNIC hostname change
    OCI Instance VNIC hostname change

    4: Reboot the instance


    1: Check the hostname with hostname command.

    2: Check if FQDN is resolving.

        host <ip adress>


        nslookup <ip adress>

    How to make Permanent change in OCI: System Files /etc/resolv.conf

    No comments