LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-22-2004, 06:33 AM   #1
The Manic Mouse
LQ Newbie
 
Registered: Mar 2004
Posts: 8

Rep: Reputation: 0
Question What's in a name?


How do you change the name of your computer?

(i.e. From "localhost" to "flagship") or at least get it to call up the server when you type http://flagship in stead of having to type http://localhost

This way I can link to my linux machine by name
 
Old 03-22-2004, 07:06 AM   #2
thehundredthone
Member
 
Registered: Nov 2003
Distribution: Fedora Core 1
Posts: 76

Rep: Reputation: 15
quick and dirty: update /etc/hosts or /etc/hostname to the name you want
 
Old 03-22-2004, 10:11 AM   #3
Tap-Out
Member
 
Registered: Oct 2002
Location: Halifax, NS
Distribution: Ubuntu, Mepis, Debian
Posts: 130

Rep: Reputation: 15
there is also the
Code:
hostname
that you can run as root. Just type
Code:
hostname new-hostname-here
and you should be all set
 
Old 03-22-2004, 10:21 AM   #4
thehundredthone
Member
 
Registered: Nov 2003
Distribution: Fedora Core 1
Posts: 76

Rep: Reputation: 15
Talking

wasn't sure about the syntax so i stuck to the editing of the file. that method will work, but edit the file if you want, just so that it is permanent
 
Old 03-22-2004, 05:44 PM   #5
dworkin
Member
 
Registered: Mar 2004
Location: Minnesota
Distribution: desktop = mandrake 10 / laptop = mandrake 9.1
Posts: 34

Rep: Reputation: 15
I tried useing the "hostname name_I_wanted" command. it didnt spit out an error or anything so I thought it took but nothing changed. even after a reboot it's still localhost.

I looked in /etc but did not see a hostname file, do I have to create it?

in my /etc/rc.sysinit file, I saw this ...

HOSTNAME='/bin/hostname'
<snip>
if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then
HOSTNAME=localhost

does that mean I should edit /bin/hostname and not /etc/hostname? it looks like some kind of script.

if I create a /etc/hostname file, do I just put a line with my desired name in it? or name= or what?

in my /etc/hosts , I have ...

127.0.0.1 localhost

do I just change local host to the name I want?

Hey, so I'm a newb and have lots of questions so thanks for your answers.

dworkin
 
Old 03-22-2004, 08:00 PM   #6
Brane Ded
Member
 
Registered: Nov 2003
Location: over there
Distribution: Debian Testing
Posts: 191

Rep: Reputation: 30
Quote:
in my /etc/hosts , I have ...

127.0.0.1 localhost

do I just change local host to the name I want?
You can add a line below it like:
127.0.0.1 flagship

You might also be able to change the first line to read:
127.0.0.1 localhost flagship
 
Old 03-23-2004, 02:30 AM   #7
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
If you don't have an /etc/hostname already, create a world readable plain text file with the name of the system as the only contents. Then edit your /etc/hosts file. My localhost entry looks like this ("baron" is the hostname):
Code:
127.0.0.1       localhost               baron

Håkan
 
Old 03-24-2004, 09:34 AM   #8
dworkin
Member
 
Registered: Mar 2004
Location: Minnesota
Distribution: desktop = mandrake 10 / laptop = mandrake 9.1
Posts: 34

Rep: Reputation: 15
Thanks, much apreciated!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration