In this article, we'll explain how to install Apache HTTP Server on Ubuntu.
It's open-source HTTP server for modern operating systems including UNIX and Windows. Apache HTTP server provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards. It is developed and maintained by a community of developers under the auspices of the Apache Software Foundation.
Install Apache HTTP Server on Ubuntu
Let's start with the installation process.
There are two ways to install Apache HTTP server. First way is simple, we just need to execute one command and it gets installed. Second way is installing from source. It is bit complex process and need to have Linux command knowledge.
Let's check the first way of the installation.
Keep the server up-to-date
First, we need to update the server using following command:
sudo apt update
Install Apache HTTP Server
Now, execute the following command to install Apache HTTP server.
sudo apt install apache2
That's it, we have installed Apache HTTP server.
Now, let's check the second way of the installation.
Install the dependencies
Here we are installing build essential because we need gcc compiler.
sudo apt install build-essential libpcre2-dev libapr1-dev libaprutil1-dev -y
Download the latest release
Now, we need to download the latest release from [official website](http://httpd.apache.org/download.cgi).
Extract the file
Next, we will extract it and change our working directory. Execute set of following commands:
gzip -d httpd-2.4.58.tar.gz
tar xvf httpd-2.4.58.tar
Install Apache HTTP server
We need to run configure command.
You can mention
--prefix=<directory location> to replace the default installation location.
Next, compile and install the files using following commands:
sudo make install
If you want to customize the default configuration file, you can do it using following command:
Note: Replace /usr/local/apache2 if you have custom prefix.
Verify the installation
Finally, let's verify the installation. Execute following command:
sudo /usr/local/apache2/bin/apachectl -k start
Navigate to your browser and access it using your server IP.
That's it, we have seen how to install Apache HTTP Server on Ubuntu.