The software version used in this article is as follows:
linux:centos6.7
tomcat:tomcat-7.0.52
Jdk:jkd-8u131-linux-x64
Download the installation and configuration of the JDK, and refer to the detailed steps for installing the JDK on Linux on the previous blog post.
Installation of Tomcat
Unzip
# Mkdir/usr/local/tomcat
# Cd/usr/local/tomcat
# tar-zxvf/software/apache-tomcat-7.0.52.tar.gz
Generate links for version upgrades
# ln-s apache-tomcat-7.0.52 Server
Start Tomcat
# Cd/usr/local/tomcat/server/bin
Test Tomcat:
Open the firewall to allow external access
#/sbin/iptables-i input-p TCP--dport 8080-j ACCEPT
# Service Iptables Save
# Service Iptables Restart
-
Select startup.sh from the configuration file to start Tomcat
[[email protected] bin]#./startup.sh
Using catalina_base: /usr/local/tomcat/apache-tomcat-7.0.52
Using catalina_home: /usr/local/tomcat/ apache-tomcat-7.0.52
Using Catalina_tmpdir:/usr/local/tomcat/apache-tomcat-7.0.52/temp
Using JRE_HOME: /usr/lib/jvm/jdk1.8.0_131
Using classpath: /usr/local/tomcat/apache-tomcat-7.0.52/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-7.0.52/ Bin/tomcat-juli.jar
Tomcat started.
View the IP address of this computer to see if it has been started
[Email protected] bin]# ifconfig
Eth0 Link encap:ethernet HWaddr 00:0c:29:e7:f5:09
inet addr:192.168.1.104 bcast:192.168.1.255 mask:255.255.255.0
In the browser input: http://192.168.1.104:8080
The page that appears Tomcat indicates that the installation was successful.
Stop Tomcat
#./shutdown.sh
Configuring the Web Access port
You can modify the file Server.xml in the Conf directory, modify the connector element (the default port for Tomcat is 8080) and need to restart the Tomcat service to take effect.
# Vi/usr/local/tomcat/server/conf/server.xml
<connector port= "protocol=" http/1.1 "connectiontimeout=" 20000 "redirectport=" 8443 "/>
-
Tomcat directory structure
bin //Command script file hosting Tomcat
conf // Various configuration files for the Tomcat server, most notably Server.xml
lib //store Tomcat Server support jar package
Logs //storing log files
temp //storing temporary files
WebApps//web the directory in which the application resides, Directory for external access to Web resources
work //tomcat working directory
Directory structure for Web Apps
WebApp--The directory where the Web application resides
|---html, JSP, CSS, JS files, etc.-these files are generally in the root directory of the Web application, the files under the root directory can be directly accessed by the outside world.
|---web-inf directory-java classes, JAR packages, Web configuration files exist in this directory, the outside world is not directly accessible, the WEB server is responsible for the call.
|---Classes Directory--Java class
|---lib directory--the jar package required for Java classes to run
|---web. xml file--configuration file
This article is from the "xinsz08の parallel space-time" blog, be sure to keep this source http://xinsz08.blog.51cto.com/10565212/1949149
Installing Tomcat on Linux