Ⅰ. JAVA JDK 설치
1. profile의 젤 아래부분에 환경설정.
# vi /etc/profile
=======================================================================
# Setting for JDK
export JAVA_HOME=/usr/local/java/jdk
export CATALINA_HOME=/usr/local/tomcat
export APACHE_HOME=/usr/local/apache
export PATH=$JAVA_HOME/bin:$CATALINA_HOME/bin:$APACHE_HOME/bin:$PATH:.
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/servlet-api.jar:$CATALINA_HOME/lib/jsp-api.jar
=======================================================================
# source /etc/profile <-- 바로적용
2. 아래 사이트에서 적당한 버전을 다운로드하여 임의의 디렉토리(/root)에 저장한다.
http://java.sun.com/javaee/downloads/index.jsp
# ls
java_ee_sdk-5_07-jdk-6u16-linux-ml.bin
# mkdir /usr/local/java
# ./java_ee_sdk-5_07-jdk-6u16-linux-ml.bin
여기서 부터는 kde/gnome에서 '터미널 열기'를 통하여 작업한다.
설치가 시작되면서 진행중 약관동의 승인과 압축을 풀 디렉토리 지정을 물어 본다.
설치 경로를 /usr/local/java로 입력하고 설치를 완료한다.
3. 혹 리눅스 설치시 'java development'가 설치 되었다면, kde/gnome 의 소프트웨어 추가/삭제에서 찾아서 삭제한다.
Ⅱ. Apache 설치
# wget http://archive.apache.org/dist/httpd/httpd-2.2.9.tar.gz
# tar zxvf httpd-2.2.9.tar.gz
# cd httpd-2.2.9
# ./configure --prefix=/usr/local/apache --enable-modules=all --enable-mods-shared=all
# make
# make install
# cd /usr/local/apache/bin
# apachectl configtest
Syntax OK
# apachectl start
http://localhost => It works!
Ⅲ. Tomcat 설치
# wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.9/bin/apache-tomcat-6.0.9.tar.gz
--21:21:50-- http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.9/bin/apache-tomcat-6.0.9.tar.gz
Resolving archive.apache.org... 192.87.106.226
Connecting to archive.apache.org|192.87.106.226|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5813513 (5.5M) [application/x-tar]
Saving to: `apache-tomcat-6.0.9.tar.gz'
100%[===========================================================================================>] 5,813,513 578K/s in 12s
21:22:04 (455 KB/s) - `apache-tomcat-6.0.9.tar.gz' saved [5813513/5813513]
# tar zxvf apache-tomcat-6.0.9.tar.gz
# mv apache-tomcat-6.0.9 /usr/local
# cd /usr/local
# mv apache-tomcat-6.0.9 tomcat
# cd tomcat/bin
# startup.sh
Linux IP table 수정부분참조
# iptables -L
# iptables -I RH-Firewall-1-INPUT 14 -m state --state NEW -p tcp --dport 4848 -j ACCEPT
# iptables -I RH-Firewall-1-INPUT 15 -m state --state NEW -p tcp --dport 8080 -j ACCEPT
# iptables -I RH-Firewall-1-INPUT 16 -m state --state NEW -p tcp --dport 8181 -j ACCEPT
http://localhost:8080 => 초기페이지
Ⅳ. Tomcat Connector 설치
# wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.28/tomcat-connectors-1.2.28-src.tar.gz
--01:03:40-- http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.28/tomcat-connectors-1.2.28-src.tar.gz
Resolving archive.apache.org... 192.87.106.226
Connecting to archive.apache.org|192.87.106.226|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1541956 (1.5M) [application/x-tar]
Saving to: `tomcat-connectors-1.2.28-src.tar.gz'
100%[===========================================================================================>] 1,541,956 299K/s in 5.0s
01:03:47 (299 KB/s) - `tomcat-connectors-1.2.28-src.tar.gz' saved [1541956/1541956]
# tar zxvf tomcat-connectors-1.2.28-src.tar.gz
# cd tomcat-connectors-1.2.28-src/native/
# ./configure --with-apxs=/usr/local/apache/bin/apxs --enable-EAPI
# make
# make install
# ls -al /usr/local/apache/modules/ -> mod_jk.so 생성확인
# cp ../conf/workers.properties /usr/local/apache/conf/
# vi /usr/local/apache/conf/workers.properties
=======================================================================
worker.list=tomcat0
worker.tomcat0.port=8009
worker.tomcat0.host=localhost
worker.tomcat0.type=ajp13
=======================================================================
# iptables -I RH-Firewall-1-INPUT 17 -m state --state NEW -p tcp --dport 8009 -j ACCEPT
# vi /usr/local/apache/conf/httpd.conf
=======================================================================
DirectoryIndex index.html index.jsp
DocumentRoot "/usr/local/apache2/htdocs" => DocumentRoot "/usr/local/tomcat/webapps"
<Directory "/usr/local/apache2/htdocs"> => <Directory "/usr/local/tomcat/webapps">
# Tomcat Settings
Include conf/mod_jk.conf
=======================================================================
vi /usr/local/apache/conf/mod_jk.conf -> mod_jk.conf 생성
=======================================================================
LoadModule jk_module modules/mod_jk.so
<IfModule mod_jk.c>
JkWorkersFile conf/workers.properties
JkShmFile logs/mod_jk.shm
JkLogFile logs/mod_jk.log
JkLogLevel info
#JkRequestLogFormat "%w %V %T"
#JkRequestLogFormat "[%a %b %d %H:%M:%S %Y]"
jkMount /*.jsp tomcat0
jkMount /*.do tomcat0
jkMount /servlet/* tomcat0
</IfModule>
=======================================================================
# cd /usr/local/apache/bin
# apachectl restart
# cd /usr/local/tomcat/bin
# shutdown.sh
# startup.sh
* virtualHost로 설정한 예(anzinda.com)
----------------------------------------------------------------------------------
# vi /usr/local/apache/conf/extra/httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost linux.anzinda.com>
ServerAdmin webmaster@linux.anzinda.com
DocumentRoot "/usr/local/tomcat/webapps/linux.anzinda.com"
ServerName linux.anzinda.com
ServerAlias linux.anzinda.com
ErrorLog logs "/linux.anzinda.com-error_log"
CustomLog logs "/linux.anzinda.com-access_log common"
jkMount /*.jsp tomcat0
jkMount /*.do tomcat0
jkMount /servlet/* tomcat0
</VirtualHost>
# vi /usr/local/tomcat/conf/server.xml
<Host name="linux.anzinda.com" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->
<Context
path=""
docBase="/usr/local/tomcat/webapps/linux.anzinda.com"
debug="0"
reloadable="true"
crossContext="true">
</Context>
<Alias>linux.anzinda.com</Alias>
<Logger
className="org.apache.catalina.logger.FileLogger"
directory="/usr/local/tomcat/webapps/linux.anzinda.com/logs"
prefix="linux.anzinda.com_log."
suffix=".txt"
timestamp="true"/>
</Host>
# adduser ftpuser
# passwd ftpuser
# userdel ftpuser -> 계정삭제
# vi /etc/passwd
ftpuser:x:500:500::/usr/local/tomcat/webapps/linux.anzinda.com:/bin/bash
# chown -R dev:dev /usr/local/tomcat/webapps/linux.anzinda.com