How to change hostname in Redhat & Oracle Linux

As user “root”

“vi /etc/sysconfig/network”, change HOSTNAME value to the new hostname

“hostname NEW_HOST_NAME” to change it for the current sessions

“vi /etc/hosts”, change the old value to point to the new hostname

“service network restart” to restart the networking service and apply all the new changes

Unknown's avatar

About Ahmed Tawfik

Cybersecurity Professional, Systems Engineer, OSS & Linux Geek
This entry was posted in Linux and tagged , , , , . Bookmark the permalink.

2 Responses to How to change hostname in Redhat & Oracle Linux

  1. There are no host names in /etc/hosts except localhost in default Oracle Linux installation. So /etc/sysconfig/network is enough

    Like

  2. sunsami's avatar sunsami says:

    I login as root and “vi /etc/sysconfig/network ” but it doesn’t show the hostname after I restart. it show none. Please help in this.

    Like

Leave a comment