referecne
https://salix97.tistory.com/137
https://itknowledge.tistory.com/12
https://memories.tistory.com/42
https://askubuntu.com/questions/256013/apache-error-could-not-reliably-determine-the-servers-fully-qualified-domain-n
Virtual Box, Ubuntu 20.04
$ sudo su
/usr/local# mkdir apache
/usr/local# wget http://mirror.navercorp.com/apache//apr/apr-1.7.0.tar.gz
/usr/local# wget http://mirror.navercorp.com/apache//apr/apr-util-1.6.1.tar.gz
/usr/local# tar xvfz apr-1.7.0.tar.gz
/usr/local# tar xvfz apr-util-1.6.1.tar.gz
/usr/local# wget https://www.apache.org/dist/apr/apr-1.7.0.tar.gz.sha256
/usr/local# sha256sum --check apr-1.7.0.tar.gz.sha256
/usr/local/apr-1.7.0# ./configure --prefix=/usr/local/apr
no acceptable C compiler found in $PATH
말 그대로 컴파일이 없어서 발생한 오류
/usr/local/apr-1.7.0# sudo apt-get install build-essential
/usr/local/apr-1.7.0# ./configure --prefix=/usr/local/apr
/usr/local/apr-1.7.0# make
/usr/local/apr-1.7.0# make install
/usr/local/apr-util-1.6.1# ./configure --with-apr=/usr/local/apr --prefix=/usr/local/apr-util
/usr/local/apr-util-1.6.1# make
/usr/local/apr-util-1.6.1# apt-get install libexpat1-dev
/usr/local/apr-util-1.6.1# make install
/usr/local# wget ftp://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
/usr/local# tar xvfz pcre-8.43.tar.gz
/usr/local/pcre-8.43# ./configure --prefix=/usr/local/pcre
/usr/local/pcre-8.43# make
/usr/local/pcre-8.43# make install
2021년 4월 기준, 가장 최신 버전으로 받음 2.4.46
reference
http://httpd.apache.org/docs/current/install.html#configure
/usr/local# wget http://apache.tt.co.kr//httpd/httpd-2.4.46.tar.gz
/usr/local# tar xvfz httpd-2.4.46.tar.gz
/usr/local/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
/usr/local/httpd-2.4.46# make
/usr/local# wget http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz
/usr/local# tar xvfz m4-1.4.18.tar.gz
/usr/local/m4-1.4.18# ./configure
/usr/local/m4-1.4.18# make
/usr/local/m4-1.4.18/lib# vi fflush.c
/usr/local/m4-1.4.18/lib# vi fpurge.c
/usr/local/m4-1.4.18/lib# vi freadahead.c
/usr/local/m4-1.4.18/lib# vi freading.c
/usr/local/m4-1.4.18/lib# vi fseeko.c
/usr/local/m4-1.4.18# ./configure
/usr/local/m4-1.4.18# make
/usr/local/m4-1.4.18/lib# vi stdio-impl.h
/usr/local/m4-1.4.18# ./configure
/usr/local/m4-1.4.18# make
오류 지옥에서 헤어나오지 못할 것 같아.. 처음으로 돌아가서 다시 설치 해보기로 결심!!
rm -rf 명령어로 apr, apr-util 삭제 후 1. apr 설치로 돌아가 다시 압축 풀어서 동일하게 진행.
/usr/local/apr-1.7.0# ./configure --prefix=/usr/local/apr
처음에 설치했을 때 발견하지 못했던 오류. 제대로 못 보고 넘어갔었나 보다.
/usr/local/apr-1.7.0# cp -arp libtool libtoolT
오류 해결 후 apr 재설치, apr-util 재설치 하고나니 httpd-2.4.46 설치가 잘 되었다.(make 오류 안남)
아래 패키지 먼저 설치하고 가자
/usr/local/# apt-get install net-tools
/usr/local/# apt-get install curl
아파치 실행 명령어 start (k 옵션 : httpd가 죽으면 재시작, 종료 명령어는 stop)
/usr/local/# apache2.4/bin/httpd -k start
Stack Overflow : "This is just a friendly warning and not really a problem (as in that something does not work)."
Server name을 지정하지 않아 나오는 경고라고 함. 나중에 필요하면 변경 하도록 하자..
ps : process status
옵션
/usr/local/# ps -ef | grep httpd | grep -v grep
netstat : 네트워크 연결 상태, 라우팅 테이블, 인터페이스 상태 출력
옵션
/usr/local/# netstat -anp|grep httpd
/usr/local/# curl http://127.0.0.1
아파치 서비스 등록(자동 실행) - apachectl 파일을 복사한 뒤에 등록한다.
/usr/local/apache2.4/bin/# cp apachectl /etc/init.d/httpd
/usr/local/# update-rc.d httpd defaults