Atlantic.Net Blog

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

Editorial Team
by Atlantic.Net (268 posts) under VPS Hosting
Verified and Tested 06/12/2021


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. Linux is the platform’s core; in this case, we are using Ubuntu 20.04 LTS. Apache is the webserver; most of the web servers globally are running Apache MySQL, a database management system developed by Oracle. PHP is an extremely popular programming language widely used in web development. Altogether this forms LAMP or LAMP stack.



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
Display IP address

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

The default page for Apache on Ubuntu 14.04

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:


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

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:


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

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 services and VPS hosting price.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

How to Set Up Kubernetes Cluster Using Minikube on Arch Linux
How to Install Jenkins on Arch Linux
Which Compliance Standards Require an IPS?
Install Netdata Monitoring Tool on Arch Linux
How to Install Vue.js on Arch Linux

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Garland, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4


London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom