0

How to change the hostname on CentOS 8?

Asked 4 years ago (Mar 31, 2021) in the field of Operating Systems by Shoufa

Hi, I am using CentOS 8, I need to change the hostname and cannot find a solution. Thank you.


Answers


0
Answered 4 years ago (Mar 31, 2021) by Eldernode Staff

You can change the hostname using the hostnamectl command by running the following commands:

sudo hostnamectl set-hostname host.example.com
sudo hostnamectl set-hostname "Your Pretty HostName" --pretty
sudo hostnamectl set-hostname host.example.com --static
sudo hostnamectl set-hostname host.example.com --transient

For example, to change the system static hostname to host.eldernode.com, you would use the following command:

sudo hostnamectl set-hostname host.eldernode.com

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day