Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of modifying hosts files in Linux system

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, Xiaobian will bring you about the Linux system hosts file modification method. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.

For frequently visited websites, we can configure the mapping relationship between domain names and IPs in Hosts, so how to configure HOSTS files in Linux systems?

HOSTS file introduction: The main role of HOSTS file is to establish an association "database" between some commonly used URL domain names and corresponding IP addresses.

When the user enters a URL to log in in the browser, the system will first automatically find the corresponding IP address from the Hosts file, once found, the system will immediately open the corresponding web page, if not found, the system will submit the URL to the DNS domain name resolution server for IP address resolution.

HOSTS files can speed up domain name resolution. Because of the mapping, when we enter a domain name, the computer can quickly resolve the IP without having to request a DNS server on the network.

To modify the hosts file, you need to modify the file/etc/hosts and restart tomcat to modify the file/etc/hostsStep 1: Enter the command vi /etc/hosts to open the editing text mode of hostsStep 2: Enter the command i to enter the editing mode. At this time, you may prompt: changing a "readonly" file attentionAt this time, you can use the command to force the file permissions to change: sudo vi /etc/hosts Enter the corresponding password, enter, enter the editing mode to modify the content Complete Step 3: Enter the command:wq Save and exit Step 4: Enter command: cat /etc/hosts Check whether the modified hosts file content is modified successfully

restart the Tomcat

Step 1: Enter command:cd ~ Return to main path

Step 2: Enter the command: pwd to view the current directory

Step 3: Enter command: ps aux| grep tomcat looks at the file path where tomcat is located ps is to show the current state of running processes grep means to search in these ps aux is to show all processes and their state.

Step 4: Enter the command cd /home/work…Enter the tomcat file address path

Step 5: Enter the command cd bin/into the tomcat bin directory, you can use pwd to see if the current path is tomcat path

Step 6: Enter the command: tomcat bin directory address suffix/stop_tomcat.sh

Step 7: Enter the command: tomcat bin directory address suffix/start_tomcat.s

Linux versions are: Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and other versions. Deepin is one of the best Linux distributions in China; Ubuntu Kylin is a derivative distribution based on Ubuntu;Manjaro is a Linux distribution based on Arch;LinuxMint's default Cinnamon desktop is similar to Windows XP and easy to use;Ubuntu is a Linux operating system based on desktop applications.

The above is what is the Linux system hosts file modification method shared by Xiaobian for everyone. If you happen to have similar doubts, you may wish to refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report