Linux installation Tomcat server release project tutorial, linuxtomcat
Previously, Alan talked to you about installing the jdk running environment on the Linux server and installing the redis non-relational database. Today, I will continue to talk about the installation of Tomcat, and publish our project and access it successfully.
Step 1: Upload the tomcat installation package to the server. I don't need to teach you how to download the tomcat package. Then you just need to pack your bags and go home to farm, although it has always been one of alan's good wishes to go home and farm, it is good to create a directory on the Linux server to store the tomcat installation package or use it as the tomcat installation location, or select a directory according to the customer's company's requirements.
At this time, the tomcat installation package is already on the server. You can also view it using the command line tool.
Step 2: unzip and install tomcat software. tomcat is installed in green, so unzip the package to the directory to install tomcat.
# Jump to tomcat storage path
Command: cd/usr/lib/tomcat
# Unzip and install tomcat
Command: tar zxvf apache-tomcat-7.0.78.
After decompression, you can see:
Step 3: Check whether the jdk environment is set up. The tomcat server requires jdk support during runtime. Therefore, you must install the jdk runtime environment on the Linux server as mentioned earlier.
Of course, as I mentioned earlier, the configuration of environment variables also distinguishes users from the global ones. If the jdk runtime environment is not installed, so tomcat cannot be used. In this case, follow the previous article on installing jdk to set up the jdk runtime environment. Link: http://www.cnblogs.com/alanlee/p/8589547.html.
Step 4: You can modify the startup port of the tomcat server. The default port is 8080. I will not change it here.
Step 5: Start and close the tomcat server
View the log: cat .. /logs/catalina. if the port is occupied, consider changing the port or kill the process that occupies the port.
Step 6: Do not close tomcat after it is started. After it is started, visit the default initialization project of tomcat.
I have already set up an environment here, so it is certainly okay, but many people may encounter access failures, for example, the page cannot be found, how can this problem be solved? Check the solution.
Solution: 1. Disable the Linux Server firewall. 2. Add the specified port to the firewall.Iptables-I INPUT-p protocol -- dport port number-j ACCEPT (
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
)
Last step: Release the war package of our project to the tomcat server. you can disable the tomcat server when releasing the package.
Maven is used. Here, the project is directly packaged into the ROOT. war package, so that you can directly access the project through the ROOT path, Drag and Drop ROOT. war to the tomcat webapps directory.
Delete the original ROOT directory file
Start tomcat server
Now we can see that tomcat automatically decompress the project for us.
Run the tail-f command to view the startup log in real time.
If there is a problem with the startup, check whether the database access address is not configured or the redis database access address is incorrect. If there is no problem, open the browser to access our project.
In this way, the web project is successfully published to the server.
Conclusion: Over the years, I have gradually learned to accept, accept accidents, accept festival changes, accept misunderstandings, accept efforts, but not return, and accept the cruelty of the world and the defects of human nature. However, this does not mean that I compromise. I will try my best to love and make painstaking efforts for everything that is out of reach. Because I also believe in dreams and miracles. In this way, I will live happily.
Alimail: AlanLee
Blog: http://www.cnblogs.com/AlanLee
This article is from the blog site. You are welcome to join the blog site.