아파치 소스설치
아파치란?
www 서버용 소프트웨어이다. HTTP 아파치 서버라고도 불리고 HTTP 웹 서버이다.
리눅스나 윈도우 등 거의 모든 운영체제에서 사용할 수 있으며 구축이 쉽다.
- 소스설치, 수동설치, 컴파일설치: linux에서 소스를 직접 다운받아 컴파일하여 설치하는 것을 말한다.
- <-> 패키지 설치와 반대
- why? 패키지 설치로 간편하게 설치를 할 수 있지만 불필요하게 설치되는 파일들이 시스템의 자원을 사용하게 되고 패키지 단위로 설치되기에 관리적으로 문제가 발생 가능하다.
- /usr/local/에 설치하는 것이 관례
- 소스 파일은 /usr/local/src에 보관
설치한 VM의 Ubuntu를 실행시키고 경로는 /usr/local로 이동한다.
컴파일 에러
error: in 'home/kim/apr-1.7.0':
error: no acceptable C compiler found in $PATH
- C 컴파일러가 없어서 나타나는 에러이다.
sudo apt-get install build-essential #명령어를 통해 설치
설치전 컴파일러를 설치해주자
대부분 설치 환경은
cd /usr/loacl #환경에서 진행하자.
1. 준비 과정
$ sudo su
$ cd /usr/local
$ mkdir apache #소스코드를 저장할 디렉토리 생성
2. 필요 패키지 설치
$ apt-get install gcc
$ cp -arp libtool libtoolT
$ apt install make
$ apt install --reinstall make
$ apt-get install
$ apt-get install libexpat1-dev
$ apt-get install g++
3. 의존성 패키지 apr과 apr-util 설치
- 경로 : /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
- wget : web get의 줄임말로 웹 서버로부터 파일을 다운로드한다.
- tar xvfz : tar.gz 형식으로 압축되어있는 파일을 압축해제
에러 사전 방지 항목들
no acceptable C compiler found in $PATH #이런 에러 방지하기 위해서 아래와 같이 설치
cannot remove 'libtoolT' : No such file or directory #우리는 위에서 미리 했다.
- no acceptable C compiler found in $PATH
- cannot remove 'libtoolT' : No such file or directory
$ apt-get install gcc
$ cp -arp libtool libtoolT
$ apt install make
$ apt install --reinstall make
- perfix 옵션은 위치를 지정하는 것
$ cd /usr/local/apr-1.7.0
$ ./configure --prefix=/usr/local/apr
$ make && make install
$ cd usr/local/apr-util-1.6.1
$ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
$ make
$ make install
에러
fatal error: expath.h : No such file or directory
- fatal error: expath.h : No such file or directory
Ubuntu에서는 libexpat1-dev를 설치해야 한다.
sudo apt install libexpat1-dev
4. 의존성 패키지 - pcre 설치
설치하기전 c++ 컴파일러를 설치 후에 진행해야 한다.
Apache2.4x 버전이면 PCRE를 다운받아야 한다.
apt-get install g++
usr/local에 설치해보자
$ cd /usr/local
$ wget <ftp://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz>
$ tar xvfz pcre-8.43.tar.gz
$ cd /usr/local/pcre-8.43
$ ./configure --prefix=/usr/local/pcre
$ make
$ make install
에러 발생!
ftp~~는 이제 지원하지 않기 때문에 다른 방법으로 진행한다.
cd /usr/local
wget <https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz>
tar xvfz pcre-8.45.tar.gz
cd pcre-8.45
./configure --prefix=/usr/local/pcre
make
make install
5. apapche 2.4.48설치
Download - The Apache HTTP Server Project
Downloading the Apache HTTP Server Use the links below to download the Apache HTTP Server from our download servers. You must verify the integrity of the downloaded files using signatures downloaded from our main distribution directory. The signatures can
httpd.apache.org
여기서 알맞은 버전을 찾는다.
위치는 /usr/local
$ cd ..
$ wget <https://downloads.apache.org//httpd/httpd-2.4.51.tar.gz>
$ tar xvfz httpd-2.4.51.tar.gz
$ cd httpd-2.4.51
$ ./configure --prefix=/usr/local/apache2.4 \\
--enable-module=so --enable-rewrite --enable-so \\
--with-apr=/usr/local/apr \\
--with-apr-util=/usr/loacl/apr-util \\
--with-pcre=/usr/local/pcre \\
--enable-mods-shared=all #안되면 apt-get install 해보자 오타조금이라도 ㄴㄴ
$ make
$ make install
6. Apache 실행
$ vi /usr/local/apache2.4/conf/httpd.conf #편집기를 열어서
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
ServerName localhost:80
#
이 부분을 추가해주고 편집기를 종료한다.
$ apt-get install net-tools
$ sudo /usr/local/apache2.4/bin/httpd -k start
$ ps -eflgrep httpdlgrep -v grep
$ sudo netstat -anplgrep httpd
$ apt-get install curl
$ sudo curl <http://127.0.0.1>
브라우저 창에서 localhost/를 입력하면 화면이 들어가진다.
'Server > Local Server' 카테고리의 다른 글
7. 우분투(Ubuntu)에 PHP 설치하기 (0) | 2022.08.07 |
---|---|
6. 우분투(Ubuntu)에 MySQL 설치하기 (0) | 2022.08.07 |
4. VirtualBox에 Ubuntu 설치하기 (0) | 2022.08.07 |
3. Virtual Box 설치하기 (가상머신 설치하기) (0) | 2022.08.07 |
2. APM 설치하기 (0) | 2022.08.07 |