✔️ CentOS 6.3, 아파치 2.4.7에서 테스트하였습니다.
- 리눅스 아파치 컴파일 설치
- 리눅스 아파치 최신버전 설치 (컴파일)
1 컴파일 설치 준비[ | ]
리눅스 컴파일 설치 준비 문서를 참고하십시오.
2 최신버전 다운로드[ | ]
- http://httpd.apache.org/download.cgi 접속
- Stable Release - Lasted Version 아래의 버전 확인(예: 2.4.9) 후 클릭
- Source: 오른쪽의 bz2 파일 링크(예: httpd-2.4.9.tar.bz2) 클릭하여 다운로드
3 다운로드[ | ]
Bash
Copy
cd /usr/local/src
wget http://ftp.neowiz.com/apache/httpd/httpd-2.4.29.tar.bz2
wget http://ftp.neowiz.com/apache/apr/apr-1.6.3.tar.bz2
wget http://ftp.neowiz.com/apache/apr/apr-util-1.6.1.tar.bz2
wget http://downloads.syntaxhighlightforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.bz2
- → 다운로드 안되면 http://ftp.neowiz.com/apache/httpd 에서 버전 및 URL 확인
Console
Copy
[root@web01 src]# ll
total 7772
-rw-r--r--. 1 root root 853363 Jun 13 00:35 apr-1.6.3.tar.bz2
-rw-r--r--. 1 root root 428750 Jun 13 00:35 apr-util-1.6.1.tar.bz2
-rw-r--r--. 1 root root 6527394 Jul 10 03:10 httpd-2.4.29.tar.bz2
-rw-r--r--. 1 root root 1561874 Jul 6 05:22 pcre-8.41.tar.bz2
[root@web01 src]#
4 압축 해제[ | ]
Bash
Copy
tar xvf apr-1.6.3.tar.bz2
tar xvf apr-util-1.6.1.tar.bz2
tar xvf httpd-2.4.29.tar.bz2
tar xvf pcre-8.41.tar.bz2
mv apr-1.6.2 ./httpd-2.4.27/srclib/apr
mv apr-util-1.6.0 ./httpd-2.4.27/srclib/apr-util
Console
Copy
[root@web01 ~]# tar xvf apr-1.5.2.tar.bz2
... (생략)
apr-1.5.2/encoding/
apr-1.5.2/encoding/apr_escape.c
Console
Copy
[root@web01 ~]# tar xvf apr-util-1.5.4.tar.bz2
... (생략)
apr-util-1.5.4/encoding/
apr-util-1.5.4/encoding/apr_base64.c
Console
Copy
[root@web01 ~]# tar xvf httpd-2.4.25.tar.bz2
... (생략)
httpd-2.4.25/build/aix/mkinstallp.ksh
httpd-2.4.25/build/aix/README
Console
Copy
[root@web01 ~]# tar xvf pcre-8.33.tar.bz2
... (생략)
pcre-8.33/makevp_c.txt
pcre-8.33/pcredemo.c
Console
Copy
[root@web01 src]# ll
total 7788
drwxr-xr-x. 27 1000 1000 4096 Nov 13 08:14 apr-1.5.2
-rw-r--r--. 1 root root 813976 Nov 16 09:50 apr-1.5.2.tar.bz2
drwxr-xr-x. 19 1000 1000 4096 Nov 13 08:41 apr-util-1.5.4
-rw-r--r--. 1 root root 695303 Nov 16 09:52 apr-util-1.5.4.tar.bz2
drwxr-xr-x. 11 501 games 4096 Nov 19 09:36 httpd-2.4.20
-rw-r--r--. 1 root root 5004719 Nov 22 09:49 httpd-2.4.20.tar.bz2
drwxr-xr-x. 7 1169 1169 4096 May 28 02:14 pcre-8.33
-rw-r--r--. 1 root root 1440869 May 28 01:16 pcre-8.33.tar.bz2
Console
Copy
[root@web01 src]# mv apr-1.5.2 ./httpd-2.4.25/srclib/apr
[root@web01 src]# mv apr-util-1.5.4 ./httpd-2.4.25/srclib/apr-util
[root@web01 src]# ll
total 7780
-rw-r--r--. 1 root root 813976 Nov 16 09:50 apr-1.5.2.tar.bz2
-rw-r--r--. 1 root root 695303 Nov 16 09:52 apr-util-1.5.4.tar.bz2
drwxr-xr-x. 11 501 games 4096 Nov 19 09:36 httpd-2.4.20
-rw-r--r--. 1 root root 5004719 Nov 22 09:49 httpd-2.4.20.tar.bz2
drwxr-xr-x. 7 1169 1169 4096 May 28 02:14 pcre-8.33
-rw-r--r--. 1 root root 1440869 May 28 01:16 pcre-8.33.tar.bz2
5 pcre 설치[ | ]
Bash
Copy
cd /usr/local/src/pcre-8.41
./configure
make
make install
Console
Copy
[root@web01 ~]# cd /usr/local/src/pcre-8.33
[root@web01 pcre-8.33]# ./configure
... (생략)
Link pcretest with libreadline .. : no
Valgrind support ................ : no
Code coverage ................... : no
Console
Copy
[root@web01 pcre-8.33]# make
... (생략)
CXX pcre_stringpiece_unittest-pcre_stringpiece_unittest.o
CXXLD pcre_stringpiece_unittest
make[1]: Leaving directory `/usr/local/src/pcre-8.33'
Console
Copy
[root@web01 pcre-8.33]# make install
make[3]: Leaving directory `/usr/local/src/pcre-8.33'
make[2]: Leaving directory `/usr/local/src/pcre-8.33'
make[1]: Leaving directory `/usr/local/src/pcre-8.33'
6 아파치 설치[ | ]
Bash
Copy
cd /usr/local/src/httpd-2.4.27
./configure --prefix=/usr/local/apache2
make
make install
- →
--prefix=/usr/local/apache2
에 있는대로 /usr/local/apache2가 아파치 홈 폴더가 된다.[1] - →
configure: error: Cannot use an external APR-util with the bundled APR
오류 발생하면[2]./configure --prefix=/usr/local/apache2 --with-included-apr
를 해보자.
Console
Copy
[root@web01 pcre-8.33]# cd /usr/local/src/httpd-2.4.20
[root@web01 httpd-2.4.20]# ./configure --prefix=/usr/local/apache2
... (생략)
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
Console
Copy
[root@web01 httpd-2.4.20]# make
... (생략)
make[2]: Leaving directory `/usr/local/src/httpd-2.4.20/support'
make[1]: Leaving directory `/usr/local/src/httpd-2.4.20'
Console
Copy
[root@web01 httpd-2.4.20]# make install
... (생략)
mkdir /usr/local/apache2/man/man8
mkdir /usr/local/apache2/manual
make[1]: Leaving directory `/usr/local/src/httpd-2.4.20'
7 아파치 시작[ | ]
Console
Copy
[root@web ~]# /usr/local/apache2/bin/httpd -k start
[root@web ~]# ps -ef | grep httpd | grep -v grep
root 35683 1 0 17:09 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 35684 35683 0 17:09 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 35685 35683 0 17:09 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 35686 35683 0 17:09 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
Console
Copy
[root@web ~]# netstat -anp | grep httpd
tcp 0 0 :::80 :::* LISTEN 35683/httpd
Console
Copy
[root@web01 ~]# curl http://127.0.0.1
<html><body><h1>It works!</h1></body></html>
8 방화벽 끄기[ | ]
Console
Copy
[root@web ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt syntaxhighlight destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt syntaxhighlight destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt syntaxhighlight destination
Console
Copy
[root@web ~]# lokkit --selinux=disabled --disabled
[root@web ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt syntaxhighlight destination
Chain FORWARD (policy ACCEPT)
target prot opt syntaxhighlight destination
Chain OUTPUT (policy ACCEPT)
target prot opt syntaxhighlight destination
[root@web ~]# iptables -F; iptables -X
9 같이 보기[ | ]
10 참고[ | ]
- http://snoopybox.co.kr/1704
- http://httpd.apache.org/docs/2.4/install.html
- http://d.hatena.ne.jp/yohei-a/20120809/1344490042
- ↑ 다른 위치를 원한다면 변경해도 된다.
- ↑ CentOS 6에 아파치 2.4.12 설치하니 발생했음. https://bz.apache.org/bugzilla/show_bug.cgi?id=42089