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
  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 

Share This Post with Your Friends over Social Media!

About the Author Atul Kumar

Oracle ACE, Author, Speaker and Founder of K21 Technologies & K21 Academy : Specialising in Design, Implement, and Trainings.

follow me on:

Leave a Comment:

sravanthi says December 28, 2009

Hi Atul,

I have a question which is not related to this topic ,but I need ur help .

I have intsalled vmware server 2.0 on top of windows vista operating system and on vmware server I installed Red hat Linux 4 .So my host o.s is Windows vista and guest is Redhat Linux.My question is even though I added host entries in both etc/host files on(quest and host o.s) I am unable to ping from quest to host and host to quest .

I need this because I installed 10g database on Linux o.s (quest ) on vmware server and i need to open OEM for that Database.

When I am trying to open webbrowser saying “Reconfigure your web browser” I can’t move forward .

Please help me


sravanthi says December 28, 2009

I searched in google but no luck

Please help me

Atul Kumar says December 28, 2009

You have two option

1. To access Linux Guest O.S. (on vmware) from Host O.S. windows

change network card of Linux machine (in vmware) Bridged to NAT

2. Restart Linux machine and change network from static IP to DHCP

3. Restart network card and check new IP

4. Test if you can ping this new IP from windows host machine or not.

Second option is install browser like Mozilla on Guest Linux machine and access browser from Linux console (VMware)

venkat says April 20, 2010

hi in my system when i install oracle apps dba, it shows host/domain check is wrong. i checked in /ect/hosts & /etc/sysconfig/network. set host name and reboot. but again it shows same error. to overcome this problem what i have to do . pls give solution . i am waiting for ur answer.

Atul Kumar says April 21, 2010

@ Venkat,
What hostname and domain you are entering during apps install ?

From command prompt see if you can ping that

ping .

This is what apps system check utility does.

durga prasad says May 19, 2014

Hi Atul,

I have a question which is not related to this topic. i have installed two workstations in vmware. how to make the connection between two workstations.


durga prasad

SHIV SINGH says December 13, 2018

I am using oracle unix 6.9,
i change hostname for vi /etc/hosts and vi /etc/sysconfig/network
but when i run command uname -a the in output i didnt see the hostname that i gave in hosts file

Add Your Reply