25th Anniversary Savings | 25% Off Dedicated Servers*Shop Now
25th Anniversary Savings | 25% Off VPS Hosting* †††Shop Now
Limited Inventory: High-Performance AMD-Powered Servers Now Available.* Shop Now >

How to Install Apache 2 on Ubuntu 18.04

Posted on by Justin Palmer | Updated:
Reading Time: 2 minutes

Apache is the most popular web server software in use today.  Its popularity is earned through its stability, speed, and security.  Most likely if you are building out a website or any public facing app, you’ll be using Apache to display it. At the time of this writing, the most current offering of Apache is 2.4.39, and it is the version we will be using to install on our Ubuntu VPS server.  Let’s get started!

How to Install Apache 2 on Ubuntu 18.04

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.

apache 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 Is Apache’s Configuration Files?

So, what’s next?  As stated before, Apache can be a prerequisite for other applications or, it may be where you serve your website(s) from.  Some important files are located on Apache’s default page; Here is a small snippet of those file locations:

apache file locations

There are multiple ways to set up Apache to specifically meet your needs.  As a Liquid Web customer, you’ll enjoy the 24/7/365 support along with knowledgeable technicians at your fingertips to answer any questions you may have!  Check out what we can do for you!

About the Author: Justin Palmer

Justin Palmer is a professional application developer with Liquid Web

Latest Articles

How to Install ESXi 5.x or 6.x in VMware

Read Article

How to Install ESXi 5.x or 6.x in VMware

Read Article

How to Install ESXi 5.x or 6.x in VMware

Read Article

PHP 7 vs PHP 8: A Comparison

Read Article

Managed Hosting vs Unmanaged VPS Hosting

Read Article