1.下载JDK与Tomcat.
jdk下载地址:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
tomcat下载地址:
http://tomcat.apache.org/download-70.cgi
2.jdk安装与配置.
(1)jdk安装
rpm包:
# rpm -ivh jdk-7u55-linux-x64.rpm
tar.gz包:解压缩
# mkdir /usr/java
# cd /usr/java
# tar -zxvf /software/jdk-7u55-linux-x64.tar.gz
生成链接以便版本升级
# ln -s jdk1.7.0_55 latest
# ln -s latest default
(2)配置环境变量
# vi /etc/profile
export JAVA_HOME=/usr/java/default
export JAVA_BIN=$JAVA_HOME/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
使配置生效
# source /etc/profile
测试jdk.
# java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
3.Tomcat的安装
解压缩
# mkdir /usr/local/tomcat
# cd /usr/local/tomcat
# tar -zxvf /software/apache-tomcat-7.0.54.tar.gz
生成链接以便版本升级
# ln -s apache-tomcat-7.0.54 server
启动Tomcat
# cd /usr/local/tomcat/server/bin
# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat/server
Using CATALINA_HOME: /usr/local/tomcat/server
Using CATALINA_TEMDIR: /usr/local/tomcat/server/temp
Using JRE_HOME: /usr/java/default
Using CLASS_PATH: /usr/local/tomcat/server/bin/bootstrap.jar:/usr/local/tomcat/server/bin/tomcat-juli.jar
Tomcat started.
测试Tomcat:
打开防火墙,使外部能访问
# /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
# service iptables save
# service iptables restart
或直接修改文件/etc/sysconfig/iptables.
# vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
# service iptables restart
在浏览器输入: http://192.168.16.133:8080
如在本机可以输入: http://localhost:8080
出现tomcat的页面表示安装成功.
停止Tomcat
# ./shutdown.sh
jdk下载地址:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
tomcat下载地址:
http://tomcat.apache.org/download-70.cgi
2.jdk安装与配置.
(1)jdk安装
rpm包:
# rpm -ivh jdk-7u55-linux-x64.rpm
tar.gz包:解压缩
# mkdir /usr/java
# cd /usr/java
# tar -zxvf /software/jdk-7u55-linux-x64.tar.gz
生成链接以便版本升级
# ln -s jdk1.7.0_55 latest
# ln -s latest default
(2)配置环境变量
# vi /etc/profile
export JAVA_HOME=/usr/java/default
export JAVA_BIN=$JAVA_HOME/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
使配置生效
# source /etc/profile
测试jdk.
# java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
3.Tomcat的安装
解压缩
# mkdir /usr/local/tomcat
# cd /usr/local/tomcat
# tar -zxvf /software/apache-tomcat-7.0.54.tar.gz
生成链接以便版本升级
# ln -s apache-tomcat-7.0.54 server
启动Tomcat
# cd /usr/local/tomcat/server/bin
# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat/server
Using CATALINA_HOME: /usr/local/tomcat/server
Using CATALINA_TEMDIR: /usr/local/tomcat/server/temp
Using JRE_HOME: /usr/java/default
Using CLASS_PATH: /usr/local/tomcat/server/bin/bootstrap.jar:/usr/local/tomcat/server/bin/tomcat-juli.jar
Tomcat started.
测试Tomcat:
打开防火墙,使外部能访问
# /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
# service iptables save
# service iptables restart
或直接修改文件/etc/sysconfig/iptables.
# vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
# service iptables restart
在浏览器输入: http://192.168.16.133:8080
如在本机可以输入: http://localhost:8080
出现tomcat的页面表示安装成功.
停止Tomcat
# ./shutdown.sh