Objective:
Tomcat is a free open source Serlvet container, a core project of the Apache Foundation's Jakarta Project, developed by Apache,sun and other companies and individuals. With Sun's involvement and support, the latest servlet and JSP specifications are always reflected in Tomcat.
Online installation tutorials, copy and paste a lot, really go up a lot of reproduced posts will be problematic.
The following are practical installation steps for me.
Steps:
1. Installing the JDK
① test if the Linux system has a JDK installed:
#java –version
If you have java–version "x-x-x" output, you do not need to install the JDK separately;
Look at the path to Java under Linux:
Whereis Java
Which Java (Java execution path)
② installed Linux installation jdk:
If you plan to install a new Linux system, select the installation package containing the word "development" in the feature selection, especially the installation package containing the word ' Java ' and ' jdk '.
③ Download the JDK package for Linux on the website:
#wget https://edelivery.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.rpm
(If you cannot download the JDK package with the wget command, you can browse through the Web page in the Windows browser and download the installation package)
④ Installing the JDK RPM package:
#rpm jdk-7u45-linux-x64.rpm
Description
With this command, the new JDK is already installed on the Linux system (but I don't understand why the java-version version differs from the new version of the JDK installed).
The JDK's RPM package installs the JDK to/usr/java, and if the JDK is already installed, you can see the Java files in usr/java/default/.
This JDK directory =/usr/java/jdk1.7.0_45 is we modify the/ETC/PROFILE environment variable is to fill in the path and directory name, as follows
Exportjava_home=/usr/java/jdk1.7.0_45
2. Install Tomcat
① Decompression apache-tomcat-7.0.47.tar.gz
#tar-ZXVF apache-tomcat-7.0.47.tar.gz
② Copy the extracted directory apache-tomcat-7.0.47 to/usr/local and rename it to Tomcat6
#cp –R apache-tomcat-6.0.16/usr/local/tomcat6
Note:/USR/LOCAL/TOMCAT6 is the directory path we need to fill in when we want to modify environment variables
③ into the bin directory
#cd/usr/local/tomca6/
# CD bin/
④ adding Tomcat environment variables
#vi/etc/profile
Add the following code (added in front)
#set environment variable
exportjava_home=/usr/java/jdk1.7.0_45
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
exporttomcat_home=/usr/local/Tomcat6
exportcatalina_home=/usr/local/Tomcat6
Exportpath= $PATH: $JAVA _home/bin
⑤ Modify the application environment variable, is the configuration takes effect
#source/etc/profile
⑥ the environment variable is modified after you restart the Tomcat boot success
[Email protected] bin]#./catalina.sh
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using Jre_home:/usr/local/java
Usage:catalina.sh (Commands ...) Command usage
Commands
Debug Start Catalina in a debugger
Debug-security Debug Catalina with a security manager
JPDA start start Catalina under JPDA debugger
Run Start Catalina in the current window
Run-security Start in the current window with security Manager
Start start Catalina in a separate window
Start-security Start in a separate windows with Security Manager
Stop Stop Catalina
Stop-force Stop Catalina (followed by Kill-kill)
Version what version of Tomcat is you running?
Close Tomcat: Enter the installation directory for Tomcat, and then execute the Stop command.
For example, this article:
#cd usr/local/tomcat6/bin/
#./catalina.sh stop
(open) #./catalina.sh stop
In Process shutdown:
#ps-ef | grep Tomcat (long string characters with PID number appearing)
#kill XXX (Process pid number)
3. Turn on the 8080 port of the firewall
Tomcat has been installed successfully, if access: http://192.168.13.198:8080 cannot access Tomcat's default home page, then you need to turn on port 8080 of the firewall
To turn on the 8080 Port command for the firewall:
#vi/etc/sysconfig/iptables
According to the default open SSH protocol port 22, add a line of rules, the new rule 22 to change to 8080
#-a input-m State--state new-m tcp-p TCP--dport 8080-j ACCEPT
Save, exit.
Restart Firewall iptables Service
#service iptables Restart
You can then access the Tomcat home page.
Note: If you cannot access the page yet, you can turn off SELinux:
Vi/etc/selinux/config, change selinux=inforcing to selinux=disabled, save exit.
650) this.width=650; "style=" border-bottom:0px;border-left:0px;border-top:0px;border-right:0px; title= "6A@[VF" Ydglnwk (%%pu8~2m "border=" 0 "alt=" 6A@[VF ' Ydglnwk (%%pu8~2m "src=" http://s3.51cto.com/wyfs02/M00/56/BE/ Wkiom1sl7mgwrcf9aaeocuxqvl0315.jpg "height=" 313 "/>
This article is from the "zgysolution" blog, make sure to keep this source http://zgysolution.blog.51cto.com/9605745/1589578
Installing Tomcat under Linux