This guideline is for working on Raspbian – a Linux distro for Raspberry Pi, but other Linux operating systems have similar steps.
- Download the Apache 2 source from https://httpd.apache.org/download.cgi. It should be in a compressed file, e.g.: httpd-2.4.28.tar.bz2. After decompressing it, we have a httpd-<version> folder.
- Install PCRE library from the terminal:
sudo apt-get install libpcre3-dev
- Download source of APR and APR-util from https://apr.apache.org/download.cgi. They’re all in compressed files, e.g.: apr-1.6.2.tar.gz, apr-util-1.6.0.tar.gz. After decompressing them, we have the following folders: apr-<version>, apr-util-<version>. Rename them accordingly to apr and apr-util and then move them into the folder at step #1 to this path: httpd-<version>/srclib/.
The folder structure should be like this:
- Open the terminal and issue the following commands in the httpd-<version> folder to build and install Apache 2:
./configure –prefix=/usr/local/apache2 –with-included-apr –enable-so
sudo make install
- Check its version: