How to change Compute Instance hostname
This guide covers changing the hostname for instances running the following operating systems: Ubuntu 18.04-22.04, AlmaLinux 8, Rocky Linux 8, and CentOS 7-8.
Prerequisite
An instance running one of the following operating systems: Ubuntu 18.04-22.04, AlmaLinux 8, Rocky Linux 8, or CentOS 7-8.
Instruction
1. Access the instance you want to modify
2. Use the following command to change the hostname
Replace with your desired new hostname.
$ sudo hostnamectl set-hostname <newNameHere>
3. To verify the change was successful, use the command below. Alternatively, you can log out and log back into the instance to see the updated hostname.
$ hostnamectl


Last updated
Was this helpful?