ubuntu logo

Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server.

Spread the love

Here is how to install LAMP on freshly installed Ubuntu 20.04 Server. A guide to installing Ubuntu 20.04 Server can be found HERE.

The original post that was followed can be found HERE.

Install LAMP on Ubuntu 20.04:

The first step is to Install Apache2 and update the firewall to allow access to Apache2.

Before we install Apache2 update apt by running

$ sudo apt update
How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 1

Install apache2 by running

$ sudo apt install apache2
How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 2

Type Y and enter to start the install

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 3

Apache2 will be installed:

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 4

Once finished apt will return to the command prompt

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 5

Connect to your server from a broswer to test apache2 is working. You will see the follwoing displayed if it is:

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 6

Next install MySql by running the following command:

$ sudo apt install mysql-server
How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 7

When prompted type Y tand enter to install MySql

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 8

MySql will now be installed

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 9

Once installed the installer will return to the command prompt

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 10

Secure the MySql installation by running the following command

$ sudo mysql_secure_installation
How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 11

Type y and enter to setup validate passwords:

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 12

Choose the level of password security required

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 13

Enter a new STRONG password for the root user and press enter

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 14

Re-enter the password

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 15

Press y for yes to continue

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 16

Press enter to select y to remove anonymous users:

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 17

Answer y to disallow root logins remotely and press enter to continue

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 18

Type y to remove test database and access to it

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 19

Press y to reload the privilege tables

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 20

This completes the securing of MySql

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 21

New install and configure PHP by running the following command:

$ sudo apt install php libapache2-mod-php php-mysql
How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 22

Select y to install PHP and its pre-requisites

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 23

PHP will be installed

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 24

The installer will return to the command line once it has finished

How to install LAMP on freshly installed Ubuntu 20.04 Server.
Ubuntu 20.04: Install LAMP on freshly installed Ubuntu 20.04 Server. 25

This completes the LAMP stack setup.

Now that you have successfully installed LAMP on Ubuntu 20.04 server take a look at installing other apps that utilize the LAMP stack HERE.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top