On Linux, you can change the hostname
by using the hostnamectl
command.
How to Set the Hostname on Linux
1
|
sudo hostnamectl set-hostname <new-hostname>
|
For example:
1
|
sudo hostnamectl set-hostname server1
|
At this point, you will need to logout and back in to see the changes have taken effect.