How to Install Apache Web Server on Ubuntu

Claude R Hector
4 min readJan 16, 2022

If you’ve visited your favorite website recently, the likelihood that it is hosted on an Apache web server is very high. Web Server? Apache? What are those? Well simply put a web server stores and delivers the content for a website — such as text, images, video, and application data — to clients that request it. Apache is a clear example of such web server. Developed and maintained by the Apache Software Foundation, Apache is an open-source cross-platform server that is used by a majority of websites on the internet. In this tutorial we will cover how to install and run Apache on Ubuntu with easy to follow steps.


  • Ubuntu Server.
  • Command Line Terminal.
  • Access to an account with sudo(Super User Do)privileges in other words superpowers.

Getting Started.

Launch your command line terminal on your desktop or laptop and establish a connection to your cloud server by SSH (Secure Shell). SSH or Secure Shell is a network communication protocol that enables two computers to communicate. Establishing the connection to your cloud server can be done by entering the command below on your terminal.

Step 1: Update Server Packages.

As a best practice it is always recommended to check and install any possible updates that can arise due to bug fixes or security patches. This can be performed by entering the following command on your terminal: sudo apt-get update.

You will be prompted by the system to enter your password. Type in password and press enter

The update should take a few minutes to complete. Once completed the following should appear on your screen

Step 2: Apache Web Server Install.

To Install the Apache package on Ubuntu type the following command: sudo apt-get install apache2

On the off chance you receive the message below type “y” and press enter to continue

Step 3: Configure your firewall.

Before testing Apache, it’s necessary to modify the firewall settings to allow outside access or traffic on port 80.

Start by displaying available app profiles on UFW by entering the following command:

You will receive a list of the application profiles:

we will only need to allow traffic on port 80 by entering the following command:

The output will provide a list of allowed HTTP traffic:

Step 4: Check Web Server Status.

You can verify that the apache2 service is active/running and is enabled to automatically start at system startup by using the following command:

And we’re live!!!

You can access the default Apache landing page to confirm that the software is running properly through your IP address. If you do not know your server’s IP address, you can get it by entering the command below on your terminal.

And we’re live!!!

If you’ve gotten this far and have gotten the page above you have successfully installed Apache Web Server on Ubuntu.