1. The case environment
Host: Tomcat server Operating system: CentOS 6.5 IP address: 192.168.1.100 Main software: jdk-7u65-linux-x64.gz apache-tomcat-7.0.54.tar.gz The installation package can be downloaded at the bottom of the page
2. Case implementation
[root@A ~]#service iptables stop [root@A ~]#tar zxf jdk-7u65-linux-x64.gz [root@A ~]#mv jdk1.7.0_65/ /usr/local/java //Move the decompressed file to local and rename it to java [root@A ~]#vim /etc/profile.d/java.sh //Create a script Add the following: export JAVA_HOME=/usr/local/java //Set the java root directory export PATH=$PATH:$JAVA_HOME/bin //Add the bin subdirectory under the java root directory to the PATH variable [root@A ~]#source /etc/profile.d/java.sh //Import the script into the variable to make it effective [root@A ~]#java -version //Check whether the java version is consistent with the previous installation
3. Install Tomcat
[root @ A ~] #tar zxf apache-tomcat-7.0.54.tar.gz [root@A ~]#mv apache-tomcat-7.0.54 /usr/local/tomcat7 //Move the decompressed file to /usr/local and rename it to tomcat7
Fourth, start Tomcat
[root@A ~]#/usr/local/tomcat7/bin/startup.sh Using CATALINA_BASE: /usr/local/tomcat7 Using CATALINA_HOME: /usr/local/tomcat7 Using CATALINA_TMPDIR: /usr/local/tomcat7/temp Using JRE_HOME: /usr/local/java Using CLASSPATH: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar Tomcat started.5. The default port of Tomcat is 8080. We can use the netstat command to monitor port 8080, or we can modify the default port
[root@A ~]# netstat -anpt | grep 8080 tcp 0 0 :::8080 :::* LISTEN 30625/java [root@A ~]#vim /usr/local/tomcat7/conf/server.xml //Modify Tomcat default port directory #Find the following and modify it: (you can modify the 8080 in the port to the port you want) <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />6. Open the browser to access the test: 192.168.1.100:8080/ He will pop up the Apache Tomcat page