Home > Article > System Tutorial > How to change the host name of Ubuntu? Ubuntu hostname modification guide
1. Enable root user
Run the command sudo passwd root to set the password for the root user
2. Log in as root user
1) Edit the file /etc/hosts and change the following line
127.0.1.1 xxxxx
Replacewith
127.0.1.1 newhostname
2) Edit the /etc/hostname file, delete all contents of the file, and add newhostname
3) Run the command hostname newhostname
3. Exit the root user and log in as a normal user
Note:
where xxxxx is the original host name and newhostname is the host name you want to modify
The above is the detailed content of How to change the host name of Ubuntu? Ubuntu hostname modification guide. For more information, please follow other related articles on the PHP Chinese website!