码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS下安装两个或多个Tomcat7

时间:2017-11-10 01:38:21      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:tomcat

1。安装JDK

官网下载,或者用winscp工具下载后解压

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73-linux-i586.tar.gz

tar zxvf jdk-8u65-linux-x64.tar.gz

mv jdk1.8.0_73 /usr/local/jdk1.8.0_73

 

vi /etc/profile.d/java.sh  //加入如下配置

JAVA_HOME=/usr/local/jdk1.8.0_73

JAVA_BIN=/usr/local/jdk1.8.0_73/bin

JRE_HOME=/usr/local/jdk1.8.0_73/jre

PATH=$PATH:/usr/local/jdk1.8.0_73/bin:/usr/local/jdk1.8.0_73/jre/bin

CLASSPATH=/usr/local/jdk1.8.0_73/jre/lib:/usr/local/jdk1.8.0_73/lib:/usr/local/jdk1.8.0_73/jre/lib/charsets.jar

source  /etc/profile.d/java.sh

如果以上配置成功,则下面的命令可以看到java的版本:

java  -version



2。安装tomcat

cd /usr/local/src/;

wget http://www.lishiming.net/data/attachment/forum/apache-tomcat-7.0.14.tar.gz

tar zxvf apache-tomcat-7.0.14.tar.gz

mv apache-tomcat-7.0.14 /usr/local/tomcat (tomcat目录不用创建)

cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat

vim /etc/init.d/tomcat  //从第二行加入

# chkconfig: 2345 63 37

# description: tomcat server init script
# Source Function Library

. /etc/init.d/functions

JAVA_HOME=/usr/local/jdk1.8.0_73

CATALINA_HOME=/usr/local/tomcat


chmod 755 /etc/init.d/tomcat
chkconfig --add tomcat
chkconfig tomcat on
service tomcat start

ps aux |grep tomcat


第二个tomcat:

mv apache-tomcat-7.0.14 /usr/local/tomcat1

cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat1

vim /etc/init.d/tomcat1 //从第二行加入

# chkconfig: 2345 63 37

# description: tomcat server init script
# Source Function Library

. /etc/init.d/functions

JAVA_HOME=/usr/local/jdk1.8.0_73

CATALINA_HOME=/usr/local/tomcat1


chmod 755 /etc/init.d/tomcat1
chkconfig --add tomcat1
chkconfig tomcat1 on
service tomcat1 start

ps aux |grep tomcat1


第一个Tomcat7-1里面的不必动,这里我们只修要修改第二个之后的配置文件;

vim /usr/local/tomcat1/conf/server.xml

<Connector port="8080" protocol="HTTP/1.1"

变为

<Connector port="8090" protocol="HTTP/1.1"


把8009改为8010(8009 Apache的侦听端口)

<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />


把8005改为8006(8005 用于停止Tomcat的端口)


<Server port="8006" shutdown="SHUTDOWN">



service tomcat1 restart

本文出自 “IT屌丝” 博客,请务必保留此出处http://68686789.blog.51cto.com/10438688/1980488

CentOS下安装两个或多个Tomcat7

标签:tomcat

原文地址:http://68686789.blog.51cto.com/10438688/1980488

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!