How to Install Apache 2 on Ubuntu 18.04

Reading Time: 2 minutes

Apache is the most popular web server software being used today.  Its popularity is earned through its stability, fast service, and security.  Most likely if you are building out a web page or any public facing app, you’ll be using Apache to display it. At the time of writing, the most current offering of Apache is 2.4.38, and it is the version we will be using to install on our Ubuntu 18.04 LTS server.  Let’s get started!

Step 1: Update and Upgrade the apt tool to ensure we are working with the latest and greatest.

sudo apt update && upgrade

Step 2: Install Apache and select Y when prompted.

sudo apt install apache2

Step 3:  Now that we have installed Apache we have to start the service.

systemctl start apache2

Step 4: Enabling Apache will automatically start the web server whenever the server is turned on.

systemctl enable apache2

Verify Apache by visiting the server’s IP or hostname; you’ll see Apache’s default page.

Optional: Install and Enable PHP

Depending on your needs, say a website that has PHP code,  you may also want to install and enable PHP.

apt install php libapache2-mod-php php-mysqlSpoiler alert, Ubuntu 18.04’s default is PHP is 7.2, the latest and greatest.  You’ll see this value reflected when using:

php --versionOutput:

PHP 7.2.15-0ubuntu0.18.04.2 (cli) (built: Mar 22 2019 17:05:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.15-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies

 

Where Are Apache’s Configuration Files?

You may be curious as to what to do next,  as said before, Apache can be a pre-requisite for another app or it may be where you host your website(s).  Some important files to note are actually on the default page of Apache, but a small snippet description is below.

There’s many ways to set Apache specifically to your taste and needs.  As a Liquid Web customers you’ll enjoy the 24/7 support and a knowledgable tech at your fingertips.  Check out what we can do for you!

Author Bio

About the Author: Echo Diaz

Throughout Echo's four year stint as a technical support specialist, her passion for breaking down complex concepts has to lead to a career in professional writing. As a top tier support specialist, she adds a distinctive element to her written work that speaks to customer feedback and concerns.

Echo occasionally pops her head out from behind her computer to watch her dog energetically run around the yard and unabashedly shovels money into buying tickets to see her favorite musical artists.

Here's 75 % off, Launch a New VPS Today. Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7 Heroic Support