JDK下載下傳位址:http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
tomcat下載下傳位址:http://tomcat.apache.org
[root@tomcat1 ~]# service iptables stop
[root@tomcat1 ~]# setenforce 0
将jdk-7u65-linux-x64.tar.gz解壓
[root@tomcat1 ~]# tar xf jdk-7u65-linux-x64.tar.gz
解壓後會生成jdk1.7.0_65檔案夾,将檔案夾移動到/usr/local下并重命名為java
[root@tomcat1 ~]# mv jdk1.7.0_65/ /usr/local/java
在/etc/profile.d/ 下建立java.sh腳本
[root@tomcat1 ~]# vim /etc/profile
export JAVA_HOME=/usr/local/java #設定java根目錄
export PATH=$PATH:$JAVA_HOME/bin #在PATH環境變量中添加java跟目錄的bin子目錄
将java.sh 腳本導入到環境變量,使其生效
[root@tomcat1 ~]# source /etc/profile
運作 java -version 或者 javac -version 指令檢視java版本
[root@tomcat1 ~]# java -version
java version "1.7.0_45"
OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
[root@tomcat1 ~]# javac -version
javac 1.7.0_45
安裝配置Tomcat
解壓apache-tomcat-7.0.54.tar.gz 包
[root@tomcat1 ~]# tar xf apache-tomcat-7.0.54.tar.gz
解壓後生成apache-tomcat-7.0.54檔案夾,将該檔案夾移動到/usr/local下,并改名為tomcat7
[root@tomcat1 ~]# mv apache-tomcat-7.0.54 /usr/local/tomcat7
啟動Tomcat
[root@tomcat1 ~]# /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.
Tomcat 預設運作在8080端口
[root@tomcat1 ~]# netstat -anpt |grep :8080
tcp 0 0 :::8080 :::* LISTEN 3318/java
浏覽器通路測試 http://192.168.200.200:8080
關閉Tomcat
[root@tomcat1 ~]# /usr/local/tomcat7/bin/shutdown.sh