In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to build a Tomcat 8 server in Linux's CentOS 7. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Build Tomcat 8 server with Linux CentOS 7
Tomcat server is a free and open source Web application server, which is a lightweight application server. It is widely used in small and medium-sized systems and not many concurrent access users. It is the first choice for developing and debugging JSP programs. For a beginner, it can be thought that when an Apache server is configured on a machine, it can be used to respond to requests for access to HTML (an application under the standard general markup language) pages. Tomcat is actually an extension of the Apache server, but at run time it runs independently, so when you run tomcat, it actually runs as a separate process from Apache.
Step 1: download Tomcat
First of all, go to the official website to download the required tomcat version, because of the development needs, I downloaded tomcat 8. Download the version you need according to your needs
Step 2: use Xftp to upload Tomcat to the CentOS virtual machine
You need to make sure that JDK is installed before installation. If you do not install JDK, please refer to the next tutorial to install JDK correctly. If you have already installed JDK, then you can install tomcat.
A) Open Xftp
B) create a new session
C) then we upload the Tomcat to / usr/local/ and create a new tomcat folder to store the software I uploaded
Step 3: decompress Tomcat
First of all, we use Xshell to link to our virtual machine. Xshell is a very excellent and easy-to-use remote operation software.
A) Open Xshell
B) then we create a new session
After we click on the link, if this port number is used for the first time, a page will pop up, just click to accept and save. After a successful connection, I will go to this page.
Now I can extract the Tomcat.
C) first switch to the folder where we store tomcat: cd / usr/local/tomcat
Using ls to view, you can see that the compressed package just uploaded is under the tomcat folder.
D) next extract the package, we use: tar-zxvf apache-tomcat-8.5.49-deployer.tar.gz
E) after the decompression is successful, you can see an extra blue folder, indicating that the decompression is successful. Delete the compressed package after decompression: rm-rf apache-tomcat-8.5.49-deployer.tar.gz
Step 4: configure the environment variables and memory settings for Tomcat
Next, start configuring the environment variables and memory settings for tomcat
1. First go to the bin directory of tomcat and then use the vim command to open the catalina.sh file:
two。 Add the following configuration:
JAVA_OPTS= "- Xms512m-Xmx1024m-Xss1024K-XX:PermSize=512m-XX:MaxPermSize=1024m"
Export TOMCAT_HOME=/usr/local/tomcat/apache-tomcat-8.5.40
Export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-8.5.40
Export JRE_HOME=/usr/java/jdk1.8.0_181/jre
Export JAVA_HOME=/usr/java/jdk1.8.0_181
3. Go to the conf directory of tomcat, modify the server.xml file, open the file through the vim command, change the port number to 8007 after entering edit mode, then ESC, and finally enter ": wq" to save and exit.
4. Try to start tomcat: change to tomcat's bin directory and enter the startup command:. / startup.sh
5. Tomcat starts successfully, and we use the virtual machine system (internal access) to try to access
Open a browser and enter http://localhost:8007/ or http://127.0.0.1:8007/ in the address bar
6. We try to access the windows system where the virtual machine is located (external access)
Open a browser and enter http://: in the address bar
7. It is accessible internally and inaccessible externally. What is the cause?
A) the reason is that linux has a stronger security mechanism than windows, and a more powerful firewall-Firewall has been introduced in CentOS 7. We need to open port 8007 in Firewall, that is, to add port 8007 to zone (a new feature of Firewall, which simply defines the trust level of network area network connections). The command is as follows:
Firewall-cmd-zone=public-add-port=8007/tcp-permanent
B) in this way, port 8007 has been successfully added to the public zone. The permanent parameter means that the restart will not be invalid, and do not forget to update the firewall rules:
Firewall-cmd-reload
Take a look at all the open ports under the public area and the command is as follows:
Firewall-cmd-zone=public-list-ports
You can see that port 8007 has been opened successfully:
8. Try to access again with the windows system where the virtual machine is located
Thank you for reading! This is the end of this article on "how to build a Tomcat 8 server in Linux's CentOS 7". 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 for more people to see!
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.