Friday 30 July 2021

How To Configure HostName Permanently on RedHat 8.1 Linux Server


This tutorial will guide you on how to Configure HostName Permanently on RedHat 8.1 Linux server.

Please follow the below steps to configure HostName permanently on RedHat 8.1 Linux Server.

1. Open hostname config file using vim editor as shown in the image given below:

[root@worldwidelinux ]# vim /etc/hostname

hostname config

2. Change default hostname from localhost.localdomain to your hostname.

For example, if we would like to change from localhost.localdomain to worldwide.linux.net, your hostname file should look like given below:

Change default hostname

Press Esc key then type :wq! and press Enter key to save and close the file.

There is an another way to configure hostname permanently using hostnamectl command.

Execute below command to configure hostname permanently.

[root@worldwidelinux ]# hostnamectl set-hostname worldwide.linux.net

3. Reboot a server

You can manually reboot server by pressing power button or execute a reboot command in terminal.

[root@worldwidelinux ]# reboot

Reboot