How to change hostname for Ubuntu server

Edit two files below:

sudo nano /etc/hostname
sudo nano /etc/hosts

To apply changes:

sudo /etc/init.d/networking restart

or

sudo service networking restart

Leave a Comment

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