LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What's in a name? (https://www.linuxquestions.org/questions/linux-newbie-8/whats-in-a-name-160873/)

The Manic Mouse 03-22-2004 06:33 AM

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

thehundredthone 03-22-2004 07:06 AM

quick and dirty: update /etc/hosts or /etc/hostname to the name you want

Tap-Out 03-22-2004 10:11 AM

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 :)

thehundredthone 03-22-2004 10:21 AM

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 :p

dworkin 03-22-2004 05:44 PM

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

Brane Ded 03-22-2004 08:00 PM

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

hw-tph 03-23-2004 02:30 AM

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

dworkin 03-24-2004 09:34 AM

Thanks, much apreciated!


All times are GMT -5. The time now is 11:38 AM.