How to Change the Hostname of a Linux Cloud Server

12-01-2024 02:17:05

This article outlines the steps to modify the hostname on a Linux cloud server. Assuming the new hostname is 'zhaomu.com', please replace this with the actual hostname you intend to use. This guide is applicable to four Linux operating systems: CentOS, Fedora, Ubuntu, and Debian.

1.Remotely log into the system.

2.Use the 'hostnamectl' command.

hostnamectl set-hostname zhaomu.com

3.Restart the cloud server.

4.Verify the change has taken effect with the 'hostname' command.

hostname