How to Install LAMP in Ubuntu 20.04



LAMP basically refers to a stack of programs or software that function in Ubuntu system called Linux, Apache, MariaDB/MySQL, and PHP, all of these are free to use and open source, combined on a server ultimately allows them to host dynamic webpages. The operating system is Linux which represent the ‘L’, the web server is Apache which represent ‘A’, the database server is MariaDB/MySQL which represents ‘M’, and PHP is the server-side language of programming, which represents ‘P’, and it performs the task of generating interactive web pages.

Guide to install LAMP:

Following is a step by step guide on how you can install LAMP in Ubuntu 20.04;

Step 1; Open Command Line Interface:

  • The basic and very first step of installing the LAMP in Ubuntu is opening the Command line interface, which can simply be done by pressing ‘Ctrl + Alt + T’ buttons on keyboard together.
  • After opening CLI, enter the following command;

  • There might be ‘password required’ pop up on your screen after this, the password is required to authenticate the action, it is a small opportunity. Enter the password and command will then put into action.

Step 2; updating available software packages:

  • It is advisable and a great practice for the software packages to be updated before the installation of the LAMP into your system because this step makes sure that you are looking at the latest available versions of programs/apps/software in the system.
  • To do so enter the following commands into the system.

Step 3: Install Apache 2, a web server:

  • Now you should start by installing Apache2, and to install Apache Web server, use the command below in the Command Line interface.
  • By hitting ‘y’, then ‘Enter,’ you may authorize the download.

  • After the installation is complete, Apache2 will be functioning already by default, but to make sure that the Apache2 is yet functioning properly or not, you can check the status of Apache2 by giving the system command.
  • If it is not functioning properly, you can enable it by giving the ‘enable Apache2’ command.

Step 4; Install the MySQL database server:

  • MySQL is a well-known open source program that is indeed utilized widely in order to maintain massive quantities of content i.e. data in practically any program or application installed in the system.
  • Now it is time for you to install MySQL server into your system, to do so you should enter the following command in the system.

  • Type ‘Y’, hit “enter’.
  • The installation will begin shortly.
  • After the completion of installation of the MySQL server on the Ubuntu, the server will be ready to run but might require the password.
  • Because by default, the MySQL package on Ubuntu utilizes auth_socket to authenticate user login, this essentially implies that you can login into MySQL interface using merely the OS’s id and passcode and are not required to put the exact MySQL root passcode into the system. To do that enter the following command in the system.

  • By now, MySQL server should be up and running by default but you can check its status too just to make sure, to check the status, enter the command of ‘systemctl status mysql’ into the system and wait for the output, the output will show you the status of MySQL server.
  • If you want to create a new User id, you should enter the following commands one by one.
  • Provide a new user name and the password.

Step 5; installation of Hypertext Preprocessor (PHP) 7.4:

  • PHP 7.4 is a good version with the best efficient performance and is very reliable and dependable to be installed in Ubuntu 20.04 version as compared to the previous ones.
  • PHP 7.4 and all other PHP collections are essential to download as they work the best with Apache 2 that you have already downloaded.
  • To download the PHP 7.4 on your Ubuntu, you must enter the following few mentioned commands in your system.
  • After entering the command, press ‘y’, then ‘Enter,’ you may validate the download.

  • Configure and reboot the webserver after enabling the apache modifications to interact with php7. And to do so, enter the following few commands.

  • PHP code can be executed in one of two different ways through the Apache web server, and these are; PHP module of Apache and PHP-FPM. You have learned to install and run the Apache module of the PHP.


The LAMP server has been fully installed and running in your system by now. There are few customization options like Changing the following i.e. user, owner of the web directory, the RAM, virtual host settings etc. but that is not included in this guide, as it could confuse the users, as it merely focuses on the installation of the LAMP on the Ubuntu system.

Similar Posts