Install Apache 2 web server from source on Raspbian

Apache 2

Image credit: http://www.apache.org/

This guideline is for working on Raspbian – a Linux distro for Raspberry Pi, but other Linux operating systems have similar steps.

  1. Download 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.
  2. Install PCRE library from the terminal:
    sudo apt-get install libpcre3-dev
  3. 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.gzapr-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:
  4. 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
    sudo make install
  5. Check its version:
    apache2 -v

Also check out “Install MariaDB / MySQL on Raspbian / Debian” and “Install PHP 7 from source on Raspbian/Debian


Leave a Reply