티스토리 뷰
반응형
Apache 설치하기
1. 준비
# sudo su
2. apr & apr-util 다운로드
명령어 설명
- wget : web get의 줄임말로, 웹상의 파일을 다운로드
- tar xvfz : tar.gz 형식으로 압축되어있는 파일을 압축해제
# cd /usr/local
# wget http://mirror.navercorp.com/apache//apr/apr-1.7.0.tar.gz
# wget http://mirror.navercorp.com/apache//apr/apr-util-1.6.1.tar.gz
# tar xvfz apr-1.7.0.tar.gz
# tar xvfz apr-util-1.6.1.tar.gz
3. apr & apr-util 설치
3-1. apr 설치
명령어 설명
- ./configure --prefix=/usr/local/apr : 어떤 파일을 /usr/local/apr에 설치
- make : 소스를 컴파일
- 컴파일 : 소스파일을 사용자가 실행가능한 파일로 만들어주는 것
- make 과정이 끝나면 설치파일이 생성된 상태이며, 만들어진 makefile이 어떤 프로그램을 컴파일하고 링크해야하는지 방법을 알려준다.
- make install : make를 통해 만들어진 설치파일을 설치
# cd /usr/local/apr-1.7.0
# ./configure --prefix=/usr/local/apr
# make
# make install
에러1 : configure error no acceptable c compiler found in $path
- 원인 : C 컴파일러를 찾지 못해 발생한다.
- 해결 : sudo apt-get install build-essential
에러2 : cannot remove 'libtoolT' : No such file or directory
- 해결 : cp -arp libtool libtoolT
3-2. apr-util 설치
# cd /usr/local/apr-util-1.6.1
# ./configure --with-apr=/usr/local/apr --prefix=/usr/local/apr-util
# make
# make install
에러 : xml/apr_xml.c:35:10: fatal error: expat.h : No such file or directory
- 원인 : libexpat1-dev라는 패키지가 없어서 발생한다.
- 해결 : apt-get install libexpat1-dev
4. PCRE 다운로드 및 설치
# cd /usr/local
# wget ftp://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
# tar xvfz pcre-8.43.gar.gz
# cd /usr/local/pcre-8.43
# ./configure --prefix=/usr/local/pcre
# make
# make install
5. Apache 2.4.46 다운로드 및 설치
# cd /usr/local
# wget http://apache.tt.co.kr//httpd/httpd-2.4.46.tar.gz
# tar xvfz httpd-2.4.46.tar.gz
에러 : http request sent awaiting response... 404 not found
- 원인 : 해당 URL에 파일이 없다.
- 해결 : 시간이 지날때 마다 버전이 바뀔 수 있으므로 URL에 들어가 파일 버전을 확인하고 적절하게 변경하여 설치하자.
# cd httpd-2.4.46
# ./configure --prefix=/usr/local/apache2.4 \
--enable-module=so --enable-rewrite --enable-so \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--with-pcre=/usr/local/pcre \
--enable-mods-shared=all
# make
# make install
에러 : recipe for target 'htpasswd' failed
- 해결 : 아까 설치한 apr-util 파일들 중 압축 파일을 제외하고 모두 지운 뒤 다시 설치
6. Apache 실행
# sudo /usr/local/apache2.4/bin/httpd -k start
# ps -ef|grep httpd|grep -v grep
# sudo netstat -anp|grep httpd
# sudo curl http://127.0.0.1
에러1 : AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
- 이는 에러라기보다는 경고이며, 크게 문제가 되지 않는다고 한다. - 자세한 정보 (URL)
에러2 : netstat, curl 패키지가 없는 경우
- 해결
- apt-get install net-tools
- apt-get install curl
Reference
반응형
댓글