How to change hostname on Linux (Red Hat or Oracle)

This is post for those who are new to Red Hat Linux or Oracle Enterprise Linux (OEL) and wish to change hostname .

How to find hostname on Linux/OEL ?
Use command “hostname” to find host name of Linux

How to change hostname on Linux/OEL ?

  1. Open file /etc/sysconfig/network  using editor like vi , nano or ed
  2. Change entry HOSTNAME=XXXXXX to
    HOSTNAME=New_Host_Name
  3. Restart xinetd service or reboot Linux/OEL
    Restart xinetd service xinetd restart
    Reboot Linux reboot
  4. If you have defined hostname resolution in hosts file then change entry in /etc/hosts 

About the Author Masroof Ahmad

Leave a Comment:

7 comments
Add Your Reply