In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to permanently modify the host name by Linux". In the daily operation, I believe many people have doubts about how to permanently modify the host name in Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to permanently modify the host name by Linux". Next, please follow the editor to study!
Using the hostname command with hostname can only temporarily change our hostname, which will revert to the original when we restart it.
# hostname newhostname enter hostname linux to change the hostname to linux, and use the uname-n command to view
At this time, our hostname has changed, why is it still Peithon on the left? try to reopen a terminal, or if you use Xshell, reopen the session.
To modify the configuration file if you want to permanently change your hostname, you have to go through the following steps
Modify the file / etc/sysconfig/network
Mylinux is the hostname to be set, then save exit, restart the system and you will read the configuration file and set the hostname to the new hostname.
If you do not want to restart the system at this point, you can use hostname mylinux to make temporary changes, so that even if the system is restarted, the hostname set in the read configuration file is the same as that set by your hostname, which is equivalent to the same.
In this way, the hostname setting is complete.
Generally speaking, the hosts file does not need to modify the hosts file to change the hostname. The / etc/hosts file provides a function of domain name resolution, similar to DNS. When the Linux system sends a domain name resolution request to the DNS server, it will query the / etc/hosts file. If there is a corresponding record in it, it will use the record in hosts.
So you can modify the / etc/sysconfig/network file if you want to change the hostname, but if you want to use distribution, you need to modify the hosts file only if you need to bind the hostname to ip.
At this point, the study on "how to permanently modify the host name of Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.