How to Install Apache on Ubuntu
Apache is a powerful, flexible, and open-source web server developed and maintained by the Apache Software Foundation. It is one of the most widely used web servers in the world. This guide will show you how to install Apache on an Ubuntu-based system, start the service, configure your firewall, and verify that it works correctly.
← BackStep 1: Update Package Index
Always begin by updating your local package index to make sure you're installing the latest available version of Apache:
sudo apt update
Step 2: Install Apache Web Server
Once the package list is updated, install Apache using the following command:
sudo apt install apache2
Step 3: Adjust the Firewall
Ubuntu systems typically use UFW (Uncomplicated Firewall) to manage firewall rules. Allow Apache through the firewall to serve web content:
sudo ufw allow 'Apache'
Step 4: Check Firewall Status
Check to confirm that UFW is running and Apache is allowed:
sudo ufw status
Step 5: Start and Enable Apache
Apache should start automatically, but you can manually control it using systemctl
. Here are the most useful commands:
Step 6: Test Apache
To ensure that Apache is installed and running correctly, open a web browser and visit your server’s IP address:
http://your_server_ip
If everything was successful, you should see the default Apache welcome page.
← Back