This post will be a quick to the point tutorial on how to change in Ubuntu. Simply execute the following commands and instructions and everything will function nice and smoothly.
sudo nano /etc/hostname
Change the value to your desired hostname, save and exit. Now you just need to update your hosts file and everything will work fine.
sudo nano /etc/hosts
Simply change anywhere you see your old hostname to your new one, save and exit.
You can also temporarily change hostname by simply typing the following command instead however your hostname change will only last until reboot if using this command.
sudo hostname new-hostname-here