Install Apache, PHP and MySQL on Ubuntu 20.04 (Focal Fossa)

By Darío Rivera
Posted On in Ubuntu

Ubuntu is one of the most popular Linux versions in the market for its ease of use and interoperability. If you are a web developer or need to configure a project developed in PHP with Apache and MySQL, this tutorial will guide you step by step until you configure the necessary packages for this purpose in the Focal Fossa version of this operating system.

You can see this same tutorial for other versions of Ubuntu in the following links:
- Install Apache, PHP and MySQL on Ubuntu 22.04 (Jammy Jellyfish)


The first step is to install the packages for the web server and the php language.

sudo apt-get install apache2 php

Subsequently, we can install the MySQL server with the following command.

sudo apt-get install mysql-server

Once this is done, the next step will be to make the installation secure. This means making some configurations such as verifying created passwords (length, special characters, uppercase and lowercase), removing anonymous users, disabling remote login and deleting test databases. To do this, you can use the following command and follow the instructions.

sudo mysql_secure_installation

And that's it, you can now log in. Don't forget to check out our post Terminal Connection with MySQL to see the different options to connect.


Once Apache, PHP, and MySQL are installed, it is convenient to make some configurations. To see a complete configuration of Apache from scratch, you can follow the following link.

Configure Apache from Scratch on Linux

Acerca de Darío Rivera


Application Architect at Elentra Corp . Quality developer and passionate learner with 10+ years of experience in web technologies. Creator of EasyHttp , an standard way to consume HTTP Clients.

LinkedIn Twitter Instagram

Sólo aquellos que han alcanzado el éxito saben que siempre estuvo a un paso del momento en que pensaron renunciar.