How to install Apache 2 on Ubuntu 20.04 (LAMP)

This tutorial will describe the installation of a traditional LAMP stack (Linux, Apache2, MySQL and PHP) on Ubuntu 20.04 using PHP FPM (FastCGI Process Manager), which is an alternative implementation of PHP that offers additional features like Adaptive process spawning.

SERVER-IP - Replace this with the ip number of your server
MYDB - Replace this with the name the database you will create in this tutorial
MYDBUSER - Replace this with the name the non-root username you will create for your database
MYDBROOTPASS - Replace this with the password you will use for the database root account.
MYDBUSERPASS - Replace this with a unique password you will create for MYDBUSER
MYAPPDATABASE - Replace this with a a name you will use for a sample database in this tutorial
MYAPPUSER - Replace this with a a username you will use to access the sample database in this tutorial
MYAPPPASS - Replace this with a unique password you will create for MYAPPUSER

Step 1 – Installing Apache

Apache web server debian packages are available under the default repositories. Login to your Ubuntu system with sudo privileges account. Open a terminal and execute the following commands:

$ sudo apt update & sudo apt upgrade -y
$ sudo apt install apache2 libapache2-mod-fcgid -y

Now we need to open ports for our web server in our UFW firewall. Port 80 for insecure traffic, and 443 for SSL traffic. We can do this by simply allowing "Apache Full"

$ sudo ufw allow "Apache Full"

Now open a web browser and see if Apache is working:

http://SERVER-IP

You should now see the default Apache Welcome Page: 05554c7e0f3f1dfeb3a2fabf8e684379b44e64c8-apachedefault




Blog Comments powered by Disqus.