LAMP Stack Install on Ubuntu 20.04 LTS Example

Jul 18, 2022 . Admin

Hi Guys,

In this post, we will learn LAMP Stack Install on Ubuntu 20.04 LTS Example. I would like to show you How to Install LAMP Stack on Ubuntu 22.04?. This article goes in detailed on Installing the LAMP Stack on a Cloud Server with a Ubuntu. if you want to see example of The Perfect Server - Ubuntu LAMP 22.04 then you are a right place. follow bellow step for 4 Ways to Install LAMP on Ubuntu 22.04.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

Step 1: Install The Apache On Ubuntu

the PHP version which you want to install on Ubuntu 22.04 system.

$ sudo apt-get install apache2

PHP also installs Apache and its related modules on Ubuntu 22.04. However, you can still run the below-given command for confirmation:

$ sudo systemctl status apache2

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
   Active: active (running) since Sun 2018-12-31 05:18:45 PDT; 2min 30s ago
 Main PID: 3143 (apache2)
    Tasks: 55 (limit: 2321)

the Apache services using these below commands :

start Apache

$ sudo systemctl start apache2

Stop Apache

$ sudo systemctl stop apache2 

Restart Apache

$ sudo systemctl restart apache2

Disable Apache

$ sudo systemctl disable apache2
Step 2: Install MySQL on Ubuntu

To install MySQL, type in the following command:

$ sudo apt-get install mysql-server

the mysql_secure_installation utility runs. follow command and answer the few questions based on your environment requirements.

$ sudo mysql_secure_installation
Step 3: Install PHP 7.2 On Ubuntu

following the command to install PHP 7.2 version on ubuntu server:

$ sudo apt-get install php libapache2-mod-php php-mysql

Install PHP with Exetension

$ sudo apt-get install php7.2

See example below

$ sudo apt install php libapache2-mod-php php-opcache php-cli php-gd php-curl php-mysql
Step 3: Test PHP Version

the follow command to check the PHP version installed on your server :

$ php -v

Restart the Apache Web Server :

$ sudo systemctl restart apache2