Change hostname in centos and redhat 7

Changing the hostname in redhat and centos 7 has changed since versions 5 and 6. To do it now you will have to use the “nmtui” command, which is a text user interface for modifying network parameters.

[root@centos01 ~]# nmtui

Select “Set system hostname” and you will be prompted with a screen to set it.

Now you can verify in /etc/sysconfig/network to make sure it is set correctly

[root@centos01 ~]# cat /etc/sysconfig/network
# Created by anaconda

Try not to modify the file directly, use the nmtui command as a best practice.

Be the first to comment

Leave a Reply