Renaming An Ubuntu Linux Host
Renaming a host on Ubuntu is simple, just need to make some very small changes to both
/etc/hostname. See the comments within the files below for more information. Once these changes are made, simply reboot the host and the changes will be applied.
# '/etc/hosts' should contain a line similar to the below 127.0.0.1 localhost # Change it to the following to name the host 'alvin' 127.0.0.1 alvin
/etc/hostname file will contain just the name of the host. So, if we actually wanted to name our host 'alvin', we would change its content to reflect that.
Don't forget to reboot the host to apply the changes. Also, if you are hosting any content or running applications, be sure to save your data and stop the processes if necessary in order to avoid creating issues.