You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to change host name and FQDN of a Compute instance

edited Aug 9, 2022 4:46PM in Linux

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:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!