CentOS6 톰캣6 설치

(CentOS 톰캣6 설치에서 넘어옴)
  다른 뜻에 대해서는 CentOS7 톰캣7 설치 문서를 참조하십시오.
리눅스 톰캣6 설치
CentOS 6 톰캣6 설치
CentOS 6에 yum으로 톰캣6 설치

1 사전 작업[ | ]

2 yum 확인[ | ]

[root@zetawiki ~]# yum list tomcat*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: data.nicehosting.co.kr
 * extras: data.nicehosting.co.kr
 * updates: data.nicehosting.co.kr
Available Packages
tomcat6.noarch                               6.0.24-48.el6_3               updates
tomcat6-admin-webapps.noarch                 6.0.24-48.el6_3               updates
tomcat6-docs-webapp.noarch                   6.0.24-48.el6_3               updates
tomcat6-el-2.1-api.noarch                    6.0.24-48.el6_3               updates
tomcat6-javadoc.noarch                       6.0.24-48.el6_3               updates
tomcat6-jsp-2.1-api.noarch                   6.0.24-48.el6_3               updates
tomcat6-lib.noarch                           6.0.24-48.el6_3               updates
tomcat6-log4j.noarch                         6.0.24-24.el6_0               base   
tomcat6-servlet-2.5-api.noarch               6.0.24-48.el6_3               updates
tomcat6-webapps.noarch                       6.0.24-48.el6_3               updates
tomcatjss.noarch                             2.1.0-2.el6                   base
→ tomcat6, tomcat6-admin-webapps, tomcat6-webapps 이 있다.

3 설치[ | ]

[root@zetawiki ~]# yum install tomcat6 tomcat6-admin-webapps tomcat6-webapps
... (생략)
==================================================================================================================
 Package                              Arch            Version                              Repository        Size
==================================================================================================================
Installing:
 tomcat6                              noarch          6.0.24-48.el6_3                      updates           87 k
 tomcat6-admin-webapps                noarch          6.0.24-48.el6_3                      updates           36 k
 tomcat6-webapps                      noarch          6.0.24-48.el6_3                      updates          609 k
Installing for dependencies:
 apache-tomcat-apis                   noarch          0.1-1.el6                            base             164 k
 axis                                 noarch          1.2.1-7.2.el6                        base             1.5 M
 bcel                                 x86_64          5.2-7.2.el6                          base             1.4 M
 classpathx-jaf                       x86_64          1.0-15.4.el6                         base             100 k
 classpathx-mail                      noarch          1.1.1-9.4.el6                        base             479 k
 cvs                                  x86_64          1.11.23-11.el6_2.1                   base             712 k
 ecj                                  x86_64          1:3.4.2-6.el6                        base             2.8 M
 gettext                              x86_64          0.17-16.el6                          base             1.8 M
 jakarta-commons-collections          noarch          3.2.1-3.4.el6                        base             523 k
 jakarta-commons-daemon               x86_64          1:1.0.1-8.9.el6                      base              45 k
 jakarta-commons-dbcp                 noarch          1.2.1-13.8.el6                       base             116 k
 jakarta-commons-discovery            noarch          1:0.4-5.4.el6                        base              73 k
 jakarta-commons-httpclient           x86_64          1:3.1-0.6.el6                        base             580 k
 jakarta-commons-logging              noarch          1.0.4-10.el6                         base              52 k
 jakarta-commons-pool                 x86_64          1.3-12.7.el6                         base             122 k
 jakarta-taglibs-standard             noarch          1.1.1-11.4.el6                       base             384 k
 java-1.5.0-gcj                       x86_64          1.5.0.0-29.1.el6                     base             139 k
 java-1.6.0-openjdk                   x86_64          1:1.6.0.0-1.50.1.11.5.el6_3          updates           25 M
 java_cup                             x86_64          1:0.10k-5.el6                        base             197 k
 libgcj                               x86_64          4.4.6-4.el6                          base              19 M
 libmng                               x86_64          1.0.10-4.1.el6                       base             165 k
 log4j                                x86_64          1.2.14-6.4.el6                       base             679 k
 mx4j                                 noarch          1:3.0.1-9.13.el6                     base             1.1 M
 pax                                  x86_64          3.4-10.1.el6                         base              69 k
 perl-CGI                             x86_64          3.51-127.el6                         base             207 k
 perl-ExtUtils-MakeMaker              x86_64          6.55-127.el6                         base             291 k
 perl-ExtUtils-ParseXS                x86_64          1:2.2003.0-127.el6                   base              43 k
 perl-Test-Harness                    x86_64          3.17-127.el6                         base             229 k
 perl-Test-Simple                     x86_64          0.92-127.el6                         base             110 k
 perl-devel                           x86_64          4:5.10.1-127.el6                     base             421 k
 phonon-backend-gstreamer             x86_64          1:4.6.2-24.el6                       base             126 k
 qt                                   x86_64          1:4.6.2-24.el6                       base             3.9 M
 qt-sqlite                            x86_64          1:4.6.2-24.el6                       base              51 k
 qt-x11                               x86_64          1:4.6.2-24.el6                       base              12 M
 qt3                                  x86_64          3.3.8b-30.el6                        base             3.5 M
 redhat-lsb                           x86_64          4.0-3.el6.centos                     base              24 k
 redhat-lsb-graphics                  x86_64          4.0-3.el6.centos                     base              12 k
 redhat-lsb-printing                  x86_64          4.0-3.el6.centos                     base              11 k
 regexp                               x86_64          1.5-4.4.el6                          base             105 k
 sinjdoc                              x86_64          0.5-9.1.el6                          base             705 k
 tomcat6-el-2.1-api                   noarch          6.0.24-48.el6_3                      updates           43 k
 tomcat6-jsp-2.1-api                  noarch          6.0.24-48.el6_3                      updates           80 k
 tomcat6-lib                          noarch          6.0.24-48.el6_3                      updates          2.8 M
 tomcat6-servlet-2.5-api              noarch          6.0.24-48.el6_3                      updates           94 k
 wsdl4j                               noarch          1.5.2-7.8.el6                        base             157 k
 xalan-j2                             noarch          2.7.0-9.8.el6                        base             1.8 M
 xml-commons-apis                     x86_64          1.3.04-3.6.el6                       base             439 k
 xml-commons-resolver                 x86_64          1.1-4.18.el6                         base             145 k

Transaction Summary
==================================================================================================================
Install      51 Package(s)

Total download size: 85 M
Installed size: 255 M
Is this ok [y/N]: y
... (생략)
Installed:
  tomcat6.noarch 0:6.0.24-48.el6_3                     tomcat6-admin-webapps.noarch 0:6.0.24-48.el6_3            
  tomcat6-webapps.noarch 0:6.0.24-48.el6_3            

Dependency Installed:
  apache-tomcat-apis.noarch 0:0.1-1.el6                  axis.noarch 0:1.2.1-7.2.el6                              
  bcel.x86_64 0:5.2-7.2.el6                              classpathx-jaf.x86_64 0:1.0-15.4.el6                     
  classpathx-mail.noarch 0:1.1.1-9.4.el6                 cvs.x86_64 0:1.11.23-11.el6_2.1                          
  ecj.x86_64 1:3.4.2-6.el6                               gettext.x86_64 0:0.17-16.el6                             
  jakarta-commons-collections.noarch 0:3.2.1-3.4.el6     jakarta-commons-daemon.x86_64 1:1.0.1-8.9.el6            
  jakarta-commons-dbcp.noarch 0:1.2.1-13.8.el6           jakarta-commons-discovery.noarch 1:0.4-5.4.el6           
  jakarta-commons-httpclient.x86_64 1:3.1-0.6.el6        jakarta-commons-logging.noarch 0:1.0.4-10.el6            
  jakarta-commons-pool.x86_64 0:1.3-12.7.el6             jakarta-taglibs-standard.noarch 0:1.1.1-11.4.el6         
  java-1.5.0-gcj.x86_64 0:1.5.0.0-29.1.el6               java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.50.1.11.5.el6_3    
  java_cup.x86_64 1:0.10k-5.el6                          libgcj.x86_64 0:4.4.6-4.el6                              
  libmng.x86_64 0:1.0.10-4.1.el6                         log4j.x86_64 0:1.2.14-6.4.el6                            
  mx4j.noarch 1:3.0.1-9.13.el6                           pax.x86_64 0:3.4-10.1.el6                                
  perl-CGI.x86_64 0:3.51-127.el6                         perl-ExtUtils-MakeMaker.x86_64 0:6.55-127.el6            
  perl-ExtUtils-ParseXS.x86_64 1:2.2003.0-127.el6        perl-Test-Harness.x86_64 0:3.17-127.el6                  
  perl-Test-Simple.x86_64 0:0.92-127.el6                 perl-devel.x86_64 4:5.10.1-127.el6                       
  phonon-backend-gstreamer.x86_64 1:4.6.2-24.el6         qt.x86_64 1:4.6.2-24.el6                                 
  qt-sqlite.x86_64 1:4.6.2-24.el6                        qt-x11.x86_64 1:4.6.2-24.el6                             
  qt3.x86_64 0:3.3.8b-30.el6                             redhat-lsb.x86_64 0:4.0-3.el6.centos                     
  redhat-lsb-graphics.x86_64 0:4.0-3.el6.centos          redhat-lsb-printing.x86_64 0:4.0-3.el6.centos            
  regexp.x86_64 0:1.5-4.4.el6                            sinjdoc.x86_64 0:0.5-9.1.el6                             
  tomcat6-el-2.1-api.noarch 0:6.0.24-48.el6_3            tomcat6-jsp-2.1-api.noarch 0:6.0.24-48.el6_3             
  tomcat6-lib.noarch 0:6.0.24-48.el6_3                   tomcat6-servlet-2.5-api.noarch 0:6.0.24-48.el6_3         
  wsdl4j.noarch 0:1.5.2-7.8.el6                          xalan-j2.noarch 0:2.7.0-9.8.el6                          
  xml-commons-apis.x86_64 0:1.3.04-3.6.el6               xml-commons-resolver.x86_64 0:1.1-4.18.el6               

Complete!

4 서비스 시작[ | ]

[root@zetawiki ~]# service tomcat6 status
tomcat6 is stopped                                         [  OK  ]
[root@zetawiki ~]# service tomcat6 start
Starting tomcat6:                                          [  OK  ]

톰캣 기본 포트인 8080을 확인해 보자

[root@zetawiki ~]# netstat -anp | grep :8080
tcp        0      0 :::8080                     :::*                        LISTEN      5209/java
→ 프로세스명이 java로 보인다는 점을 기억해두자...
[root@zetawiki ~]# netstat -anp | grep java
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      5209/java           
tcp        0      0 :::8009                     :::*                        LISTEN      5209/java           
tcp        0      0 :::8080                     :::*                        LISTEN      5209/java           
unix  2      [ ]         STREAM     CONNECTED     29586  5209/java

5 접속 확인[ | ]

웹브라우저로 서버의 웹페이지 http://서버IP:8080 에 접속해보자.[1] 톰캣 고양이 그림이 있는 페이지가 나온다...

 

그리고 내용을 읽어보면 보여지고 있는 그 페이지가 다음 경로의 파일이라고 한다.

$CATALINA_HOME/webapps/ROOT/index.html

CATALINA_HOME 폴더가 /usr/share/tomcat6 이므로 결국 /usr/share/tomcat6/webapps/ROOT/index.html 를 보여주고 있는 것이다.

[root@zetawiki ~]# cat /usr/share/tomcat6/webapps/ROOT/index.html | grep tomcat.gif
        <img src="tomcat.gif" height="92" width="130" alt="The Mighty Tomcat - MEOW!"/>
→ 톰캣 고양이 그림 HTML 코드

6 같이 보기[ | ]

7 주석[ | ]

  1. 만약 접속이 안되면 iptables를 확인해보라..
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}