Home  >  Article  >  Operation and Maintenance  >  Linux host name modification trilogy

Linux host name modification trilogy

巴扎黑
巴扎黑Original
2017-08-23 15:20:431679browse

After Linux is installed, its default host name is localhost. Changing the Linux hostname requires 3 steps.

1. Use hostname to modify the current host name.

hostname new-hostname

2. Modify the /etc/sysconfig/network configuration file so that the new hostname can be used the next time you restart.

Open the /etc/sysconfig/network file and modify HOSTNAME=new-hostname.domainname.

The modified /etc/sysconfig/network file is as follows:

NETWORKING=yes

HOSTNAME=new-hostname.localdomain

3. Modify this The machine's domain name resolution file /etc/hosts enables the local application to resolve the new host name.

Edit file: /etc/hosts

Modify: xxx.xxx.xxx.xxx new-hostname.domainname new-hostname

(xxx here represents the local computer) The network address can also be the loopback address 127.0.0.1)

The modified /etc/hosts file is as follows:

127.0.0.1 localhost.localdomain localhost

127.0. 0.1 new-hostname.localdomain new-hostname

WORK

The above is the detailed content of Linux host name modification trilogy. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn