On Linux, Apache (also known as Apache HTTP Server) can be easily installed. The method depends on the Linux distribution you are using. Here are the instructions for some common distributions:
1. Ubuntu/Debian based distributions
2. Fedora/CentOS/RHEL based distributions
3. openSUSE based distributions
4. Checking the status of Apache
1.) Ubuntu/Debian-based distributions
1. Update system:
sudo apt update
2. Install Apache:
sudo apt install apache2
3. Start Apache service:
sudo systemctl start apache2
4. Enable Apache service to start automatically when the system starts:
sudo systemctl enable apache2
5. Check if Apache is running:
Open your web browser and go to http://localhost or your server's IP address. or your server's IP address. You should see the Apache2 default page.
2.) Fedora/CentOS/RHEL-based distributions
1. Update system:
sudo dnf update # For Fedora sudo yum update # For CentOS / RHEL
2. Install Apache:
sudo dnf install httpd # For Fedora sudo yum install httpd # For CentOS / RHEL
3. Start Apache service:
sudo systemctl start httpd
4. Enable Apache service to start automatically when the system starts:
sudo systemctl enable httpd
5. Check if Apache is running:
Open your web browser and go to http://localhost or your server's IP address. You should see the Apache default page.
3.) openSUSE-based distributions
1. Update system:
sudo zypper update
2. Install Apache:
sudo zypper install apache2
3. Start Apache service:
sudo systemctl start apache2
4. Enable Apache service to start automatically when the system starts:
sudo systemctl enable apache2
5. Check if Apache is running:
Open your web browser and go to http://localhost or your server's IP address. You should see the Apache default page.
4.) Check the status of Apache
Regardless of the distribution, you can check the status of the Apache service with the following command:
sudo systemctl status apache2 # For Ubuntu / Debian sudo systemctl status httpd # For Fedora / CentOS / RHEL / openSUSE
You have now successfully installed and configured Apache on your Linux system.