2015년 12월 1일 화요일

Tomcat

Step 1: Verify JAVA

# java -version

Step 2: Downloading Tomcat Archive

# cd /opt
# wget http://apache.tt.co.kr/tomcat/tomcat-8/v8.0.26/bin/apache-tomcat-8.0.26.tar.gz
# wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.28/bin/apache-tomcat-8.0.28.tar.gz
# tar xzf apache-tomcat-8.0.27.tar.gz
# tar xzf apache-tomcat-8.0.28.tar.gz

Step 3: Configure Environment Variables

Before starting Tomcat, configure CATALINA_HOME environment variable in your system using following commands.
# echo "export CATALINA_HOME=\"/opt/apache-tomcat-8.0.27\"" >> ~/.bashrc
#echo "export CATALINA_HOME=\"/opt/apache-tomcat-8.0.28\"" >> ~/.bashrc

# source ~/.bashrc

Step 4: Starting Tomcat

Tomcat is very easy to use, There are no need to compile its source. You simple extract the archive and start the tomcat server. Tomcat by default start on port 8080, So make sure no other application using the same port.

# cd /opt/apache-tomcat-8.0.27
# cd /opt/apache-tomcat-8.0.28
# ./bin/startup.sh

[Sample Output]
Using CATALINA_BASE:   /opt/apache-tomcat-8.0.28
Using CATALINA_HOME:   /opt/apache-tomcat-8.0.28
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.28/temp
Using JRE_HOME:        /
Using CLASSPATH:       /opt/apache-tomcat-8.0.28/bin/bootstrap.jar:/opt/apache-tomcat-8.0.28/bin/tomcat-juli.jar
Tomcat started.

Step 5: Access Tomcat in Browser

Tomcat server works on port 8080 default.
Access tomcat on web browser by connecting your server on port 8080.
 
http://svr1.tecadmin.net:8080

이렇게 웹브라우저에 입력하면 서버를 찾을수 없음. 이라고 단호이 이야기 한다.

 Jsvc 빌드(선택사항) << 해본다.
# cd /opt/apache-tomcat-8.0.28/bin

# tar xvfz commons-daemon-native.tar.gz
# cd commons-daemon-*-native-src/unix
# ./configure --with-java=/usr/java/latest
[root@test unix]# ./configure --with-java=/usr/java/latest
*** Current host ***
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking cached host system type... ok
*** C-Language compilation tools ***
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

 톰캣 폴더에 대한 사용자 계정 권한 부여
# chown userid: /opt/apache-tomcat-8.0.28

포트 변경 (80으로 변경함)
# vi /opt/apache-tomcat-8.0.28/conf/server.xml
 
 
<Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
 
               redirectPort="8443" URIEncoding="UTF-8" />  

 

방화벽설정(기존 polrt확인해야 함.)
firewall-cmd --permanent --zone=public --add-port=80/tcp
# firewall-cmd --reload 

화벽설정(기존 polrt확인해야 함.)
# /opt/apache-tomcat-8.0.28/bin/startup.sh   (시작)
# /opt/apache-tomcat-8.0.28/bin/shutdown.sh  (정지)


이렇게 해도 웹브라우저에 입력하면 서버를 찾을수 없음. 이라고 단호하다.



  • 그래서....
  • apache, tomcat 연동
  • 1. tomcat-connectors 설치

  • # cd /opt
  • # wget http://apache.mirror.cdnetworks.com/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.40-src.tar.gz
  • # tar zxvf tomcat-connectors-1.2.40-src.tar.gz
  • # cd tomcat-connectors-1.2.40-src/native
  • # ./configure --with-apxs=(아파치 설치 경로)
  • # ./configure --with-apxs=/usr/local/apache2/bin/apxs
  • # make
  • # make install
  •  
  • 2. 확인

  • (아파치 설치경로)/modules 하위에 mod_jk.so 파일 유무 확인
  • 3 apache 설정
  • # cd (아파치 설치경로)/conf
  • # vi workers.properties
  • workers.tomcat_home="/usr/local/tomcat"
  • workers.java_home="/usr/jdk1.8.0_11"
  • ps=/
  • worker.list=nagne
  • worker.nagne.port=8009
  • worker.nagne.host=localhost
  • worker.nagne.type=ajp13
  • 위 내용 입력 후 저장
  • # vi httpd.conf
  • LoadModule jk_module modules/mod_jk.so 추가
  • 맨 아래에 추가
  • <IfModule jk_module>
  • JkWorkersFile "(아파치 설치경로)/conf/workers.properties"
  • JkWorkersFile "/usr/local/apache2/conf/workers.properties"
  • JkLogFile "(아파치 설치경로)/logs/mod_jk.log"
  • JkLogFile "/usr/local/apache2/logs/mod_jk.log"
  • JkLogLevel info
  • JkAutoAlias "(톰캣 경로)/webapps"
  • JkAutoAlias " /opt/apache-tomcat-8.0.28/webapps"
  • JkMount /* nagne    
  • JkMount /*.jsp nagne
  • JkMount /*.do nagne
  • JkMount /*/*.jsp nagne
  • JkMount /*/*.do nagne
  • JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
  • JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
  • JkRequestLogFormat "%w %V %T"
  • </IfModule>
  • 저장
  • 4. 아파치, 톰캣 재실행

  •  

  • 5. :8080 없이 고양이 화면 뜨면 성공

  •  
  • * 안되면 일단 방화벽을 열었는지 부터 확인....


Step 6: Setup User Accounts

Finally we need to create user accounts to secure and access admin/manager pages.
Edit conf/tomcat-users.xml file in your editor
and paste inside <tomcat-users> </tomcat-users> tags.
<!-- user manager can access only manager section -->

<role rolename="manager-gui" />
<user username="manager" password="_SECRET_PASSWORD_" roles="manager-gui" />
 
<!-- user admin can access manager and admin section both -->
<role rolename="admin-gui" />
<user username="admin" password="_SECRET_PASSWORD_"  roles="manager-gui,admin-gui" />

실제 적용 - 같은 내용이지만 버전차이로 다르게 입력함.


출처
http://tecadmin.net/install-tomcat-8-on-centos-rhel-and-ubuntu/
http://zero-gravity.tistory.com/269#recentTrackback
http://blog.daum.net/rnehowl/75
http://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_%ED%86%B0%EC%BA%A37_%EC%84%A4%EC%B9%98

댓글 없음:

댓글 쓰기

vsftpd FTP 서버 접속은 성공하였으나, "디렉토리 목록 조회 실패" 현상 발생시

FTP Passive 모드를 활성화 필요. 1. vsftpd 설정 변경 /etc/vsftpd/vsftpd.conf 상에 아래 내용 추가 기입 #passive modpasv_enable=YES pasv_min_port=5001 pasv...