RHEL 8 Change Hostname (computer name) command

In Red Hat Enterprise Linux (RHEL) 8, the hostname (computer name) can be changed using the hostnamectl command.

To change the hostname, use the following command as root:

hostnamectl set-hostname newhostname

where newhostname is the desired hostname.

You can also use the command below to change the hostname without reboot

hostnamectl set-hostname newhostname --transient

To verify the change, you can use the command:

hostnamectl status

You can also change the hostname by editing the file /etc/hostname and replacing the current hostname with the new one. However, you will need to reboot the system for the changes to take effect.

It is important to note that changing the hostname will not change the name of the system as it appears in DNS. If the hostname is resolved through DNS, you will need to update the DNS record with the new hostname.

Leave a Comment