# Apache HTTP Server installation on Linux

In 
http
Published 2022-12-03

This tutorial explains to you how you can install the Apache HTTP Server on Linux (CentOS, RHL, OEL).

If you want to install the Apache HTTP Server on Linux you have to go to the https://httpd.apache.org/download.cgi and you will see a page like this:

Click on "2.4.23" link (I prefer a stable release) and you will see the following page:

Click on "httpd-2.4.23.tar.gz" to download the Apache for Linux software.

Extracting the source from the Apache HTTP Server tarball is a simple matter of uncompressing, and then untarring:

$ gzip -d httpd-NN.tar.gz
$ tar xvf httpd-NN.tar

This will create a new directory under the current directory containing the source code for the distribution. You should cd into that directory before proceeding with compiling the server.

In my case I will run:

$ gzip -d httpd-2.4.23.tar.gz
$ tar xvf httpd-2.4.23.tar

One of the prerequisites is to have the APR (Apache Portable Runtime) and APR-Util already installed on your system. If you don't, or prefer to not use the system-provided versions, download the latest versions of both APR and APR-Util from Apache APR, unpack them into /httpd_source_tree_root/srclib/apr and /httpd_source_tree_root/srclib/apr-util (be sure the directory names do not have version numbers; for example, the APR distribution must be under /httpd_source_tree_root/srclib/apr/) and use ./configure's with --with-included-apr option. On some platforms, you may have to install the corresponding -dev packages to allow httpd to build against your installed copy of APR and APR-Util.

So, in the apr and apr-util you have to put what you have in the apr-NNNN (apr-1.5.2 in my case).

You also must have the PCRE installed. If it is not, you can run the following command:

yum install pcre*

Now you can run the config command:

./configure --prefix=/u01/apache --with-included-apr

... and you will see something like this:

If APR is not present or seen, you will receive the error "configure: error: APR not found.":

Now you can build the various parts which form the Apache package by simply running the make command:

$ make

Now you can install the Apache server:

$ make install

Now you can start/ stop the Apache server:

$ PREFIX/bin/apachectl start
$ PREFIX/bin/apachectl stop