LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 09-30-2012, 04:08 PM   #1
irajjs
Member
 
Registered: Jan 2010
Location: Karaj , Iran
Distribution: Mandriva 2012
Posts: 204
Blog Entries: 1

Rep: Reputation: 15
Question How do i change host name?


Hello
At first glance it seems that i have asked a very basic question but the problem has been more complicated to me!
I typed : #hostname mldl.localdomain as root then the host name was changed i checked that by typing #hostname and it was changed from localhost.localdomain to what i typed first....i also checked the other related commands such as : #hostname -a , and #hostname -s ...all OK
Then in less than half an hour Kluncher ,xserver ,and finally plasma-desktop didn't work! such that i had to reboot using tty1
I did the same thing in GUI by typing #drakconf but the same result and...worse than that the next session the host name was the previous name(localhost.localdomain)
Now i do not know how to change the host name (not just for one session!) and without the mentioned disorders!
Please help
 
Old 09-30-2012, 04:28 PM   #2
jkerr82508
Member
 
Registered: Dec 2006
Location: Fife, Scotland
Posts: 268

Rep: Reputation: 69
http://forum.mandriva.com/en/viewtop...?f=86&t=135168

You need to log out and back in after making the change.

Jim

Last edited by jkerr82508; 09-30-2012 at 04:30 PM.
 
Old 10-01-2012, 06:58 PM   #3
irajjs
Member
 
Registered: Jan 2010
Location: Karaj , Iran
Distribution: Mandriva 2012
Posts: 204

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Exclamation i did that and i had done that before but...

Quote:
Originally Posted by jkerr82508 View Post
http://forum.mandriva.com/en/viewtop...?f=86&t=135168

You need to log out and back in after making the change.

Jim
Hi
i did what you said although i had done that many times in the past but the result was the same as before ...maybe the name localhost is set as default in the system or alias name is preferred by the system or...i don't know what!
Thanks
 
Old 10-01-2012, 07:25 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
What I do after cloning a machine (and thus in need of changing the hostname) is this:

Open a terminal window, su to root.
Go to /etc
Issue: grep <current_hostname> *
That should return 3 or 4 files
For each file you found issue:
sed -i s/<current_hostname>/<new_hostname>/g <filename>
Reboot

Remember that the '<' and '>' characters are quotes around names which you have to provide. Don't type them around those names!

jlinkels

Last edited by jlinkels; 10-01-2012 at 07:28 PM.
 
Old 10-03-2012, 04:32 PM   #5
irajjs
Member
 
Registered: Jan 2010
Location: Karaj , Iran
Distribution: Mandriva 2012
Posts: 204

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Quote:
Originally Posted by jlinkels View Post
What I do after cloning a machine (and thus in need of changing the hostname) is this:

Open a terminal window, su to root.
Go to /etc
Issue: grep <current_hostname> *
That should return 3 or 4 files
For each file you found issue:
sed -i s/<current_hostname>/<new_hostname>/g <filename>
Reboot

Remember that the '<' and '>' characters are quotes around names which you have to provide. Don't type them around those names!

jlinkels
Hi
I did not succeed in doing what you said because the output was:
-syntax error...
-there is no such file..
i myself found 2 related files in etc filder:

#file with the name as : "hostname" which was localhost.localdomain

#file with the name as : "hosts"
#generated by drakhost
#127.0.0.1 mldl.localdomain localhost

i do not understand how to do this:
For each file you found issue:
sed -i s/<current_hostname>/<new_hostname>/g <filename>

what do you mean by : "issue for each found file" ?
I also want to explain that the reason for changing host name is not the same as yours but just because i think the "localhost" is the default name so i wanted to set an specific name for my PC to not to have a default name which is the same in all other computers which use the default name
Regards
 
Old 02-04-2013, 05:03 AM   #6
irajjs
Member
 
Registered: Jan 2010
Location: Karaj , Iran
Distribution: Mandriva 2012
Posts: 204

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Thumbs up Solved!

while reinstalling the OS , and by using the option about determining the host name!... This way i changed the name(hostname)
Thanks
 
  


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
how to change the host name? cagemarvs Fedora 2 06-09-2007 04:14 AM
How do I change Host Name intels_ss Linux - Newbie 4 07-25-2005 07:26 PM
Host Name Change ? apocolpse Linux - Newbie 3 04-12-2005 11:27 AM
how do i change my host name? jsmarshall85 Debian 7 10-19-2004 03:04 PM
how do you change the host name? Culbert Linux - Software 3 03-15-2003 12:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 09:40 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
Open Source Consulting | Domain Registration