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

About SoCRaT

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s