Home >System Tutorial >LINUX >How to change the host name of Ubuntu? Ubuntu hostname modification guide

How to change the host name of Ubuntu? Ubuntu hostname modification guide

王林
王林forward
2024-01-05 13:27:242649browse

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

Replace

with

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!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete