LAMP

Set up LAMP(Linux, Apache, MySQL, PHP) Stack on Ubuntu 20.04

Set up LAMP(Linux, Apache, MySQL, PHP) Stack on Ubuntu 20.04

You might have just started building your dynamic web application in PHP, and you want to set up the LAMP Stack. LAMP term comes from the Linux Operating System, Apache server, MySQL database, and PHP language. Let's get started with the installation of LAMP Stack on Ubuntu 20.04.

First of all, you should have sudo privileges on your system or log in as a root to perform the following tasks:

Update the System's Package Repository

To get started with all the installation, it is the best practice to update the APT cache repository first so that all the latest applications can be installed smoothly.

$ sudo apt update


Once the apt-cache is updated, we are ready to move forward with the LAMP Stack installation.

Let's first install MySQL.

Install MySQL on Ubuntu 20.04

Since MySQL is mostly used as a database with PHP and used to manage and store data to install MySQL on your ubuntu system, type the command given below.

$ sudo apt install mysql-server mysql-client


It will ask you to take additional disk space for the package to install, so press “y” to continue installing MySQL.


Once MySQL is installed, check the version by typing this command.

$ mysql --version


And to check that MySQL's service is running or not on your ubuntu system, type this command to check the status.

$ sudo systemctl status mysql.service


If it is not active, you can start it by using the start keyword in the above command like this

$ sudo systemctl start mysql.service


To login to the MySQL's shell, type the following command

$ sudo mysql


It won't ask you for any password for the first time.

Once you log in to MySQL's shell, you can set up your password or perform any function related to the database in it.

Now let's exit through it and install the Apache 2 web server on the Ubuntu system.

mysql> exit

Install Apache Web Server on Ubuntu 20.04

Apache 2 is a web server that handles the servers for hosting web applications. To install Apache 2 on your ubuntu system, run this command.

$ sudo apt install apache2


It may also prompt for taking a grant of additional disk space for the Apache's installation, so press “y” to continue the installation process.

Once, Apache 2 web server is installed as well; you can check the status by typing the following command.

$ sudo systemctl status apache2


If it is active and running, then you are good to go with the installation of PHP; otherwise, start using the command

$ sudo systemctl start apache2


After starting it, let's install the PHP now,

Install PHP on Ubuntu 20.04

PHP's latest stable version can easily be installed on ubuntu from the APT package repository by typing the command given below in the terminal

$ sudo apt install php


Press “y” to continue the process if it prompts for taking additional disk space for installing PHP.

After the successful installation of PHP, you can check the version by typing the command

$ php --version


PHP version 7.3.4 is installed.

Install PHP Extensions

Now if you want to install some other basic PHP extension as well, which are required for the phpMyAdmin, For example,

You can do so by typing the following command.

$ sudo apt install php-curl php-gd php-mbstring php-mysql php-zip php-json php-xml


Allow it to take additional disk space for the extensions to install by typing “y” and hitting the “Enter” button.


This command will install all the required PHP extensions for running the phpMyAdmin.

So this is how you can install all the required packages on Ubuntu 20.04 and set up the LAMP Stack for building your dynamic web application.

Conclusion

This post contains the step by step guide to install and set up the LAMP stack on Ubuntu 20.04 LTS.

Gry How to Show FPS Counter in Linux Games
How to Show FPS Counter in Linux Games
Linux gaming got a major push when Valve announced Linux support for Steam client and their games in 2012. Since then, many AAA and indie games have m...
Gry How to download and Play Sid Meier's Civilization VI on Linux
How to download and Play Sid Meier's Civilization VI on Linux
Introduction to the game Civilization 6 is a modern take on the classic concept introduced in the series of the Age of Empires games. The idea was fai...
Gry How to Install and Play Doom on Linux
How to Install and Play Doom on Linux
Introduction to Doom The Doom Series originated in the 90s after the release of the original Doom. It was an instant hit and from that time onwards th...