How To Install Apache Web Server on Ubuntu 18.04 LTS
July 17, 2022
On this short tutorial, we will learn how to install Apache Web Server on Ubuntu 18.04 LTS operating system.
When we have our own business, especially small and medium enterprises (SMEs), having our own website is a strategic decision in developing our business in the future. Because our products will be easily recognized by our customers or potential customers, that way we have a great opportunity with a minimum budget to market or promote our products. Without having to have expert level knowledge, we can start building our website using open source applications that are already available on the internet. To create our own website, we need a web server that can provide services for our website management.
The function of web server is to display our website’s content by storing, processing and delivering webpages to users. Usually, the web server uses the HTTP (Hyper Text Transfer Protocol) as an exchange of data between the client (users) and our server. Besides HTTP, web servers also support SMTP (Simple Mail Transfer Protocol) and FTP (File Transfer Protocol) used for email, file transfer and storage. Apache is very popular web server. It is used by various groups around the world. From small companies to enterprise level. Well, in this article, we will discuss how to install Apache Web Server on the Ubuntu 18.04 LTS operating system.
Apache Web Server Installation
Before we start the installation, there are prerequisites that must be met. Some of the basic requirements that must be met including :
An Ubuntu 18.04 system with sufficient disk space
non-root user with sudo privileges configured on your server.
Good internet connection to download repository/source files.
The Apache web server installation process will be explained in detail in the sub-chapters below.
Installing Apache Web Server
Apache Web Server Process Management
Installing Apache Web Server
By default Apache Web server has been included on Ubuntu 18.04 LTS repository. The first step, we will begin by updating the local package index to reflect the latest version.
1. Update Ubuntu 18.04 LTS Repository
Updating Ubuntu system by submitting command line :
After updating system is completed done, the next step is to install Apache Web Server by submitting command line :
# apt install apache2
The output will be shown below :
root@ubuntu:~# apt install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
0 upgraded, 8 newly installed, 0 to remove and 29 not upgraded.
Need to get 1,604 kB of archives.
After this operation, 6,493 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libapr1 amd64 1.6.3-2 [90.9 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1 amd64 1.6.1-2 [84.4 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1-dbd-sqlite3 amd64 1.6.1-2 [10.6 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1-ldap amd64 1.6.1-2 [8,764 B]
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-bin amd64 2.4.29-1ubuntu4.11 [1,071 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-utils amd64 2.4.29-1ubuntu4.11 [83.9 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-data all 2.4.29-1ubuntu4.11 [160 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2 amd64 2.4.29-1ubuntu4.11 [95.1 kB]
Fetched 1,604 kB in 25s (64.9 kB/s)
Selecting previously unselected package libapr1:amd64.
3 Verifying Apache Web Server Version
After installation was finished, then we will verity Apache version by submitting command line :
# apache2 -version
root@ubuntu:~# apache2 -version
Server version: Apache/2.4.29 (Ubuntu)
Server built: 2019-09-16T12:58:48
After Apache Web server installation was completed done, then we have to allow outside access to the default web ports. For this purpose we have to modify the firewall setting on our system, it has been provided a tools called as UFW. We can list the ufw application profiles by typing :
# ufw app list
output of this command line is shown below :
root@ubuntu:~# ufw app list
From the output, we can discover if there are three profiles type for Apache on this environment, namely :
Apache: This profile opens only port 80 (normal, unencrypted web traffic)
Apache Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
Apache Secure: This profile opens only port 443 (TLS/SSL encrypted traffic)
Mostly, we have to enable Apache profiles to serve outside connection to our Apache Web Server service, by submitting command line :