https://linuxize.com/post/how-to-change-hostname-on-ubuntu-18-04/
To view the current hostname, enter the following command:
$ hostnamectl
1. Change the hostname using hostnamectl
$ sudo hostnamectl set-hostname linuxize
2. Edit the /etc/hosts file
127.0.0.1 localhost127.0.0.1 linuxize# The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopbackff02::1 ip6-allnodesff02::2 ip6-allrouters
3. Edit the cloud.cfg file
Search for preserve_hostname and change the value from false to true:
# This will cause the set+update hostname module to not operate (if true) preserve_hostname: true


0 commenti