How To Install the Apache Web Server on Ubuntu 16.04

Published: September 28, 2017 (Updated: Sep 28, 2017)

Enjoying this content? Subscribe to the Channel!

Set Up Your Own Server! The Essential Guide to Installing Apache on Ubuntu 16.04


Welcome to the World of Web Hosting!

If you’ve ever wanted to host your own website, test a development project, or simply understand how web infrastructure works, installing a web server is the foundational first step. And when it comes to reliability and widespread adoption, Apache is the undisputed champion!

In this tutorial, we’re walking through the quick and easy process of setting up the robust Apache Web Server on a stable Ubuntu 16.04 machine. Even if you’re new to the Linux terminal, Darren’s clear, step-by-step instructions will have your server running in minutes. Let’s get started!


Prerequisites

Before we dive into the commands, make sure you have the following:

  • An active Ubuntu 16.04 installation (physical or virtual machine).
  • A user account with sudo privileges (administrative access).
  • Access to the terminal.

Step 1: Updating Your System Packages

The very first step in any Linux installation process is ensuring your package lists are up-to-date. This prevents installation issues and ensures you pull the latest stable version of Apache from the Ubuntu repositories.

Open your terminal and execute the following command:

sudo apt-get update

Step 2: Installing the Apache Web Server

With your package list refreshed, installing Apache is incredibly simple thanks to Ubuntu’s package management system. We will install the core apache2 package.

Enter the following command and confirm the installation when prompted:

sudo apt-get install apache2

Once the installation is complete, the Apache service will automatically start running on your machine!

Step 3: Ensuring Apache Starts on Boot

A reliable web server needs to run 24/7, and that includes surviving a server reboot. We need to ensure that the Apache service automatically activates every time the server boots up. This command ensures the service is enabled system-wide:

sudo update-rc.d apache2 enable

This crucial step guarantees that your web server infrastructure remains persistent and stable.

Step 4: Configuring the Firewall (UFW)

While Apache is now running, your system’s firewall might be blocking external access to the server. Ubuntu utilizes the Uncomplicated Firewall (UFW) to manage network access.

Fortunately, when Apache is installed, it registers convenient firewall profiles with UFW, making configuration simple. We will allow the ‘Apache Full’ profile, which permits traffic on both Port 80 (HTTP) and Port 443 (HTTPS/SSL).

To allow web traffic through the firewall, use this command:

sudo ufw allow 'Apache Full'

If you haven’t enabled UFW yet, you may need to enable it before this step takes effect (use sudo ufw enable).

Step 5: Verifying the Installation

Congratulations! Apache is installed, enabled, and the firewall is configured. Now for the exciting part—checking your work!

To confirm that the web server is running correctly, open your web browser (on the same machine or a computer connected to the same network) and navigate to the following address:

http://localhost

If everything worked perfectly, you should see the default Apache2 Ubuntu Default Page. This welcome page confirms that your server is operational and ready to start serving files.

If you are accessing the server from another machine, you will need to replace localhost with the server’s specific IP address (e.g., http://192.168.1.10).


What’s Next for Your New Server?

You just successfully set up one of the most powerful web servers in the world! You now have the perfect foundation for hosting websites, configuring virtual hosts, and deploying web applications.

If you followed along and got the Apache Welcome Page, give yourself a high five! This is just the beginning of your journey into web infrastructure.

If you found this guide helpful, please be sure to like this post and subscribe to Darren’s Tech Tutorials for more clear, practical guides on Linux, networking, and all the tech essentials! Drop a comment below and let us know what you plan to host first!