How do you permanently change an Linux server's hostname on EC2 so that it doesn't get reset by package updates?
When I install Ubuntu 16 package updates on an EC2 server with:
sudo apt-get upgrade
I'll notice that often, after I reboot, my hostname will reset to something like:
How do I prevent this? I manually set my custom hostname by doing:
sudo hostname myname sudo bash -c "echo myname > /etc/hostname" sudo bash -c "echo 127.0.0.1 myname >> /etc/hosts"
and this sticks across reboots, but not across updates.