LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   How do i change host name? (https://www.linuxquestions.org/questions/mandriva-30/how-do-i-change-host-name-4175429775/)

irajjs 09-30-2012 04:08 PM

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

jkerr82508 09-30-2012 04:28 PM

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

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

Jim

irajjs 10-01-2012 06:58 PM

i did that and i had done that before but...
 
Quote:

Originally Posted by jkerr82508 (Post 4793470)
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

jlinkels 10-01-2012 07:25 PM

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

irajjs 10-03-2012 04:32 PM

Quote:

Originally Posted by jlinkels (Post 4794431)
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

irajjs 02-04-2013 05:03 AM

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


All times are GMT -5. The time now is 10:06 PM.