Install latest version apache on ubuntu from source

This tutorial will explain to Install latest version apache on ubuntu from source. This tutorial provides detailed information and step by step method to achieve this.

Apache Web Server

Apache is a very well known open-source Web Server. It is not only popular but also very old Web Server. Like any other Web Servers, Apache also accepts requests from the clients, search for the requested queries and then send the response back to them.


Also Read : Install mysql on Ubuntu/Centos/Amazon Linux(EC2)


Install latest version apache on ubuntu from source


Step 1 – Download the latest version of Apache from the Apache official website

Open on the following link

Right click on the latest source , currently it is httpd-2.4.46.tar.gz and click on Copy link address/Copy link location.

Create a directory on your Linux box / Ubuntu say apache

$ mkder apache

$ cd apache

Use wget command to download the package ( Paste copied link address after wget command to download )

$  wget


Step 2 – Extract Downloaded package and change directory to extracted folder

 $ sudo tar -xvf httpd-2.4.46.tar.gz

$ cd httpd-2.4.46/


Step 3 –  Configure Apache

Syntax :    ./configure -prefix=PREFIX

Say I have to install and configure the apache package at /usr/local/apache2 ( Note – Create directory /usr/local/apache2 if doesn’t exists)

 $ sudo ./configure -prefix=/usr/local/apache2


Apache Configure Error

If you get  error like following, install the relevant packages as follows:

For configure: error: APR not found. Please read the documentation

$ sudo apt-get install libapr1-dev libaprutil1-dev

for configure: error: pcre-config for libpcre not found. PCRE is required and available from

$ sudo apt-get install libpcre3-dev


Step 4- Run make and make install

$ sudo make

$ sudo make install


Step 5 – Start Apache Service

Use following command to stop, start and restart Apache Service.

$ sudo /usr/local/apache2/bin/apachectl -k start

$ sudo /usr/local/apache2/bin/apachectl -k stop

$ sudo /usr/local/apache2/bin/apachectl -k restart

Note: You can do your configuration for apache2 on /usr/local/apache2/conf/httpd.conf using following command.

$ nano /usr/local/apache2/conf/httpd.conf

To know more about httpd configuration read – How to install and configure Apache httpd on linux


Step 6 – Check apache status

You can check the apche status if service is running or not using following command.

$ ps -ef | grep apache2

I hope you enjoyed this tutorial and learned to Install latest version apache on ubuntu from source. If you think this article is helpful, please do share this post with others as well. Please also share your valuable feedback, comment or any query in the comment box. I will really happy to resolve your queries.

Thank You

If you think we helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter

You may also like…

Leave a Reply

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