Tip & How-To about Computers & Internet

Requirements RedHat Linux (should apply to 7.x and up) This tutorial covers changing your hostname in RedHat Linux without having to do a reboot for the changes to take effect. I?ve tested this on RedHat 7.3, 9, Fedora Core 9, and RHEL 5.3. It should work for all the versions in between since they all closely follow the same RedHat configuration. What?s the point of this tutorial? Never reboot if you don?t have to and keep your uptime intact. Make sure you are logged in as root and move to /etc/sysconfig and open the network file in vi. cd /etc/sysconfig vi network Look for the HOSTNAME line and replace it with the new hostname you want to use. In this example I want to replace localhost with ?MyServer?. HOSTNAME=MyServer When you are done, save your changes and exit vi. Next we will edit the /etc/hosts file and set the new hostname. vi /etc/hosts In hosts, edit the line that has the old hostname and replace it with your new one. MyServer Save your changes and exit vi. The changes to /etc/hosts and/etc/sysconfig/network are necessary to make your changes persistent(in the event of an unscheduled reboot). Now we use the hostname program to change the hostname that is currently set. hostname MyServer And run it again without any parameters to see if the hostname changed. hostname Finally we will restart the network to apply the changes we made to /etc/hosts and /etc/sysconfig/network. service network restart To verify the hostname has been fully changed, logout of your system and you should see your new hostname being used at the login prompt and after you?ve logged back in. Quick, painless, and you won?t lose your server?s uptime.

Computers & Internet Logo

Related Topics:

Related Questions:

1 Answer

installing linux redhat 4 on samsung hm160hi ata device

RedHat 4 is obsolete , it will not work on a SATA device like yours without serious fiddling.
Get http://pclinuxos.com/ instead , it's an up to date RedHat offshoot.

Mar 20, 2010 | Dell Inspiron 1525 Laptop

1 Answer

compaq presario v3611 AU - redhat linux driver

all linux drivers may be obtained here,https://www.redhat.com/wapps/store/catalog.html?s_kwcid=red%20hat%20software|1424739981 RICHARDM69

Oct 09, 2008 | Compaq Armada 3500 Notebook

1 Answer

Unable to install linux

The Acer Aspire 4710 uses a SATA hard drive. Unfortunately Redhat Linux 9.0 does not have SATA support (uses the 2.4 kernel). You will have to upgrade to something recent like Fedore Core 7 or Ubuntu 7.10. Hope this helps.

Dec 25, 2007 | Computers & Internet

Not finding what you are looking for?

195 people viewed this tip

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Doctor PC
Doctor PC

Level 3 Expert

7733 Answers


Level 3 Expert

102366 Answers

David Payne
David Payne

Level 3 Expert

14161 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions