环境安装
yum install wget vim -y
安装 openjdk
yum install java-1.7.0-openjdk -y
安装 oracle - JDK
官网: http://www.oracle.com/
当前下载页面: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
在网页上点击要下载的,获取正确的url, 例如:
http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz?AuthParam=1438183498_ba9ae3ae7f43f7c74092c3e1dc4dc9bd
下载JDK : wget http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz?AuthParam=1438183498_ba9ae3ae7f43f7c74092c3e1dc4dc9bd -O jdk-7u79-linux-x64.tar.gz
安装JDK :
tar zxvf jdk-7u79-linux-x64.tar.gz
mv ./jdk1.7.0_79 /opt/
安装Tomcat (使用openjdk)
-
下载
网址: http://tomcat.apache.org/ 7.0.x的网址: http://tomcat.apache.org/download-70.cgi 当前下载的网址: http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.63/bin/apache-tomcat-7.0.63.tar.gz wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.63/bin/apache-tomcat-7.0.63.tar.gz
-
安装
tar zxvf apache-tomcat-7.0.63.tar.gz mv ./apache-tomcat-7.0.63 /opt
-
配置
-
配置 catalina.sh
vim /opt/apache-tomcat-7.0.63/bin/catalina.sh CATALINA_HOME=/opt/apache-tomcat-7.0.63 JAVA_HOME=/usr
-
配置 server.xml vim /opt/apache-tomcat-7.0.63/conf/server.xml 在
之间加入: -
创建web目录
mkdir -p /var/www/web
-
-
启动
/opt/apache-tomcat-7.0.63/bin/catalina.sh start
-
停止
/opt/apache-tomcat-7.0.63/bin/catalina.sh stop
安装第二个Tomcat(使用oracle-jdk)
-
安装
tar zxvf apache-tomcat-7.0.63.tar.gz mv ./apache-tomcat-7.0.63 /opt/apache-tomcat-7.0.63-2
-
配置
-
配置 jdk
vim /opt/apache-tomcat-7.0.63-2/bin/catalina.sh CATALINA_HOME=/opt/apache-tomcat-7.0.63-2 JAVA_HOME=/opt/jdk1.7.0_79
-
配置 server.xml vim /opt/apache-tomcat-7.0.63-2/conf/server.xml 在
之间加入: 修改相应的端口 8005 -> 8105 8080 -> 8180 8443 -> 8543 8009 -> 8109 -
创建web目录 mkdir -p /var/www/test2
-
-
启动
/opt/apache-tomcat-7.0.63-2/bin/catalina.sh start
-
停止
/opt/apache-tomcat-7.0.63-2/bin/catalina.sh stop
防火墙设置
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
iptables -I INPUT -p tcp --dport 8180 -j ACCEPT
iptables-save