How To Install Apache on Ubuntu 22.04

In this guide, we will explain how to install Apache on Ubuntu 22.04, enabling you to set up a reliable web server for your applications and websites.

Apache HTTP Server, commonly referred to as Apache, is an open-source web server software. It is one of the oldest and most reliable web servers, used to serve web pages to users.

This article explains how to install Apache on Ubuntu 22.04.

Prerequisites

  • Launch the Ubuntu 22.04 instance on Neevcloud

  • Create a new Domain or subdomain A record that points to your server IP address.

  • Access the server using SSH

Let's follow step by step for a complete Apache installation and basic configuration on Ubuntu 22.04.

Update && Upgrade the system

First, update your package list to ensure you have the latest information on available packages

sudo apt-get update -y
sudo apt-get upgrade -y

Install Apache

Install Apache using the apt package manager

sudo apt-get install apache2 -y

Verify the Installation

Check if Apache was installed correctly by running

sudo apache2 -v

To Start and Enable Apache

Once the Apache is installed, start the Apache service

sudo systemctl start apache2

Enable it to start when the system rebooted

sudo systemctl enable apache2

Check the Status

Ensure the server is running smoothly.

sudo systemctl status apache2 

Check Apache default port

To verify that Apache is running on its default port (80), execute the command below

sudo ss -antpl | grep apache

Adjust the Firewall

If you're using UFW (Uncomplicated Firewall), allow Apache traffic.

sudo ufw allow 'Apache'
sudo ufw enable 
sudo ufw status

Test the Apache web server

To verify your Apache installation, navigate to http://your-server-ip your web browser. If the installation is successful, you will be greeted by the test page.

Last updated