Ulyssesonline

the tech surfer

  • Home
  • About
  • Archives
You are here: Home / General / Changing Hostnames and Making it Stick

August 15, 2010

Changing Hostnames and Making it Stick

Nothing can be more frustrating in Linux than making hostname changes and learning after a reboot that your changes didn’t stick. Here’s just a few things that I did to make the hostname permanent while working in Ubuntu 10.04. This might work in other Debian-based distributions. Let’s assume the name of your system is ‘desktop.’

Edit your hosts file.

sudo vi /etc/hosts</code>

sudo vi /etc/hosts</code>

Add this. You can drop the domain if you don’t plan on using it.

127.0.0.1  desktop desktop.domain.com

127.0.0.1  desktop desktop.domain.com

Edit your hostname file.

sudo vi /etc/hostname</code>

sudo vi /etc/hostname</code>

Add your hostname. Domain is optional.

desktop.domain.com

desktop.domain.com

Finally, change your hostname.

sudo hostname desktop

sudo hostname desktop

Filed Under: General, Linux Tagged With: debian, hostname, hosts, Linux, ubuntu

Copyright © 2003 - 2018