Author Topic: How does PCLOS set hostname?  (Read 1378 times)

Offline ericthered

  • Jr. Member
  • **
  • Posts: 30
  • Ex-distro hopper
How does PCLOS set hostname?
« on: June 17, 2011, 11:05:58 AM »
My current hostname on PCLOS is localhost or something rather.  I would like to change it, but wasn't sure how PCLOS set the system's hostname.

It would seem that Debian-based systems use the /etc/hostname file to set the hostname, whereas Red Hat based systems use /etc/sysconfig/network.  I assumed that PCLOS was closer to Red Hat and went looking for the latter file, but I can't find it.

I tried this command

Quote
sysctl kernel.hostname=NEW_HOSTNAME

but it didn't change the hostname of my computer.

I don't want to be localhost forever!   :P

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3752
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: How does PCLOS set hostname?
« Reply #1 on: June 17, 2011, 11:15:30 AM »
Edit /etc/hosts from
Code: [Select]
127.0.0.1 localhost.localdomain localhost in
Code: [Select]
127.0.0.1 <NEWNAME> localhost, and edit or add in /etc/sysconfig/network
Code: [Select]
HOSTNAME=<NEWNAME>. Reboot...

ps. to do this, you must be root.

Good Luck

Offline djohnston

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6227
  • I don't do Windows
Re: How does PCLOS set hostname?
« Reply #2 on: June 17, 2011, 11:27:34 AM »
After using either of Leiche's methods, you'll probably want to set a host alias. After rebooting and verifying that your new hostname is working, open PCC, go to Network & Internet > Hosts definitions. You'll see your hostname listed with an IP address of 127.0.0.1. Highlight your hostname and click the Modify button. In the Host Aliases box, enter localhost. That's for default CUPS and other system settings to work without modification.



Bare metal                           VBox
AMD Athlon 7750 Dual-Core    Single core
4GiB RAM                              1GiB RAM
nVidia GeForce FX 5200          64MB video
LXDE 32bit                            KDE 64bit

Registered Linux User #416378

Offline ericthered

  • Jr. Member
  • **
  • Posts: 30
  • Ex-distro hopper
Re: How does PCLOS set hostname?
« Reply #3 on: June 18, 2011, 11:06:49 AM »
Hostname is changed, thanks to both of you.   :)

Offline AndrzejL

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 12802
  • RLU #490933
    • Wordpress On The Wardrobe...
Re: How does PCLOS set hostname?
« Reply #4 on: June 21, 2011, 11:50:53 AM »
I would also want to add that when setting up network connection via

Code: [Select]
drakconnect
tool there is a box (in both static and dynamic network steps) that allows to setup hostname.

Static:



Dynamic:



So if You used PCC >Network and Internet > Setup network interface all You had to do is fill that box and You are all done.

Upon reboot Your hostname should be set to whatever You chose.

Regards.

Andy