?
Solved

Fixing Server Name Help (Newbie)

Posted on 2011-10-12
12
Medium Priority
?
289 Views
Last Modified: 2013-11-08
I've installed CentOS 5 on a virtual machine and I've set the hostname to localhost. I have verified this by running hostname or uname -n. Both return localhost.

But when I login into the terminal screen, it says [root@unknown000c2985f7d4]. I would like this to say [root@localhost]. Is this reporting from another attribute? How do I change this to be the localhost?

Thanks.
0
Comment
Question by:greddin
  • 6
  • 6
12 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 36958161
This should be set in one of the following files and you can change it.

Open these files.

vi /etc/sysconfig/network

Second, check this file.

cd /etc/sysconfig/network-scripts

Then you should see your interface files.
Open file like ifcfg-eth0

Or see what the names of interfaces you have.

Issue this command to check
ip a
0
 

Author Comment

by:greddin
ID: 36958210
/etc/sysconfig/network contains the relevant line:

HOSTNAME=localhost

/etc/sysconfig/network-scripts contains the file:

ifcfg-eth0

The ifcfg-eth0 file contains:

DHCP_HOSTNAME=localhost

Should I see a reference to "unknown000..." somewhere?  It's not in these.

Thanks.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 36958215
Check /etc/hosts file.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 31

Expert Comment

by:farzanj
ID: 36958219
Are you getting your IP via DHCP?
0
 

Author Comment

by:greddin
ID: 36958240
/etc/hosts has:

127.0.0.1  localhost localhost.localdomain localhost
::1  localhost6.localdomain6 localhost6

Yes, I'm getting the IP address automatically from DHCP.

Thanks again.
0
 

Author Comment

by:greddin
ID: 36958253
When I login to my router and list the connected devices, I can this CentOS server listed as localhost.
0
 
LVL 31

Accepted Solution

by:
farzanj earned 2000 total points
ID: 36958257
Do this
Added "DHCP_HOSTNAME=myhostname" to /etc/sysconfig/network and reboot
0
 
LVL 31

Expert Comment

by:farzanj
ID: 36958261
It could be that the DHCP doesn't know your hostname and you are getting this entry from the DHCP not from your machine.
0
 

Author Comment

by:greddin
ID: 36958323
Yes, that's what I'm thinking as well. That using a virtual machine in combination with my router is not allowing it to be displayed properly.
0
 

Author Comment

by:greddin
ID: 36958395
Ok, I changed the /etc/sysconfig/network to DHCP_HOSTNAME=myhostname and rebooted.

Now my prompt says [root@myhostname]
0
 

Author Closing Comment

by:greddin
ID: 36958522
Thanks for your help. I'm good now.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 36958903
You are most welcome.  Glad it worked!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Suggested Courses

609 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