LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-09-2003, 01:32 AM   #1
juby
Member
 
Registered: Dec 2002
Location: Bangalore, India
Distribution: Ubuntu 5.*
Posts: 241

Rep: Reputation: 30
Permanently change the hostname


Hi , i want to permanently change my machine's name as linuxQube or something like that.. the hostname command onyl sets it for the current session ..when i reebot i get localhost.localdomain. I run apache, tomcat etc etc.. will chnaging m hostname affect those services ?? how can i do it "safe" ???
 
Old 05-09-2003, 02:45 AM   #2
senthil
Member
 
Registered: Apr 2003
Posts: 43

Rep: Reputation: 15
Hi,

Edit ur /etc/hosts file to add the hostname. Or you can use linuxconf or netconf to give the hostname.

Hope this helps.

Senthil
 
Old 05-09-2003, 03:35 AM   #3
bm1
Member
 
Registered: Nov 2002
Location: NZ
Distribution: freeBSD, slack
Posts: 156

Rep: Reputation: 30
this thread helped me
http://www.linuxquestions.org/questi...threadid=57490
 
Old 05-09-2003, 05:42 AM   #4
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
Quote:
Originally posted by senthil
Edit ur /etc/hosts file to add the hostname. Or you can use linuxconf or netconf to give the hostname.
/etc/hosts only holds a mapping between hostnames and IP addresses, it doesn't actually set anything...

cheers

Jamie...
 
Old 05-09-2003, 07:03 AM   #5
BigNate
Member
 
Registered: Mar 2003
Location: Harrisburg, PA
Distribution: Gentoo, Debian, Ubuntu, Red Hat/CentOS
Posts: 719

Rep: Reputation: 30
Hello!
redhat=>system settings=>network

enter root password

click "hosts" tab and enter a name!
 
Old 05-09-2003, 12:43 PM   #6
senthil
Member
 
Registered: Apr 2003
Posts: 43

Rep: Reputation: 15
Oops Sorry,

U have to set it in /etc/sysconfig/network file.

Senthil
 
Old 05-09-2003, 01:41 PM   #7
juby
Member
 
Registered: Dec 2002
Location: Bangalore, India
Distribution: Ubuntu 5.*
Posts: 241

Original Poster
Rep: Reputation: 30
i tried it in rc.sysinit but apache wwebserver dint start !
 
Old 05-09-2003, 02:05 PM   #8
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
Create a file /etc/hostname

Put one entry in that file, your hostname. My file:
Code:
tinwhistle
My /etc/hosts file:
Code:
# Gentoo Celeron 850 box tinwhistle /etc/hosts file
127.0.0.1       tinwhistle      localhost.localdomain   localhost
192.168.0.1     bones
192.168.0.2     tinwhistle
192.168.0.3     uilleann

Last edited by fancypiper; 05-09-2003 at 02:08 PM.
 
Old 05-09-2003, 02:07 PM   #9
jonr
Senior Member
 
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040

Rep: Reputation: 47
I got so frustrated not being able to change the host name permanently, that I finally did a "slocate localhost" and then visited all the files that appeared to play a role in keeping my computer so stupidly named, and changed every instance (about four, as it turned out) to the name I wanted.

Result: name permanently changed. HOWEVER, I am not on a network, just a lone desktop with Internet access. So I would not advise this approach for anybody with a more complex setup. It could indeed be asking for trouble.

EDITED: Oops, sorry, what I did was look for the string "localhost" inside all files, using Midnight Commander's search function. Slocate would not give that information.


Last edited by jonr; 05-09-2003 at 02:34 PM.
 
Old 05-09-2003, 02:35 PM   #10
senthil
Member
 
Registered: Apr 2003
Posts: 43

Rep: Reputation: 15
If u see /etc/rc.sysinit file, /etc/sysconfig/network file is sourced to set the hostname and then the value of /bin/hostname is read. So if you set the hostname in /etc/sysconfig/network you should be ok.

I think you should also set the ServerName in httpd.conf or think it reverts to localhost.

Senthil
 
Old 05-10-2003, 01:23 AM   #11
juby
Member
 
Registered: Dec 2002
Location: Bangalore, India
Distribution: Ubuntu 5.*
Posts: 241

Original Poster
Rep: Reputation: 30
Got it fine !! tahnx all

i changed the etc/hosts file

as 127.0.0.1 linuxcube.localdomain linuxcube

& then the etc/sysconfig/network file's hostname = linuxcube
everything works fine ..thanx for the help !
 
Old 05-10-2003, 01:46 AM   #12
Aussie
Senior Member
 
Registered: Sep 2001
Location: Brisvegas, Antipodes
Distribution: Slackware
Posts: 4,590

Rep: Reputation: 56
The command to set or change the system hostname is 'hostname'.
Do 'man hostname' to read the unix manual page for the hostname command.
 
Old 05-10-2003, 09:27 AM   #13
jonr
Senior Member
 
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040

Rep: Reputation: 47
Quote:
Originally posted by Aussie
The command to set or change the system hostname is 'hostname'.
Do 'man hostname' to read the unix manual page for the hostname command.
That works for changing the hostname during the session you're in, but on the next reboot, the hostname reverts to the old one. At least in the distribution I use! The question here was how to permanently change the hostname.
 
Old 05-10-2003, 01:34 PM   #14
senthil
Member
 
Registered: Apr 2003
Posts: 43

Rep: Reputation: 15
Hi,

As I told before, you have to set it in /etc/sysconfig/network. Or a hack - do hostname -v <HOSTNAME> in /etc/rc.d/rc.local file. Instead of manually setting for that boot session this does it automatically.

Cheers,
Senthil
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing hostname, dnsdomainname, and domainname permanently. xemous Linux - Networking 6 12-16-2009 02:21 PM
How to change modules state permanently? polemon Linux - Newbie 3 09-27-2005 07:21 PM
Want to set hostname permanently on new fedora install DPenguin Linux - Newbie 2 02-04-2005 03:31 PM
Can't permanently change path SuperRunt Linux - Newbie 11 02-03-2005 12:59 AM
can't change tcp_sack permanently kentri9 Linux - Networking 1 10-30-2004 06:20 PM


All times are GMT -5. The time now is 02:05 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration