[CENTOS] Install the latest version of Apache httpd 2.4 from source on Cent OS 8

Introduction

Install the latest version of Apache from the source in the environment where CentOS-8.1.1911-x86_64 was installed with "minimum installation". SSL settings are excluded

OS-wide update

dnf -y update

Installation of necessary software

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

apr installation

Check the latest version http://apr.apache.org/

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 installation

Check the latest version https://libexpat.github.io/

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 installation

Check the latest version http://apr.apache.org/

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 installation

Check the latest version https://www.pcre.org/

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 installation

Check the latest version https://www.zlib.net/

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 installation

Check the latest version https://httpd.apache.org/

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

Compile using 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

Settings with 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

Compile using apxs

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

httpd.service created

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

Version confirmation

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

Firewall settings

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

Auto start setting & start

systemctl daemon-reload
systemctl start httpd
systemctl enable httpd

Operation check

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

Operation check from the browser

http://lostname/ Please access.

It is OK if the following screen is displayed.

Apache.jpg

Reference / Exhibition

https://qiita.com/shadowhat/items/163ee5fdd56c51100e9e

https://www.smiyasaka.com/CentOS7.0_server21.html

Recommended Posts

Install the latest version of Apache httpd 2.4 from source on Cent OS 8
Install the latest version of CMake on Ubuntu 18.04.4 LTS
Install the latest version of Git on your Linux server
Steps to install the latest version of OpenCV on OS X El Capitan without Homebrew
Use the latest version of PyCharm on Ubuntu
Install Apache 2.4.41 from source
Install tomcat 9 on Cent OS 8
Install Apache Maven (from source)
How to integrate Apache httpd 2.4 and Tomcat 9 on Cent OS 8
Install Adopt OpenJDK 11 on Cent OS 8
How to install Apache (httpd) on CentOS7
How to install Apache (httpd) on CentOS8
Install PostgreSQL from source code on CentOS
Install the latest Cuda + CuDNN on Ubuntu 18.04 @ Spring 2020
[Is it explosive !?] Setup for using the GPU version of Tensorflow on OS X
Run the flask app on Cloud9 and Apache Httpd
Steps to install the latest Python on your Mac
The latest version of Pillow 7.0.0 will kill the pytorch transform.
Install the latest Python from pyenv installed with homebrew
Install python from source
[Personal memo] Install the latest Java on Amazon Linux that already contains Java and switch the version
Notes on the version of CUDA, cuDNN where tensorflow-gpu worked
Through the installation of pip package that depends on opencv-python when building opencv from source code
Align the version of chromedriver_binary
[Apache] The story of prefork
Install ansible from source code
Install the JDK on Linux
Suspend Thread on Linux (corrected version at the bottom of the article)
[Latest version] Let the bot speak at regular intervals on discord.py
Quickly install OpenCV 2.4 (+ python) on OS X and try the sample
Install and manage multiple environments of the same distribution on WSL
How to update the python version of Cloud Shell on GCP
Sabayon Linux Portage Profile from 17.0 to 17.1 / Try installing the latest version of Sabayon using the Daily builds installation media