# How to Install Linux, Apache, MySQL and PHP (LAMP) on a Ubuntu 20.04 Cloud Server

> URL: https://www.atlantic.net/vps-hosting/how-to-install-linux-apache-mysql-php-lamp-ubuntu-20-04/ | Published: 2015-05-15 | Updated: 2025-03-06 | Author: Alexander Wise

##### Verified and Tested 06/12/2021

### Introduction

In this How-To, we install LAMP on an Ubuntu 20.04 Cloud Server. LAMP is a simple software bundle of 4 components, Linux, Apache, MySQL, and PHP. **L**inux is the platform’s core; in this case, we are using Ubuntu 20.04 LTS. **A**pache is the webserver; most of the web servers globally are running Apache **M**ySQL, a database management system developed by Oracle. **P**HP is an extremely popular programming language widely used in web development. Altogether this forms LAMP or LAMP stack.

### Prerequisites

A server with Ubuntu 20.04  installed. Get a reliable VPS from Atlantic.Net if you do not have one.

## Installing LAMP on Ubuntu 20.04

Before we begin the installation, your system must be up to date; you can do so with the following command:

```
apt-get update
```

Once updating, we can get to the first step of making a LAMP stack by installing Apache.

## Installing Apache on Ubuntu 20.04

Install Apache by running the following command:

```
apt-get install apache2
```

Hit enter when it asks, “Do you want to continue?” during the install.

After the install, you can check to see if Apache is running by running the command:

```
systemctl status apache2
```

Also, you can verify if all is working by opening your browser and going to http://youripaddress

If you do not know your IP address, you can run the following command:

```
ip addr show eth0
```

In our case, we would put http://69.87.216.72 in your browser’s address bar and get the following page:

![The default page for Apache on Ubuntu 14.04](https://www.atlantic.net/wp-content/uploads/2018/01/linux2.png)

The default page for Apache on Ubuntu 20.04

## Installing MySQL on Ubuntu 20.04

Install MySQL with the following command:

```
sudo apt-get install mysql-server libapache2-mod-php php-mysql
```

After installing MySQL server, secure the MySQL server with the following command:

```
mysql_secure_installation
```

Note: You will be prompted with a series of questions. Just type N for the change root password and Y for yes on all of the rest; see the screenshot below:

![An example of what mysql_secure_installation looks like](https://www.atlantic.net/wp-content/uploads/2018/01/linux5.png)

An example of what mysql_secure_installation looks like

Verify that MySQL is running with the following command:

```
systemctl status mysql
```

## Installing PHP on Ubuntu 20.04

Install PHP with the following command:

```
apt-get install php
```

Create a test PHP file called info.php in /var/www/html/. In this how-to, we will be using the text editor nano with the following command:

```
nano /var/www/html/info.php
```

Insert the following code in the text editor, then save and exit:

```
<?php
phpinfo();
?>
```

Since we made changes, we need to restart Apache so that the changes take effect:

```
systemctl restart apache2
```

Test your page in your browser with the following hyperlink changed with your IP address:

http: //youripaddress/info.php

![Display PHP information](https://www.atlantic.net/wp-content/uploads/2015/05/p2-1024x619.png)

Congratulations! You have just installed LAMP on your Ubuntu 20.04 Server. Thank you for following this How-To on installing LAMP; please check back for more updates.

Learn more about our [VPS hosting](https://www.atlantic.net/vps-hosting/) services and [VPS hosting price](https://www.atlantic.net/vps-hosting/pricing/).
