?
Solved

Linux RedHat5 - Change hostname of the machine

Posted on 2013-01-18
6
Medium Priority
?
346 Views
Last Modified: 2013-01-20
Hi,

I have a redhat 5 installation and I want to change the hostname of it..

This is the name now:
[root@localhost ~]# hostname
localhost.localdomain

I will edit this file:
/etc/sysconfig/network


But do I need to restart the mahcine to have changed?

Tks,
Joao
0
Comment
Question by:joaotelles
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 2000 total points
ID: 38793484
You should change as you said in the file /etc/sysconfig/network the following
NETWORKING=yes
HOSTNAME=myhost.example.com


Also
Issue command

hostname myhost.example.com

Then it will take into effect without reboot. Next time when it reboots, it will pick it up from the above file
0
 
LVL 8

Expert Comment

by:R_Edwards
ID: 38793485
or you can just

sudo hostname new.hostname
0
 
LVL 31

Expert Comment

by:farzanj
ID: 38793491
Yes, with above commands I presumed that you will already be root user.

Furthermore, you have to do combination of both because without this it will not persist after reboot.
0
Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

 
LVL 8

Expert Comment

by:R_Edwards
ID: 38793543
Farzanj, you are correct on the reboot not keeping the name..
how silly of me to forget that
0
 
LVL 31

Expert Comment

by:farzanj
ID: 38793557
Hi R Edwards,  Not silly at all.  Your solution fixes the problem.  I was just luck to get first :)
Have a nice day!
0
 

Author Closing Comment

by:joaotelles
ID: 38798171
Tks.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question