반응형
가비아 클라우드 - 참고 : http://hellogk.tistory.com/123
0.서버
- Linux Ubuntu 13.10 x64
- 패스워드 변경 # sudo passwd root
1. JAVA 설치
- JAVA 설치(오라클 자바7)
$ echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
$ echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
$ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
$ apt-get update
$ apt-get install oracle-java7-installer
//자바 버전확인
$ javac -version
2. FTP 설치
우분투 ftp 설치
$ sudo apt-get install vsftpd
//FTP파일 수정
$ sudo vim /etc/vsftpd.conf
아래와 같이 찾아서 변경
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES //주석해제
3. 톰캣 설치
$ cd /usr/local/
$ wget http://mirror.apache-kr.org/tomcat/tomcat-7/v7.0.63/bin/apache-tomcat-7.0.63.tar.gz -O tomcat7.tar.gz
$ tar -zxvf tomcat7.tar.gz
$ cd /usr/local/apache-tomcat-7.0.63/conf/
//톰캣 설정
$ vi server.xml
//utf-8 설정
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000" URIEncoding="UTF-8"
redirectPort="8443" />
// 아파치 연동을 위한 포트 주석 해제
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
//루트 폴더 변경
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDepl oy="true">
------------------------------------------------------------------//위의 코드 아래에 아래코드 추가
<Context path="" docBase="루트폴더명" reloadable="true"/>
실행
$ cd /usr/local/apache-tomcat-7.0.63/bin/
$ ./startup.sh
// make 설치
$ apt-get install make
8. 아파치 설치
1) apr 다운
$ cd /usr/local/
$ wget http://apache.mirror.cdnetworks.com/apr/apr-1.5.2.tar.gz -O apr.tar.gz
$ tar -zxvf apr.tar.gz
$ cd /usr/local/apr-1.5.2/
$ ./configure --prefix=/usr/local/apr
$ make && make install
2) apr 유틸 다운
$ cd /usr/local/
$ wget http://apache.mirror.cdnetworks.com/apr/apr-util-1.5.4.tar.gz -O apr-util.tar.gz
$ tar -zxvf apr-util.tar.gz
$ cd /usr/local/apr-util-1.5.4/
$ ./configure --prefix=/usr/local/aprutil --with-apr=/usr/local/apr/
$ make && make install
3) pcre 다운
$ cd /usr/local/
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz -O pcre.tar.gz
$ tar -zxvf pcre.tar.gz
$ cd /usr/local/pcre-8.37/
//에러시 /////
$ sudo aptitude install build-essential
$ apt-get -f install
$ sudo apt-get install g++
/////////
$ ./configure --prefix=/usr/local/pcre
$ make && make install
4) 아파치 다운
$ cd /usr/local/
$ wget http://mirror.apache-kr.org/httpd/httpd-2.4.16.tar.gz -O apache.tar.gz
$ tar -zxvf apache.tar.gz
$ cd /usr/local/httpd-2.4.16/
$ ./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-so --enable-rewrite --enable-auth-digest --with-apr=/usr/local/apr --with-apr-util=/usr/local/aprutil/ --with-pcre=/usr/local/pcre
$ make && make install
------------------------------------------------
//아파치 설정
$ cd /usr/local/apache/conf/
$ vi httpd.conf
#ServerName www.example.com:80
ServerName localhost //추가
//아파치 실행
$ cd /usr/local/apache/bin
$ ./apachectl start
9. 연동하기
$ cd /usr/local
$ wget http://apache.mirror.cdnetworks.com/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.40-src.tar.gz -O connector.tar.gz
$ tar -zxvf connector.tar.gz
$ cd tomcat-connectors-1.2.40-src/native/
$ ./configure --with-apxs=/usr/local/apache/bin/apxs
$ make && make install
9-1설정
$ cd /usr/local/apache/conf/
//파일생성
$ vi workers.properties
/*/*/*/*/*/**/*/추가
workers.tomcat_home="/usr/local/apache-tomcat-7.0.63"
workers.java_home="/usr/lib/jvm/java-7-oracle"
ps=/
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
/*/*/*/*/*/*/*/*
// mod_jk.conf 파일 생성
$ vi mod_jk.conf
*/*/*/*/*/*/*/*/**/*/*/추가 (추가시 ?????/주의 )
<IfModule mod_jk.c>
JkLogFile /usr/local/apache/logs/mod_jk.log
JkLogLevel info
JkAutoAlias "/usr/local/apache-tomcat-7.0.63/webapps"
JkMount /* ajp13
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /examples/*.jsp ajp13
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkWorkersFile "/usr/local/apache/conf/workers.properties"
</IfModule>
*/*/*/*/*/*/*/*/*/*/*/**/*/
//httpd.conf 파일생성
$ vi httpd.conf
/*/*/*/*/*/*/*/*/*/**/*/*/중간에 추가
LoadModule jk_module modules/mod_jk.so
#ServerName www.example.com:80
ServerName localhost 추가
*/*/*/*/*/*//*/*/*/*/*/*//**/
/***/*/*/*/*/*/*/*/*최하단 추가
include conf/mod_jk.conf
*/*/*/*/**/*/*/**/*/
톰캣 실행
$ cd /usr/local/apache-tomcat-7.0.63/bin/
$ ./startup.sh
//아파치 실행
$ cd /usr/local/apache/bin
$ ./apachectl start
6. tomcat 서비스 등록
vi /etc/init.d/tomcat7
아래 스크립트 작성
#!/bin/bash
# description: Apache Tomcat 7 Service
# processname: tomcat7
# chkconfig: - 80 20
CATALINA_HOME=/usr/local/apache-tomcat-7.0.63
CATALINA_USER=root
tomcat_pid() {
echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'`
}
start() {
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo "Tomcat is already running (pid: $pid)"
else
echo "Starting tomcat"
# ulimit -n 100000
umask 007
# /bin/su -p -s /bin/sh $CATALINA_USER $CATALINA_HOME/bin/startup.sh
$CATALINA_HOME/bin/startup.sh
fi
return 0
}
stop() {
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo "Stoping Tomcat"
#/bin/su -p -s /bin/sh $CATALINA_USER $CATALINA_HOME/bin/shutdown.sh
$CATALINA_HOME/bin/shutdown.sh
let kwait=20
count=0;
until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ]
do
echo -n -e "\nwaiting for processes to exit";
sleep 1
let count=$count+1;
done
if [ $count -gt $kwait ]; then
echo -n -e "\nkilling processes which didn't stop after 20 seconds"
kill -9 $pid
fi
else
echo "Tomcat is not running"
fi
return 0
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo "Tomcat is running with pid: $pid"
else
echo "Tomcat is not running"
fi
;;
esac
exit 0
//톰캣 서비스구축 스크립트 등
$ cd /etc/init.d/
$ chmod 775 tomcat7
$ chown root tomcat7
//아파치 서비스 등록
파일 복사
$ cp /usr/local/apache/bin/apachectl /etc/init.d/apache2
$ cd /etc/init.d/
$ chmod 775 apache2
$ chown root apache2
실행명령 톰캣&아파치
service apache2 stop
service apache2 start
service tomcat7 stop
service tomcat7 start
반응형
'[OS] > 우분투' 카테고리의 다른 글
윈도우즈에서 리눅스 설치 - WSL(Ubuntu) (0) | 2020.05.08 |
---|---|
우분투에 Mysql 세팅하기 (0) | 2015.08.14 |
Error : Could not reliably determine the server's fully qualified domain name (0) | 2015.08.12 |
리눅스 명령어 (0) | 2015.06.05 |
서버 세팅하기 (0) | 2015.06.01 |
댓글