How to change host name and FQDN of a Compute instance
Applies to:
Oracle Cloud Infrastructure
Goal
This document explains how to change the host name and fully qualified domain name (FQDN) of a Compute instance.
Solution
To change the hostname of an Oracle Linux pre 7 instance:
Edit “/etc/sysconfig/network” to change the parameter value for HOSTNAME.
For example:
# cat /etc/sysconfig/network NETWORKING=yes HOSTNAME= <HOST NAME>
In the file “/etc/oci-hostname.conf” change the value of PRESERVE_HOSTINFO to 2.
/etc/oci-hostname.conf PRESERVE_HOSTINFO=2
Reboot the operating system (OS), and after recovery, run the following command
to confirm the updated hostname:
hostname
To change the hostname inside Oracle Linux 7, CentOS, and RHEL instances:
Tagged: