How To Install the Apache Web Server on Ubuntu 20.04

Introduction

Apache, or Apache HTTP Server, is a free and open-source web server that delivers web content through the internet. It is the most widely used web server software. Originally developed by a group of software developers and now maintained by the Apache Software Foundation, Apache provides a secure, efficient, and extensible server that provides HTTP services in sync with the current HTTP standards.

Prerequisites

Before you begin with this guide, you should have a regular, non-root user with sudo privileges configured on your server.

Step 1 — Installing Apache

Apache is available within Ubuntu’s default software repositories, making it possible to install it using conventional package management tools.

sudo apt update
sudo apt install apache2

After confirming the installation, apt will install Apache and all required dependencies.

Step 2 — Adjusting the Firewall

Before testing Apache, it’s necessary to modify the firewall settings to allow outside access to the default web ports. Assuming you have followed the initial server setup instructions to enable the UFW firewall, you can open these ports by typing:

sudo ufw allow 'Apache'

You can verify the change by typing:

sudo ufw status

Step 3 — Checking your Web Server

At the end of the installation process, Ubuntu 20.04 starts Apache. The web server should already be up and running. You can check with the systemd init system to make sure the service is running by typing:

sudo systemctl status apache2

You can access the default Apache landing page to confirm that the software is running properly through your IP address.

Conclusion

Now that you have your web server up and running, you can complete various other tasks like setting up a domain name, enabling SSL/TLS for your site, or deploying a web application.