Apache2 - Installation

This article describes how to install an Apache2 webserver under Ubuntu 24.04 LTS and provide a simple website.
Requirements
- Ubuntu 24.04 LTS (server or desktop)
- Sudo- or Root-access
- Internet connection
The installation is done exclusively from the official Ubuntu package sources.
Installation of Apache2
The installation is directly performed via the Ubuntu package manager.
-
Step 1: First, package lists should be updated and available packages should be brought up to date:
sudo apt update && sudo apt upgrade -y -
Step 2: After this, the Apache2 webserver can be installed:
sudo apt install apache2 -y -
Step 3: With the following command, it can be verified if the Apache2-service is active:
systemctl status apache2 -
Step 4: If the service is active, the webserver should be available in the browser under
http://IP-address/.
Add own website
After successful installation, the standard content can be replaced by an own website.
-
Step 1: Switch to the Apache standard web directory:
cd /var/www/html/ -
Step 2: Optionally, you can safe or remove the existing
index.html. -
Step 3: Create a new example website:
sudo nano index.html -
Step 4: The new website is immediately visible in the browser after storing the file.
Troubleshooting
- Website unavailable
- check whether the service is running:
systemctl status apache2 - control firewall-rules:
sudo ufw status
- check whether the service is running:
- Changes are not displayed
- empty browser-cache or reload page (
Strg + F5) - check file rights:
ls -l /var/www/html
- empty browser-cache or reload page (
- Port 80 occupied
- check occupied ports:
sudo ss -tulpn
- check occupied ports:
Summary
An Apache2 webserver can be installed and operated under Ubuntu 24.04 LTS in just a few steps. After the installation, the standard content can be replaced by own websites and the webserver can be secured by fundamental measures.
|
Author: Adrian Zillner Adrian Zillner has been working in Technical Service at Thomas-Krenn AG since May 2025. He is responsible for supporting customers and answering questions about technical issues. |
|
Translator: Alina Ranzinger Alina has been working at Thomas-Krenn.AG since 2024. After her training as multilingual business assistant, she got her job as assistant of the Product Management and is responsible for the translation of texts and for the organisation of the department.
|


