서버 1대에 Tomcat 여러개 설치
설치환경
CentOS 6.8
Tomcat 7.0.72
JAVA 1.8.112
Tomcat 설치 방법은 전 포스팅에 올린 방법을 참조한다.
http://itgameworld.tistory.com/65
스크립트 생성
위 포스팅의 방법으로 Tomcat을 설치한 후 같은 방법으로 tomcat2 , tomcat3을 생성해준다.
[root@localhost ~]# cp /etc/init.d/tomcatd /etc/init.d/tomcatd2
[root@localhost ~]# cp /etc/init.d/tomcatd /etc/init.d/tomcatd3
[root@localhost ~]# vi /etc/init.d/tomcatd2
#!/bin/sh
# chkconfig: 2345 80 80
# Description: Tomcat Start/Shutdown script
export JAVA_HOME=/usr/local/java
case $1 in
start)
cd /usr/local/tomcat2/bin/
./startup.sh
;;
stop)
cd /usr/local/tomcat2/bin/
./shutdown.sh
;;
restart)
cd /usr/local/tomcat2/bin/
./shutdown.sh
cd /usr/local/tomcat2/bin/
./startup.sh
;;
esac
exit 0
catalina.sh 수정
[root@localhost ~]# vi /usr/local/tomcat/bin/catalina.sh
119 # resolve links - $0 may be a softlink
120 PRG="$0"
121
122 while [ -h "$PRG" ]; do
123 ls=`ls -ld "$PRG"`
124 link=`expr "$ls" : '.*-> \(.*\)$'`
125 if expr "$link" : '/.*' > /dev/null; then
126 PRG="$link"
127 else
128 PRG=`dirname "$PRG"`/"$link"
129 fi
130 done
131
132
133 export CATALINA_HOME=/usr/local/tomcat
134 export TOMCAT_HOME=/usr/local/tomcat
135 export CATALINA_BASE=/usr/local/tomcat
136 CATALINA_PID=/usr/local/tomcat/bin/tomcat.pid
export CATALINA_HOME=/usr/local/tomcat2
export TOMCAT_HOME=/usr/local/tomcat2
export CATALINA_BASE=/usr/local/tomcat2
CATALINA_PID=/usr/local/tomcat2/bin/tomcat.pid
export CATALINA_HOME=/usr/local/tomcat3
export TOMCAT_HOME=/usr/local/tomcat3
export CATALINA_BASE=/usr/local/tomcat3
CATALINA_PID=/usr/local/tomcat3/bin/tomcat.pid
포트변경
[root@localhost ~]# vi /usr/local/tomcat/conf/server.xml
...
22 <Server port="8005" shutdown="SHUTDOWN">
'Linux > Tomcat' 카테고리의 다른 글
Apache Tomcat 연동 (0) | 2016.11.03 |
---|---|
CentOS + Tomcat 설치 (0) | 2016.11.03 |
Session Clustering (0) | 2016.08.03 |