Apache HTTP Server is a cross-platform web server that delivers web content to a clients who request it. Apache is an open-source project, available under the Apache License 2.0.
This tutorial shows how to install Apache 2.4 on Raspberry Pi.
Connect to Raspberry Pi via SSH and use
wget tool to download GPG key. Then add repository and update the package lists.
sudo wget -O /etc/apt/trusted.gpg.d/apache2.gpg https://packages.sury.org/apache2/apt.gpg echo "deb https://packages.sury.org/apache2/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/apache2.list sudo apt update
Execute the following command to install Apache:
sudo apt install -y apache2
After the installation is finished, we can check Apache version.
To make sure that Apache service is running, we can use the following command:
sudo service apache2 status
We can stop, start and restart the Apache service:
sudo service apache2 stop sudo service apache2 start sudo service apache2 restart
If you decided to completely remove any package with a name that starts with
apache and anything related to it, run the following command:
sudo apt purge -y apache.*
In order to test Apache we need to get IP address of the Raspberry Pi.
Open the browser and enter Raspberry Pi's IP address. Then you will see Apache default page like this: