Solved

Linux RedHat5 - Change hostname of the machine

Posted on 2013-01-18
6
329 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
  • 3
  • 2
6 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 500 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

726 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