2014. 11. 10. 20:54

0. 사전 준비

0.1 PCRE 최신 라이브러리 다운로드
pcre.org -> anonymous FTP를 이용해 최신 버전을 다운로드 받을 수 있는 사이트에 접속하여 최신 버전 다운로드

0.2 컴파일하고 설치하기
$ tar xvfz pcre-8.36
$ cd pcre-8.36
$ ./configure
$ make
$ sudo make install

0.3 pcre 라이브러리를 /usr/local/lib에 설치된다. 로드가 되지 않을 경우, 다음의 명령어를 입력한다.
$ sudo ldconfig


1. apache사이트에서 관련 파일 다운로드 받기

1.1 httpd 다운로드 하기
www.apache.org -> download -> mirror 사이트로 이동 -> httpd 선택 -> 최신 버전을 다운로드 (httd-2.4.10.tar.gz)를 다운로드

1.2 apr과 apr-util 다운로드 하기
www.apache.org -> download -> mirror 사이트로 이동 -> apr 선택택


2. 압축해제
$ tar xvfz httd-2.4.10.tar.gz
$ tar xvfz apr-1.5.1
$ tar xvfz apr-util-1.5.4

3. 이동
mv apr-1.5.1 httpd-2.4.10/srclib/apr
mv apr-util-1.5.4 httpd-2.4.10/srclib/apr-util


4. apache 컴파일 하고 설치하기 
$ cd httpd-2.4.10
$ ./configure --prefix=/usr/local/apache2
$ make
$ sudo make install


5. apache 시작 및 종료 
$ sudo /usr/local/apache2/bin/apachectl start

$ sudo /usr/local/apache2/bin/apachectl /etc/init.d/apache2
$ sudo invoke-rc.d apache2 start   $ sudo /etc/init.d/apache2 start  : 시작
$ sudo invoke-rc.d apache2 stop   $ sudo /etc/init.d/apache2 stop   : 종료

6. apache 정상동작 확인하기
$ sudo netstat -anp | grep httpd

7.  부팅 시 자동실행
$ sudo vi /etc/init.d/apache2

#!/bin/sh
### BEGIN INIT INFO
# Provides:          apache2
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Interactive:     true
# Short-Description: Apache2 web server
# Description:       Start the web server and associated helpers
### END INIT INFO
if [ `id -u` -ne 0 ]; then
    echo "You need root privileges to run this script"
    exit 1
fi
# Make sure tomcat is started with system locale
if [ -f /etc/default/locale ]; then
    . /etc/default/locale
    export LANG
fi
if [ -f /etc/default/rcS ]; then
    . /etc/default/rcS
fi
/lib/lsb/init-functions

$ sudo update-rc.d apache2 defaults 

자동실행을 중단하기위해서는
$ sudo update-rc.d apache2 remove
 

OSX의 Terminal에서 ssh로 로그인을 해서 작업중이라면 Perl locale error가 발생할 수 있다. [해결방법]
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8”).

참고) Apache + Tomcat + MySQL 설치 (우분투)

Posted by 모바일헌터