Try this command first too change your hostname:
hostnamectl set-hostname newhostname
Exit the terminal, and come back in.
If that doesn’t work, also check the rest of this documentation.
Numerous configurations require the exact hostname on a Debian system. If your hostname is something that you need to change, follow this article:
There are two places that you have to visit to change the hostname on a Debian system:
- /etc/hosts
- /etc/hostname
On a stock new Ubuntu installation, /etc/hosts
should look like this before the changes:
# cat /etc/hosts ... 127.0.1.1 ubuntu-4gb-fsn1-2 ubuntu-4gb-fsn1-2 127.0.0.1 localhost # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
After you’ve made the changes, use the hostname
command to check if it worked.