Compile Apache latest version 2.4.33 on Centos 7 from source code

In this article, we are going to compile apache latest version which is 2.4.33. You will get the information about latest apache releases on official site “https://httpd.apache.org/download.cgi“.

Apache 2.4.33 is the stable released version and its released on 2018-03-17.

About Apache WebServer :

Apache HTTP Server is free and open-source web server software. It is available for both Windows and Linux platforms. But today we are going to learn to compile it on Linux system.

Installing Apache on windows is an easy task like it has come with the .exe package and you just need to install it as per the instructions. But in other hands when you are going to compile it on Linux system that time you first need to understand the requirements of system and Apache web server before start installing it on Linux.

Before starting to compile Apache, we need to install some default dependencies which is required to compile apache.

The first dependency is gcc and gcc-c++, run the below yum install command to install this dependecy.

$ yum install gcc gcc-c++

Install wget package [if not present on your system] which is used to download the latest Apache and other packages on the server.

$ yum install wget

Now, download the below packages with the help of wget command in /opt/ directory [you can choose any directory as per your requirement].

cd /opt/
wget https://archive.apache.org/dist/httpd/httpd-2.4.33.tar.gz
wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz
wget https://www.redrockdigimark.com/apachemirror/apr/apr-1.6.3.tar.gz
wget https://www.redrockdigimark.com/apachemirror/apr/apr-util-1.6.1.tar.gz
wget http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.41.tar.gz

Now extract downloaded packages one by one and install it as per the instructions are given below, 

Dependency Packages :

$ tar -xvf apr-1.6.3.tar.gz

cd apr-1.6.3
./configure --prefix=/data/Apache/apr
make
make install

$ tar -xvf apr-util-1.6.1.tar.gz


cd apr-util-1.6.1/
./configure --prefix=/data/Apache/apr-util --with-apr=/data/Apache/apr
make
make install

$ tar -zxvf openssl-1.0.2o.tar.gz

cd openssl-1.0.2o/
echo "Current directory `pwd`"
./Configure
./conig -fPIC --prefix=/data/Apache/ssl
make
make install

$ tar -xvf pcre-8.41.tar.gz

cd pcre-8.41
./configure –prefix=/data/Apache/pcre
make
make install

Compile Apache :

Now we are going to compile apache with all the above installed packages,

$ tar -xvf httpd-2.4.33.tar.gz

cd httpd-2.4.33
./configure --prefix=/data/Apache --with-apr=/data/Apache/apr --with-apr-util=/data/Apache/apr-util --with-ssl=/data/Apache/ssl --enable-mods-shared=all --enable-deflate --enable-ssl --enable-so
make
make install

Check Opessl version :

cd /DATA/Apache2433/modules

strings mod_ssl.so | egrep ‘^mod_ssl\/|^OpenSSL ‘

Start the Apache service using below command,

cd /usr/local/Apache2433/bin

./httpd -k start

Check Compile Apache version

./httpd -v
Server version: Apache/2.4.33 (Unix)
Server built: Jun 14 2018 12:15:36

Browse URL

Browse : http://local-server-ip/
compile apache
After Successful compilation of apache you will get above page.

I hope you like the article if you find any difficulties then please do comment your queries or problem via the comment section, till then stay tuned to techthings.org for more such valuable articles.

Leave a Reply

Your email address will not be published. Required fields are marked *