[부트캠프][1주차]Ubuntu 18.04 Apache 소스설치(1)

이호석·2022년 6월 6일
0

부트캠프

목록 보기
1/11

VirtualBox에 Ubuntu 18.04 설치를 완료한 후 APM(Apache2, Mysql, PHP)중 Apache를 설치하려고 한다.

Apache 설치 전 필요한 패키지 설치

계정이 일반 사용자 계정이라면 모든 명령어에 sudo 추가

apt-get update
apt install make
apt install gcc
apt install g++
apt install libexpat1-dev
apt install net-tools
apt install curl
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

검색을 해보니 로컬로 설치되어있는 소프트웨어(makefile이 있거나)들은 일반적으로 /usr/local 디렉토리에 존재해야한다고 한다.

1. apr 설치

wget http://mirror.navercorp.com/apache//apr/apr-1.7.0.tar.gz
tar xvfz apr-1.7.0.tar.gz

cd usr/local/apr-1.7.0
./configure --prefix=/usr/local/apr
make
make install

2. apr_util 설치

wget http://mirror.navercorp.com/apache//apr/apr-util-1.6.1.tar.gz
tar xvfz apr-util-1.6.1.tar.gz

cd usr/local/apr-util-1.6.1
./configure --with-apr=/usr/local/apr --prefix=/usr/local/apr-util
make
make install

3. pcre 설치

wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz
tar xvfz pcre-8.45.tar.gz

cd usr/local/pcre-8.45
./configure --prefix=/usr/local/pcre
make
make install

--문제 발생--
pcre 다운 받는중 configure단계에서
configure: error: Invalid C++ compiler or C++ compiler flags 발생
-> 사전에 g++을 설치하지 않아서 발생한 문제였다. (apt-get install g++로 해결)

4. apache2 설치

wget https://dlcdn.apache.org/httpd/httpd-2.4.53.tar.bz2
tar xvfz httpd-2.4.53.tar.bz2

cd httpd-2.4.53
./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

--문제 발생--

configure 하는도중
error: Did not find working script at pcre-config 발생
-> 구글링을 통해서 해결

--with-pcre=/usr/local/pcre/
을 아래로 변경!
--with-pcre=/usr/local/pcre/bin/pcre-config

5. 아파치 실행

sudo /usr/local/apache2.4/bin/httpd -k start

--문제 발생--
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

vim /usr/local/apache2.4/conf/http.conf

httpd.conf 파일에서 서버네임을 설정하면 해결된다.
ServerName localhost:80 추가

아파치가 정상적으로 실행됐다면

ps -ef|grep httpd|grep -v grep
sudo netstat -anp|grep httpd
sudo curl http://127.0.0.1

이 명령어들로 확인하거나 브라우저를 열고 localhost:80를 입력해 확인가능하다.

아파치 설치 완료!

0개의 댓글