Cent OS 8에 Apache httpd2.4의 최신 버전을 소스에서 설치

소개



CentOS-8.1.1911-x86_64를 "최소한 설치"로 설치한 환경에 소스에서 Apache의 최신 버전을 설치합니다.
SSL 설정은 제외

OS 전체 update


dnf -y update

필요한 소프트웨어 설치


dnf -y install gcc gcc-c++ make wget tar systemd-devel perl libtool

apr 설치



최신 버전 확인 htp : // 아 pr. 아파치. rg/
cd /usr/local/src
wget http://ftp.meisei-u.ac.jp/mirror/apache/dist//apr/apr-1.7.0.tar.gz
tar xvzf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure
make
make install

Expat XML Parser 설치



최신 버전 확인 htps : // / x x t. 기주 b. 이오/
cd /usr/local/src
wget https://github.com/libexpat/libexpat/releases/download/R_2_2_9/expat-2.2.9.tar.gz
tar xvzf expat-2.2.9.tar.gz
cd expat-2.2.9
./configure
make
make install

apr-util 설치



최신 버전 확인 htp : // 아 pr. 아파치. rg/
cd /usr/local/src
wget http://ftp.jaist.ac.jp/pub/apache//apr/apr-util-1.6.1.tar.gz
tar xvzf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --with-apr=/usr/local/apr
make
make install

PCRE 설치



최신 버전 확인 htps //w w. pc. rg/
cd /usr/local/src
wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
tar xvzf pcre-8.44.tar.gz
cd pcre-8.44
./configure
make
make install

zlib 설치



최신 버전 확인 htps //w w. →이 b. 네 t/
cd /usr/local/src
wget http://zlib.net/zlib-1.2.11.tar.gz
tar xvzf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install

Apache 설치



최신 버전 확인 htps //htpd. 아파치. rg/
cd /usr/local/src/
wget http://ftp.jaist.ac.jp/pub/apache//httpd/httpd-2.4.43.tar.gz
tar xvzf httpd-2.4.43.tar.gz
cd httpd-2.4.43/

./configure --with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr \
--enable-mods-shared=reallyall \
--enable-proxy \
--enable-proxy-ajp \
--enable-dav \
--enable-dav-fs \
--enable-headers \
--enable-rewrite=shared \
--enable-deflate \
--with-pcre=/usr/local

make
make install

apxs로 컴파일


cd /usr/local/src/httpd-2.4.43/modules/arch/unix
/usr/local/apache2/bin/apxs -c mod_systemd.c -I /usr/include/systemd/sd-daemon.h

libtool에서 설정


libtool \
--silent \
--mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong \
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_LARGEFILE64_SOURCE  -DLINUX -D_REENTRANT -D_GNU_SOURCE \
-pthread -I/usr/local/apache2/include -I/usr/local/apr/include/apr-1 -c -o mod_systemd.lo mod_systemd.c && touch mod_systemd.slo

libtool \
--silent \
--mode=link gcc -std=gnu99 -Wl,-z,relro,-z,now,-L/usr/lib64 -o mod_systemd.la -rpath /usr/local/apache2/modules -module -avoid-version mod_systemd.lo

libtool \
--silent \
--mode=link gcc -std=gnu99 -Wl,-z,relro,-z,now,-L/usr/lib64 -o mod_systemd.la -rpath /usr/local/apache2/modules -module -avoid-version mod_systemd.lo -lsystemd

apxs로 컴파일


/usr/local/apache2/bin/apxs -i -a -n systemd mod_systemd.la

httpd.service 작성


vi /usr/lib/systemd/system/httpd.service

httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)

[Service]
Type=forking
ExecStart=/usr/local/apache2/bin/apachectl start
ExecReload=/usr/local/apache2/bin/apachectl graceful
ExecStop=/usr/local/apache2/bin/apachectl stop

# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target

버전 확인


/usr/local/apache2/bin/httpd -v
Server version: Apache/2.4.43 (Unix)
Server built:   Apr 24 2020 20:01:27

방화벽 설정


firewall-cmd --add-service=http --permanent
firewall-cmd --reload

자동 시작 설정 & 시작


systemctl daemon-reload
systemctl start httpd
systemctl enable httpd

동작 확인


systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-04-24 20:07:26 EDT; 30min ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 26056 (httpd)
    Tasks: 109 (limit: 23922)
   Memory: 17.9M
   CGroup: /system.slice/httpd.service
           ├─26056 /usr/local/apache2/bin/httpd -k start
           ├─26057 /usr/local/apache2/bin/httpd -k start
           ├─26058 /usr/local/apache2/bin/httpd -k start
           ├─26059 /usr/local/apache2/bin/httpd -k start
           └─26164 /usr/local/apache2/bin/httpd -k start

브라우저에서의 동작 확인



http://lostname/
방문하십시오.

아래 화면이 표시되면 OK입니다.



참고/출전

좋은 웹페이지 즐겨찾기