Linux-Noob Forums

Full Version: super noob
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

how do i change the name of my computer so that it doesn't read localhost in the command line?

thanks,

rich

what distro?

Quote:how do i change the name of my computer so that it doesn't read localhost in the command line?thanks,

rich
 

login as root

 



Code:
su -




 

edit the hosts file

 



Code:
vi /etc/hosts




 

do not change the line listed as 127.0.0.1 localhost.localdomain localhost

 

but add a line which is as follows:-

 



Code:
192.168.0.123 myhostname




 

where 192.168.0.123is your ip address

 

save the file

 



Code:
:wq




 

that should do it

i hope !


Ok first up.. where I use "vi", replace that with the editor that you are comfortable with for instance "gedit" is quite easy to use. Also all of this should be done as "root"...

 

Become root:



Code:
su -




 

For a temporary change (until next reboot)



Code:
# hostname my.site.com




 

For perm changes:

 

ALL the SYSTEMS! (use your IP.. it might not be what I put here)



Code:
# vi /etc/hosts
192.168.1.1 my.site.com  my




 

Gentoo



Code:
# vi /etc/conf.d/hostname
HOSTNAME="my"
# vi /etc/conf.d/domainname
DNSDOMAIN="site.com"




 

Redhat (I assume Fedora therefore)



Code:
# vi /etc/sysconfig/network
HOSTNAME=my.site.com




 

Slackware



Code:
vi /etc/HOSTNAME
myhostname.example.com




 

I wish they were all just one line :)


WOWWW! thanks. i got that done. i'm using ubuntu and i can connect to some websites but other, yahoo, google, etc always get hung up. i think it's a firewall thing but i don't know the name of my firewall, ubuntu asked if i wanted it enabled and i said yes, or how to gain access to it. any ideas.

thanks,

rich