설치환경 : CentOS Linux release 7.6.1810 (Core) Minimal
1 컴파일 설치 준비
리눅스에서 컴파일을 설치하려면 gcc, make 둥이 필요함
[root@localhost ~]# yum install gcc make gcc-c++
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.neowiz.com
* epel: mirror01.idc.hinet.net
* extras: centos.mirror.moack.net
* updates: mirror.navercorp.com
* webtatic: us-east.repo.webtatic.com
Package gcc-4.8.5-36.el7_6.2.x86_64 already installed and latest version
Package 1:make-3.82-23.el7.x86_64 already installed and latest version
Package gcc-c++-4.8.5-36.el7_6.2.x86_64 already installed and latest version
Nothing to do
[root@localhost ~]#
이미 설치되어 건너뜀
2 최신버전 다운로드
- http://httpd.apache.org/download.cgi 접속
- Stable Release - Lasted Version 아래의 버전 확인(예: 2.4.9) 후 클릭
- Source: 오른쪽의 bz2 파일 링크(예: httpd-2.4.9.tar.bz2) 클릭하여 다운로드
3 다운로드
cd /usr/local/src
wget http://apache.mirror.cdnetworks.com//httpd/httpd-2.4.39.tar.bz2
wget http://mirror.navercorp.com/apache//apr/apr-1.7.0.tar.bz2
wget http://mirror.navercorp.com/apache//apr/apr-util-1.6.1.tar.bz2
wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.bz2
4 압축 해제
tar xvf apr-1.7.0.tar.bz2
tar xvf apr-util-1.6.1.tar.bz2
tar xvf httpd-2.4.39.tar.bz2
tar xvf pcre-8.43.tar.bz2
mv apr-1.7.0 ./httpd-2.4.39/srclib/apr
mv apr-util-1.6.1 ./httpd-2.4.39/srclib/apr-util
아래와 같은 에러메시지가 보인다면 lbzip2 패키지가 없는것임.
[root@localhost src]# tar xvf apr-1.7.0.tar.bz2 tar (child): cannot run bzip2: No such file or directory
tar (child): trying lbzip2
tar (child): lbzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
[root@localhost src]#
# yum install bzip2
5 pcre 설치
cd /usr/local/src/pcre-8.43
./configure
make
make install
6 아파치 설치
cd /usr/local/src/httpd-2.4.39
./configure --prefix=/usr/local/apache2
make
make install
아파치 설치폴더는 /usr/local/apache2 임.
/usr/local/apache2/conf/httpd.conf 파일에서 ServerName 의 주석(#)을 풀고, IP:80 으로 수정함
(예) ServerName 192.168.0.20:80
아래와 같은 에러메시지가 보이면
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
ServerName 설정이 안되어 있어서 나는 경고.
httpd.conf 파일을 열어서 ServerName 부분을 찾아서 주석 해제 하고 ServerName xxx.xxx.com 등 자신의 도메인을 쓰면 해결
7 아파치 시작
[root@localhost conf]# /usr/local/apache2/bin/httpd -k start
httpd (pid 19351) already running
[root@localhost conf]# ps -ef | grep httpd | grep -v grep
root 19351 1 0 16:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 19352 19351 0 16:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 19353 19351 0 16:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 19354 19351 0 16:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
[root@localhost conf]#
8 방화벽 끄기
[root@web ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source 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 source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination
[root@web ~]# lokkit --selinux=disabled --disabled [root@web ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source 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