Steps to Change Hostname
-
Modify the OCI Hostname Configuration File
Edit the/etc/oci-hostname.conffile and setPRESERVE_HOSTINFOto2. This ensures that the hostname change persists across reboots.sudo nano /etc/oci-hostname.confUpdate the file with the following line:
PRESERVE_HOSTINFO=2Save and exit the file.
-
Update the Hostname
Use thehostnamectlcommand to set the new hostname:sudo hostnamectl set-hostname lmlab
After completing these steps, the hostname of the OCI compute instance will be updated and persist across reboots.
