LinuxEverything is troublesome.Host NameIs no exception. The following describes the specific methods.
After Linux is installed, its default host name is localhost. Three steps are required to modify the Linux host name.
Use hostname to modify the current host name.
Hostname new-hostname
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 modify HOSTNAME = new-hostname.domainname.
The modified/etc/sysconfig/network file is as follows:
NETWORKING = yes
HOSTNAME = new-hostname.localdomain
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 localhost
127.0.0.1 new-hostname.localdomain new-hostname
This article describes how to modify the host name in Linux. In fact, it is easy to know how to operate it. I hope this article will help you.
- Wine that can run Windows software in Linux
- Ext4 Performance Improvement released in Linux Kernel 2.6.37
- Suggestions on how to learn about Linux 11
- Linux Command collection
- Detail Linux static IP configuration, DNS and host name 1)
- Detail Linux static IP configuration, DNS setting, and host name 2)
- 18.4.1 query Host Name