Change Hostname on Ubuntu
17 Dec 2025Set the hostname
sudo hostnamectl set-hostname frankfurt-1
Update /etc/hosts (IMPORTANT)
Edit the file:
sudo vim /etc/hosts
Ensure it contains:
127.0.0.1 localhost
127.0.1.1 frankfurt-1
::1 ip6-localhost ip6-loopback
Reload the shell
exec bash
Verify
hostname
hostnamectl
Notes
- No reboot required