Permanently set hostname in Ubuntu

Debian based systems use the file /etc/hostname to read the hostname of the computer at boot time and set it up using the init script /etc/init.d/hostname.sh

One can edit the file /etc/hostname and change the hostname and then run:

/etc/init.d/hostname.sh start

Update /etc/hosts ip 127.0.0.1 respectively ( leave the localhost entry untouched)

Steps:

  1. sudo vi  /etc/hostname
  2. Save the file with the hostname you like to set
  3. sudo /etc/init.d/hostname.sh start
  4. sudo vi /etc/hostname
  5. Save file with 127.0.0.1 entry updated
  6. Test using hostname -f
  7. Log off using exit

Ref: http://sysblogd.com/50/change-hostname-permanently-on-debian-or-ubuntu.htm

1 Reply to “Permanently set hostname in Ubuntu”

  1. i’m sorry. i love Gnome, i can’t really get used to KDE, but sainyg that they’re more straightforward or easy to use for the complete beginner than OS X is just hilarious.i wouldn’t give neither of them to my mom. and not because they are unintuitive or bad. no. because they’re not organised well enough. i’m not a fan of Apple’s recent innovations’, but OS X is the only OS that can please both a UNIX geek and a 5 year old child. too bad Apple tries restricts everything and alienates devs.

Leave a Reply to All Cancel reply

Your email address will not be published. Required fields are marked *