change hostname in RHEL8/Centos8

Windows Articles

How to install Lighttpd on Ubuntu 20.04?

There are many web services in Unix but we always look for the one that best suits our needs. In this case,...

How to install Docker on Ubuntu 20.04 / Debian 10?

Docker is a fairly popular technology in today's sysadmin. It is logical to think because it means a complete change in the way images...

How to install Mantis Bug Tracker on Ubuntu 20.04?

Hi, folks. In this post, I will help you to install Mantis Bug Tracker on Ubuntu 20.04 If you...

How to install WordPress with Nginx on Ubuntu 20.04?

Hi, folks. In this post, we will help you install Wordpress with Nginx on Ubuntu 20.04. It's a lot easier than you...

Electron 9.0 available

News has arrived that many developers are going to love. And that is that Electron this great cross-platform application framework has released...
Mel Khamlichi
Mel Khamlichihttp://www.osradar.com
Founder of Osradar, from Amsterdam Netherlands

The Redhat 8 final will be relased soon ,the beta version is already  there and  ready for testing. i will show you in this tutorial how to change hostname in RHEL 8 or Centos8 Server or maybe a Work station. please  remember hostnames can contain letters digits hyphen and dot characters. and must contains between 2 and 63 characters.

1-Set Hostname on RHEL8/ Centos8

In my case i want to change my hostnamen to osradar-rhel8.local.domain.  please do it the comand hostnamectl

hostnamectl set-hostname osradar-rhel8.local.domain

1-1-Reboot The Server

command reboot to  restart

#reboot

1-2-check the new  hostname now

[root@osradar-rhel8 ~]# uname -a
Linux osradar-rhel8.local.domain 4.18.0-32.el8.x86_64 #1 SMP Sat Oct 27 19:26:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@osradar-rhel8 ~]# hostnamectl
   Static hostname: osradar-rhel8.local.domain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: f64d8254a85c4fd1b37c6b4600c3eb8f
           Boot ID: a6a07a436ab747808485394f81e2bdaa
    Virtualization: oracle
  Operating System: Red Hat Enterprise Linux 8.0 Beta (Ootpa)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:8.0:beta
            Kernel: Linux 4.18.0-32.el8.x86_64
      Architecture: x86-64
[root@osradar-rhel8 ~]# cat   /proc/sys/kernel/hostname
osradar-rhel8.local.domain
[root@osradar-rhel8 ~]# cat /etc/hostname
osradar-rhel8.local.domain
[root@osradar-rhel8 ~]#

Option:  you can add the hostname to  /etc/hosts

[root@osradar-rhel8 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.49 osradar-rhel8.local.domain
[root@osradar-rhel8 ~]# ping osradar-rhel8.local.domain
PING osradar-rhel8.local.domain (192.168.2.49) 56(84) bytes of data.
64 bytes from osradar-rhel8.local.domain (192.168.2.49): icmp_seq=1 ttl=64 time=0.052 ms
64 bytes from osradar-rhel8.local.domain (192.168.2.49): icmp_seq=2 ttl=64 time=0.073 ms
64 bytes from osradar-rhel8.local.domain (192.168.2.49): icmp_seq=3 ttl=64 time=0.071 ms
64 bytes from osradar-rhel8.local.domain (192.168.2.49): icmp_seq=4 ttl=64 time=0.074 ms
64 bytes from osradar-rhel8.local.domain (192.168.2.49): icmp_seq=5 ttl=64 time=0.075 ms

--- osradar-rhel8.local.domain ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 81ms
rtt min/avg/max/mdev = 0.052/0.069/0.075/0.008 ms
[root@osradar-rhel8 ~]#

4-Change Hostname via nmtui  Tool 

This option also easy for starters  to change the hostname using  nmtui tool

just  Type  nmtui

nmtui

Then Set system Hostname

Quit and reboot your  System

 

 

Please enjoy

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install Lighttpd on Ubuntu 20.04?

There are many web services in Unix but we always look for the one that best suits our needs. In this case,...

How to install Docker on Ubuntu 20.04 / Debian 10?

Docker is a fairly popular technology in today's sysadmin. It is logical to think because it means a complete change in the way images...

How to install Mantis Bug Tracker on Ubuntu 20.04?

Hi, folks. In this post, I will help you to install Mantis Bug Tracker on Ubuntu 20.04 If you...

How to install WordPress with Nginx on Ubuntu 20.04?

Hi, folks. In this post, we will help you install Wordpress with Nginx on Ubuntu 20.04. It's a lot easier than you...

Electron 9.0 available

News has arrived that many developers are going to love. And that is that Electron this great cross-platform application framework has released...