How To Install the Apache Web Server on Ubuntu 16.04

Published: December 1, 2025 (Updated: Dec 1, 2025)

Enjoying this content? Subscribe to the Channel!

Get Your Website Running: How to Install the Apache Web Server on Ubuntu

Introduction: Why Apache is Essential

Welcome back to Darren’s Tech Tutorials! If you are planning to host a website, deploy a web application, or just want to experiment with server technology, the Apache HTTP Server is the perfect place to start. As one of the most widely used web servers in the world, Apache is powerful, robust, and best of all, completely free.

In this tutorial, we will walk you through the essential, step-by-step process of installing Apache on your Ubuntu server, ensuring it’s properly configured and ready to serve web traffic. Let’s dive in!


Step 1: Update Your Ubuntu System

Before installing any new software, the absolute best practice is to ensure your package lists are up-to-date. This step prevents dependency conflicts and ensures you get the latest security patches for your existing software.

Open your terminal and execute the following command:

sudo apt-get update

If prompted, enter your administrative password. Once the update process completes, we are ready to install the web server itself.

Step 2: Install the Apache Web Server

Now we move on to installing the apache2 package. This command downloads and installs all necessary files and dependencies required to run the Apache server.

Use the apt-get command below:

sudo apt-get install apache2

You will likely be prompted to confirm the installation and disk usage. Type Y (for Yes) and hit Enter.

Step 3: Ensure Apache Starts on Boot

While Apache is now installed and likely running, we need to make sure that if your Ubuntu server ever reboots (due to maintenance or a power outage), the web server automatically starts back up without manual intervention.

To enable the Apache service to start automatically at system boot, run this command:

sudo update-rc.d apache2 enable

This ensures a robust, always-on web hosting environment.

Pro Tip: If you want to manually verify that the service is running immediately after installation, you can use the command: sudo service apache2 status.

Step 4: Configure the Ubuntu Firewall (UFW)

By default, Ubuntu’s Uncomplicated Firewall (UFW) may block incoming web traffic. Since Apache needs to communicate on standard ports (Port 80 for HTTP and Port 443 for HTTPS), we must explicitly allow these connections through the firewall.

Fortunately, Apache registers a specific UFW profile during installation, making this easy. We will allow the Apache Full profile, which opens both HTTP and HTTPS ports.

Execute the following command in your terminal:

sudo ufw allow 'Apache Full'

You should see a confirmation that the firewall rules have been updated.

Step 5: Testing Your Apache Installation

The installation is complete! The final step is to verify that the server is active and accessible. We can do this by navigating to the server’s local address in a web browser.

  1. Open your Firefox or Chrome browser on the same machine.
  2. Navigate to the following address:
http://localhost

If everything was installed correctly, you should see the default “Apache2 Ubuntu Default Page.” This welcome page confirms that the server is running, the firewall is configured correctly, and your machine is ready to host web content!

Conclusion: Get Building!

Congratulations! You have successfully installed and configured the Apache Web Server on your Ubuntu machine. This is the foundation upon which countless websites and applications are built. The next step is replacing that default welcome page with your own custom HTML, or perhaps installing a content management system like WordPress!

If you found this tutorial helpful, please hit the like button and subscribe to Darren’s Tech Tutorials for more clear, practical technology guides. If you ran into any trouble, leave a comment below—we’re always happy to help you troubleshoot!

Happy coding!