"리눅스 톰캣7 컴파일 설치"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-==참고 자료== +==참고==))
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 4명의 중간 판 7개는 보이지 않습니다)
6번째 줄: 6번째 줄:


==다운로드 및 설치==
==다운로드 및 설치==
톰캣을 다운로드 받고 /usr/share/tomcat7<ref>[[CATALINA_HOME]]</ref>로 옮긴다.
톰캣을 다운로드 받고 /usr/local/tomcat7<ref>[[CATALINA_HOME]]</ref>로 옮긴다.


;명령어
;명령어
<source lang='bash'>
<syntaxhighlight lang='bash'>
wget http://apache.mirror.cdnetworks.com/tomcat/tomcat-7/v7.0.67/src/apache-tomcat-7.0.67-src.tar.gz
wget http://apache.tt.co.kr/tomcat/tomcat-7/v7.0.88/bin/apache-tomcat-7.0.88.tar.gz
tar xzf apache-tomcat-7.0.67-src.tar.gz -C /usr/share/
tar zxvf apache-tomcat-7.0.88.tar.gz -C /usr/share/
mv /usr/share/apache-tomcat-7.0.67-src /usr/local/tomcat7
mv /usr/share/apache-tomcat-7.0.88/ /usr/local/tomcat7
</source>
</syntaxhighlight>


;실행예시
;실행예시
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# http://apache.mirror.cdnetworks.com/tomcat/tomcat-7/v7.0.67/src/apache-tomcat-7.0.67-src.tar.gz
[root@zetawiki ~]# wget http://apache.tt.co.kr/tomcat/tomcat-7/v7.0.88/bin/apache-tomcat-7.0.88.tar.gz
--2013-02-03 02:38:08--  http://apache.mirror.cdnetworks.com/tomcat/tomcat-7/v7.0.67/src/apache-tomcat-7.0.67-src.tar.gz
--2018-05-25 22:16:53--  http://apache.tt.co.kr/tomcat/tomcat-7/v7.0.88/bin/apache-tomcat-7.0.88.tar.gz
Resolving apache.mirror.cdnetworks.com... 61.110.198.174
Resolving apache.tt.co.kr (apache.tt.co.kr)... 211.47.69.77
Connecting to apache.mirror.cdnetworks.com|61.110.198.174|:80... connected.
Connecting to apache.tt.co.kr (apache.tt.co.kr)|211.47.69.77|:80... connected.
HTTP request sent, awaiting response... 200 OK
HTTP request sent, awaiting response... 200 OK
Length: 7784675 (7.4M) [application/x-gzip]
Length: 9062418 (8.6M) [application/x-gzip]
Saving to: “apache-tomcat-7.0.67-src.tar.gz”
Saving to: ‘apache-tomcat-7.0.88.tar.gz’


100%[=================================================>] 7,784,675   7.20M/s   in 1.0s    
apache-tomcat-7.0.88.ta 100%[============================>]  8.64M  5.59MB/s   in 1.5s    


2013-02-03 02:38:09 (7.20 MB/s) - “apache-tomcat-7.0.67.tar.gz” saved [7784675/7784675]
2018-05-25 22:16:55 (5.59 MB/s) - ‘apache-tomcat-7.0.88.tar.gz’ saved [9062418/9062418]
</source>
</syntaxhighlight>
만약 wget으로 다운로드할 수 없다면 http://apache.mirror.cdnetworks.com/tomcat/tomcat-7 에 다른 버전이 있는지 확인해보자...
만약 wget으로 다운로드할 수 없다면 http://apache.mirror.cdnetworks.com/tomcat/tomcat-7 에 다른 버전이 있는지 확인해보자...
<source lang='console'>
<syntaxhighlight lang='console'>
[root@tomcat ~]# tar xzf apache-tomcat-7.0.67-src.tar.gz -C /usr/local/
[root@zetawiki ~]# tar xzf apache-tomcat-7.0.88-src.tar.gz -C /usr/local/
[root@tomcat ~]# mv /usr/share/apache-tomcat-7.0.67-src /usr/local/tomcat7
... (생략)
</source>
apache-tomcat-7.0.88/webapps/manager/index.jsp
apache-tomcat-7.0.88/webapps/manager/status.xsd
apache-tomcat-7.0.88/webapps/manager/xform.xsl
[root@zetawiki ~]# mv /usr/share/apache-tomcat-7.0.88/ /usr/local/tomcat7
</syntaxhighlight>


==서비스 구성==
==서비스 구성==
/etc/init.d/tomcat7 파일을 만들어 service로 등록한다.
/etc/init.d/tomcat7 파일을 만들어 service로 등록한다.
<source lang='console'>
<syntaxhighlight lang='console'>
[root@tomcat ~]# ll /etc/init.d/tomcat7
[root@zetawiki ~]# ll /etc/init.d/tomcat7
ls: cannot access /etc/init.d/tomcat7: No such file or directory
ls: cannot access /etc/init.d/tomcat7: No such file or directory
[root@tomcat ~]# touch /etc/init.d/tomcat7
[root@zetawiki ~]# touch /etc/init.d/tomcat7
[root@tomcat ~]# chmod 755 /etc/init.d/tomcat7
[root@zetawiki ~]# chmod 755 /etc/init.d/tomcat7
[root@tomcat ~]# vi /etc/init.d/tomcat7
[root@zetawiki ~]# vi /etc/init.d/tomcat7
</source>
</syntaxhighlight>
<source lang='bash'>
<syntaxhighlight lang='bash'>
#!/bin/bash   
#!/bin/bash   
#JAVA_HOME=/usr/java/jdk
#JAVA_HOME=/usr/java/jdk
88번째 줄: 92번째 줄:
esac       
esac       
exit 0   
exit 0   
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@tomcat ~]# service tomcat7
[root@zetawiki ~]# service tomcat7
Usage: /etc/init.d/tomcat7 {start|stop|restart|status|version}
Usage: /etc/init.d/tomcat7 {start|stop|restart|status|version}
</source>
</syntaxhighlight>


==시작 및 확인==
==시작 및 확인==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@tomcat ~]# service tomcat7 start
[root@zetawiki ~]# service tomcat7 start
Using CATALINA_BASE:  /usr/local/tomcat7
Using CATALINA_BASE:  /usr/local/tomcat7
Using CATALINA_HOME:  /usr/local/tomcat7
Using CATALINA_HOME:  /usr/local/tomcat7
102번째 줄: 106번째 줄:
Using JRE_HOME:        /usr/java/jre
Using JRE_HOME:        /usr/java/jre
Using CLASSPATH:      /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
Using CLASSPATH:      /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@tomcat ~]# netstat -anp | grep :8080
[root@zetawiki ~]# netstat -anp | grep :8080
tcp        0      0 :::8080                    :::*                        LISTEN      2556/java   
tcp        0      0 :::8080                    :::*                        LISTEN      2556/java   
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@tomcat ~]# ps -ef | grep tomcat
[root@zetawiki ~]# ps -ef | grep tomcat
root      2556    1 11 02:40 pts/0    00:00:02 /usr/bin/java -Djava.util.logging.config.file=/usr/local/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat7/endorsed -classpath /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/usr/local/tomcat7/temp org.apache.catalina.startup.Bootstrap start
root      2556    1 11 02:40 pts/0    00:00:02 /usr/bin/java -Djava.util.logging.config.file=/usr/local/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat7/endorsed -classpath /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/usr/local/tomcat7/temp org.apache.catalina.startup.Bootstrap start
root      2573  2469  0 02:41 pts/0    00:00:00 grep tomcat
root      2573  2469  0 02:41 pts/0    00:00:00 grep tomcat
</source>
</syntaxhighlight>


==접속 확인==
==접속 확인==
120번째 줄: 124번째 줄:
==(참고) 방화벽 열기==
==(참고) 방화벽 열기==
위 문단에서 접속이 되었다면 이 문단은 넘어가시라. 실패시에만 참고.
위 문단에서 접속이 되었다면 이 문단은 넘어가시라. 실패시에만 참고.
<source lang='console'>
<syntaxhighlight lang='console'>
[root@tomcat ~]# iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
[root@zetawiki ~]# iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
[root@tomcat ~]# service iptables save
[root@zetawiki ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@tomcat ~]# service iptables restart
[root@zetawiki ~]# service iptables restart
iptables: Flushing firewall rules:                        [  OK  ]
iptables: Flushing firewall rules:                        [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                              [  OK  ]
iptables: Unloading modules:                              [  OK  ]
iptables: Applying firewall rules:                        [  OK  ]
iptables: Applying firewall rules:                        [  OK  ]
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 00:56 기준 최신판

리눅스 톰캣7 설치

1 사전 작업[ | ]

2 다운로드 및 설치[ | ]

톰캣을 다운로드 받고 /usr/local/tomcat7[1]로 옮긴다.

명령어
wget http://apache.tt.co.kr/tomcat/tomcat-7/v7.0.88/bin/apache-tomcat-7.0.88.tar.gz
tar zxvf apache-tomcat-7.0.88.tar.gz -C /usr/share/
mv /usr/share/apache-tomcat-7.0.88/ /usr/local/tomcat7
실행예시
[root@zetawiki ~]# wget http://apache.tt.co.kr/tomcat/tomcat-7/v7.0.88/bin/apache-tomcat-7.0.88.tar.gz
--2018-05-25 22:16:53--  http://apache.tt.co.kr/tomcat/tomcat-7/v7.0.88/bin/apache-tomcat-7.0.88.tar.gz
Resolving apache.tt.co.kr (apache.tt.co.kr)... 211.47.69.77
Connecting to apache.tt.co.kr (apache.tt.co.kr)|211.47.69.77|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9062418 (8.6M) [application/x-gzip]
Saving to: ‘apache-tomcat-7.0.88.tar.gz’

apache-tomcat-7.0.88.ta 100%[============================>]   8.64M  5.59MB/s    in 1.5s    

2018-05-25 22:16:55 (5.59 MB/s) - ‘apache-tomcat-7.0.88.tar.gz’ saved [9062418/9062418]

만약 wget으로 다운로드할 수 없다면 http://apache.mirror.cdnetworks.com/tomcat/tomcat-7 에 다른 버전이 있는지 확인해보자...

[root@zetawiki ~]# tar xzf apache-tomcat-7.0.88-src.tar.gz -C /usr/local/
... (생략)
apache-tomcat-7.0.88/webapps/manager/index.jsp
apache-tomcat-7.0.88/webapps/manager/status.xsd
apache-tomcat-7.0.88/webapps/manager/xform.xsl
[root@zetawiki ~]# mv /usr/share/apache-tomcat-7.0.88/ /usr/local/tomcat7

3 서비스 구성[ | ]

/etc/init.d/tomcat7 파일을 만들어 service로 등록한다.

[root@zetawiki ~]# ll /etc/init.d/tomcat7
ls: cannot access /etc/init.d/tomcat7: No such file or directory
[root@zetawiki ~]# touch /etc/init.d/tomcat7
[root@zetawiki ~]# chmod 755 /etc/init.d/tomcat7
[root@zetawiki ~]# vi /etc/init.d/tomcat7
#!/bin/bash  
#JAVA_HOME=/usr/java/jdk
#export JAVA_HOME
#JRE_HOME=/usr/java/jre
#export JRE_HOME
#PATH=$JAVA_HOME/bin:$PATH  
#export PATH
CATALINA_HOME="/usr/local/tomcat7"
NAME="$(basename $0)"
case $1 in  
start)  
sh $CATALINA_HOME/bin/startup.sh  
;;   
stop)     
sh $CATALINA_HOME/bin/shutdown.sh  
;;   
status)
if [ -f "/var/run/${NAME}.pid" ]; then
	read kpid < /var/run/${NAME}.pid
	if [ -d "/proc/${kpid}" ]; then
		echo "${NAME} (pid ${kpid}) is running..."
	fi
else
	pid="$(/usr/bin/pgrep -d , java)"
	if [ -z "$pid" ]; then
		echo "${NAME} is stopped"
	else
		echo "${NAME} (pid $pid) is running..."
	fi
fi
;;
restart)  
sh $CATALINA_HOME/bin/shutdown.sh  
sh $CATALINA_HOME/bin/startup.sh  
;;   
version)  
sh $CATALINA_HOME/bin/version.sh  
;;
*)
echo "Usage: $0 {start|stop|restart|status|version}"
;;
esac      
exit 0
[root@zetawiki ~]# service tomcat7
Usage: /etc/init.d/tomcat7 {start|stop|restart|status|version}

4 시작 및 확인[ | ]

[root@zetawiki ~]# service tomcat7 start
Using CATALINA_BASE:   /usr/local/tomcat7
Using CATALINA_HOME:   /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME:        /usr/java/jre
Using CLASSPATH:       /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
[root@zetawiki ~]# netstat -anp | grep :8080
tcp        0      0 :::8080                     :::*                        LISTEN      2556/java
[root@zetawiki ~]# ps -ef | grep tomcat
root      2556     1 11 02:40 pts/0    00:00:02 /usr/bin/java -Djava.util.logging.config.file=/usr/local/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat7/endorsed -classpath /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/usr/local/tomcat7/temp org.apache.catalina.startup.Bootstrap start
root      2573  2469  0 02:41 pts/0    00:00:00 grep tomcat

5 접속 확인[ | ]

웹브라우저로 서버의 웹페이지 http://서버IP:8080 에 접속해보자.[2]

Apache Tomcat/7.0.67 라는 문구와 함께 톰캣 고양이 그림이 있는 페이지가 나온다...

6 (참고) 방화벽 열기[ | ]

위 문단에서 접속이 되었다면 이 문단은 넘어가시라. 실패시에만 참고.

[root@zetawiki ~]# iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
[root@zetawiki ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@zetawiki ~]# service iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

7 같이 보기[ | ]

8 주석[ | ]

  1. CATALINA_HOME
  2. 만약 접속이 안되면 다음 문단(iptables)을 참고

9 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}