Solved

Linux RedHat5 - Change hostname of the machine

Posted on 2013-01-18
6
313 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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