{"id":8762,"date":"2020-07-11T10:02:37","date_gmt":"2020-07-11T14:02:37","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=8762"},"modified":"2021-12-04T07:54:53","modified_gmt":"2021-12-04T07:54:53","slug":"install-apache-mysql-php-ubuntu-20-04-lts","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/install-apache-mysql-php-ubuntu-20-04-lts\/","title":{"rendered":"How To Install Apache, MySQL, and PHP on Ubuntu 20.04 LTS"},"content":{"rendered":"\n

In this tutorial, we will be showing you how to set up a LAMP stack on an Ubuntu 20.04 server. LAMP is an acronym that represents the Linux operating system<\/a>, where we install an Apache web server with support for site data stored in a MySQL database, and dynamic content processed by PHP.<\/p>\n\n\n\n

A LAMP stack is therefore a group of open-source software that is typically installed and working together in order to enable a server to host dynamic database-driven websites and web<\/a> apps written in PHP<\/a>.<\/p>\n\n\n\n

Some components of the LAMP stack are interchangeable with other open-source software. For instance, Ubuntu<\/a> can be replaced with almost any other flavor of Linux<\/a> such as CentOS<\/a>, Redhat, Suse, Debian, Manjaro, and many others.<\/p>\n\n\n\n

The database component can work with MariaDB, PostgreSQL, and others as opposed to MySQL. The web server component can use the likes of Nginx instead of Apache.<\/p>\n\n\n\n

For brevity’s sake and for the purposes of having a complete tutorial, we will be sticking with Ubuntu 20.04, Apache, MySQL, and PHP. We will also be using the versions that come as the Linux server’s default package.<\/p>\n\n\n\n

Prerequisites<\/h2>\n\n\n\n

This tutorial assumes that you have an Ubuntu 20.04 server with a non-root sudo-enabled user account and a basic firewall. The steps in this tutorial can also work for Ubuntu 18.04 and prior versions to some extent.<\/p>\n\n\n\n

Step 1: Install Apache and Update the Firewall Configuration<\/h2>\n\n\n\n

Use Ubuntu’s package manager, apt to install Apache:<\/p>\n\n\n\n

$ sudo apt update\n$ sudo apt install apache2<\/code><\/pre>\n\n\n\n

Accept the installation prompts by pressing Y<\/strong>, then ENTER<\/strong>.<\/p>\n\n\n\n

Once the installation is finished, you will need to adjust your firewall configuration to allow HTTP traffic in and out of the server.<\/p>\n\n\n\n

Here we are using the UFW firewall. This firewall comes with convenient application profiles that you can use to allow and block certain protocols and ports. To list all currently available UFW application profiles, you can run the following command:<\/p>\n\n\n\n

$ sudo ufw app list<\/code><\/pre>\n\n\n\n

The output will look something similar to this:<\/p>\n\n\n\n

Available applications:\n  Apache\n  Apache Full\n  Apache Secure\n  OpenSSH<\/code><\/pre>\n\n\n\n

We are interested in the Apache<\/a> profiles. This is what each of the three Apache profiles means:<\/p>\n\n\n\n