Dirtbag's Blog

Set system hostname on Centos 7

[ link: centos7hostname | tags: centos linux | updated: Fri, 17 Apr 2020 12:09:11 -0400 ]

I was kicking the tires of Centos 7 today and noticed that I could not get the system's hostname to set by setting the HOSTNAME variable in the /etc/sysconfig/network file.

I finally found out that you need to run the following command to properly set it.

locahost# hostnamectl set-hostname %hostname%

and then reboot your server.

-db

Like this article? Buy me a beer!