Steps:
- edit
/etc/hostname
: only 1 line with thenew-hostname
new-hostname
- edit
/etc/hosts
: 2 lines
127.0.0.1 localhost new-hostname
127.0.1.1 new-hostname
- run
sudo service hostname start
NOTE:
- Need to edit both files with the same value for
new-hostname
, then restart the hostname service. - Work on Ubuntu 14:
lsb_release -a 0 < 09:25:15 No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty