# How To Install Apache on Ubuntu 22.04

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.

{% embed url="<https://youtu.be/qlySFoH4p5w?si=hcKgjUwyo9MiGiEl>" %}

This article explains how to install Apache on Ubuntu 22.04.

## Prerequisites

* Launch the [Ubuntu 22.04 instance](https://docs.neevcloud.com/neevcloud-products/computes/getting-started-launch-vms) on Neevcloud&#x20;
* Create a new Domain or subdomain A record that points to your server IP address.
* Access the server using [SSH](https://docs.neevcloud.com/neevcloud-products/computes/getting-started-launch-vms#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
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2FXaANc3dbmfpCynijdKvj%2Fimage.png?alt=media&#x26;token=692dfcf5-9af2-4245-9942-2770fa6b962a" alt=""><figcaption></figcaption></figure>

### Verify the Installation&#x20;

Check if Apache was installed correctly by running

```
sudo apache2 -v
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2Ft9h4ddd3GlsaTSlI0kGn%2Fimage.png?alt=media&#x26;token=cd3c95a2-6df7-4db3-82f7-54d86f3fe06e" alt=""><figcaption></figcaption></figure>

### 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
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2FMmoEMgoalr4iiQtyYqs3%2Fimage.png?alt=media&#x26;token=a9d25724-b393-4d07-93b5-eb14613ad046" alt=""><figcaption></figcaption></figure>

### Check the Status

Ensure the server is running smoothly.

```
sudo systemctl status apache2 
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2FfCP8Fc3jjZGtLxGvCv8N%2Fimage.png?alt=media&#x26;token=67e4c76b-a368-474e-8702-f62ef04bb92e" alt=""><figcaption></figcaption></figure>

### **Check Apache default port**

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

```
sudo ss -antpl | grep apache
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2Fi3FTheSEMft8bTkHyiNw%2Fimage.png?alt=media&#x26;token=013f146c-ab01-4e2e-a01b-1dfff92c7413" alt=""><figcaption></figcaption></figure>

### Adjust the Firewall

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

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

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2Fjzk292VB6rcXZSd1ZJg4%2Fimage.png?alt=media&#x26;token=6152388a-6451-4f2a-b46f-d187132d78ef" alt=""><figcaption></figcaption></figure>

### 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.

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2FSPUptEzQTxN05uXhGsJk%2Fimage.png?alt=media&#x26;token=2797755a-9392-42a8-af7e-21f444e48339" alt=""><figcaption></figcaption></figure>
