To change hostname in Ubuntu or any Debian variant Linux, modify the /etc/hostname and /etc/hosts.
sudo vi /etc/hostname
Change the old hostname to a new hostname.
sudo vi /etc/hosts
Also, change the oldhostname to a new hostname,
192.168.1.100 newhostname
After done, changing the /etc/hostname and /etc/hosts, you need to restart the hostname service.
sudo /etc/init.d/hostname.sh stop
sudo /etc/init.d/hostname.sh start
And then you log out from the shell and log in back. Once logged in, type
hostname
to check on the changes you have made for the hostname.






8 responses so far ↓
Tarun // May 21, 2009 at 7:10 am
In the /etc/hostname file should I also specify the domain name ? which method is recommended
which is the better way (in /etc/hostname)
earth
– or –
earth.sub-domain.example.com
Similarly in /etc/hosts which is a better entry an fqdn type full name or just the short name (of course they can be specified as aliases).
Marinkina // May 21, 2009 at 11:22 pm
Нет,по настоящиму улыбнул 8 пункт,просто представил такую ситуацию ))).
Gavrilin // May 23, 2009 at 7:22 am
Нет,по настоящиму улыбнул 8 пункт,просто представил такую ситуацию ))).
Cederash // May 24, 2009 at 2:47 am
И опять об этом. Если поисковики научатся понимать смысл, то блогерам придется поизголяться, чтобы быть читаемыми и не похожими на других.
Ferinannnd // May 25, 2009 at 12:56 am
на края луны, без вины, без вина, она одна о_0 пробило еп*
Avertedd // May 26, 2009 at 2:19 pm
Очень познавательно. Спасибо.
Raghu Veer // August 2, 2009 at 10:59 pm
thank you, this tut helped to change hostname on ubuntu
порно со зрелыми женщинами // December 22, 2009 at 8:21 pm
смотреть порно геев онлайн