Home>Article>Operation and Maintenance> How to permanently change the host name in Linux

How to permanently change the host name in Linux

WBOY
WBOY Original
2021-12-31 16:44:29 15138browse

Method: 1. Use the vim command to open the network file, the syntax is "vim /etc/sysconfig/network"; 2. Modify the value of the "HOSTNAME" item in the file, that is, modify the host name; 3. Use "wq" save changes and exit; 4. Restart.

How to permanently change the host name in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to permanently modify the host name in Linux

#If you want to permanently modify the Linux host name and it will take effect after restarting, then you need to change the following configuration document.

etc/sysconfig/network to configure the host name.

Use the following command to modify:

vim /etc/sysconfig/network

The example is as follows:

How to permanently change the host name in Linux

where Mylinux is the host name to be set, then save and exit. Restart the system and you will read the configuration file and set the host name to the new hostname.

After we modify it, we need to restart it to take effect permanently. Instead of restarting the network, /etc/init.d/network restart is useless because this is the configuration file read at startup.

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to permanently change the host name in Linux. 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