In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to modify the hostname of the system under Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
To see the current hostname, first let's use the hostname command to see the current hostname.
Hostname1 can also use the hostnamctl command
Hostnamectl1
Method 1: modify the configuration file hostname and save it in / etc/hostname file, so we can open this file and edit the hostname manually.
Sudo nano / etc/hosts delete the old hostname, replace it with the new hostname, and save the file. Pay attention to upper and lower case.
If you don't update the / etc/hosts file, some programs, such as sudo, don't know how to parse the new hostname.
If you are changing the hostname of the Linux server, the new hostname should resolve to the public IP of the Linux server. If you change the hostname of the PC, the new hostname should resolve to 127.0.0.1, or 127.0.1.1.
127.0.1.1 is the IP that the Debian Linux distribution parses the local host. When the Debian system is installed, if the computer's IP is dynamic, the Debian installer creates an entry of 127.0.1.1 in the / etc/hosts file. The 127.0.1.1 address uses the loopback network card. In fact, 127.0.0.0Mab 8 (127.0.0.0 ~ 127.255.255.255) uses the loopback network card.
The method 2:hostnamectl command command syntax is:
The command sudo hostnamectl set-hostname removes the hostname from the / etc/hostname file and replaces it with the new hostname. As with the first method, we also need to update the / etc/hosts file. The essence of both methods is the same.
Method 3:hostname command to make temporary changes if you only need to change the hostname temporarily, you can use the hostname command.
The command sudo hostname does not change the static hostname (static hostname) in the / etc/hostname file, it only changes the temporary hostname (transient hostname). So when you restart the computer, you go back to the old hostname.
The static hostname is saved in the / etc/hostname file.
Thank you for reading! On "what are the ways to modify the hostname of the system under Linux" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.