Next, let's take a look at the Linux host name modification method. I hope this article will help you.
After inux is installed, its default host name is localhost.
Three steps are required to modify the Linux host name:
1. Use hostname to modify the current host name.
Hostname new-hostname
2. Modify the/etc/sysconfig/network configuration file so that the new host name can be used at the next restart.
Open the/etc/sysconfig/network file and change the HOSTNAME to the following.
HOSTNAME = new-hostname.localdomain
3. Modify the local domain name resolution file/etc/hosts so that the local application can resolve the new host name.
Edit the file:/etc/hosts
Modify: xxx. xxx new-hostname.domainname new-hostname
(Here xxx represents the network address of the local machine, or the loopback address 127.0.0.1)
The modified/etc/hosts file is as follows:
127.0.0.1 localhost. localdomain
127.0.0.1 new-hostname.localdomain new-hostname
Restart takes effect.