Solved

Linux RedHat5 - Change hostname of the machine

Posted on 2013-01-18
6
293 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
Comment Utility
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
Comment Utility
or you can just

sudo hostname new.hostname
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 8

Expert Comment

by:R_Edwards
Comment Utility
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
Comment Utility
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
Comment Utility
Tks.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now