GitHub! Installs LAMP PHP 8 MariaDB 10 Composer on Linux

This article will guide you how to install LAMP with packages PHP 8.1.10, MariaDB 10.7.5 , Apache 2.4, and Composer 2.4.1 on Ubuntu Linux 20.04 to 22.04 which is a Debian derivative. LAMP stands for Linux, Apache, MySQL or MariaDB and PHP so this is an application package or the term stack to meet the needs of web-based application development. Previously we also wrote about LEMP or LNMP (Linux, Nginx, MySQL or MariaDB, and PHP) on Linux .

What is LAMP Stack

Understanding the LAMP stack is a stack or application package consisting of a combination of software packages – Linux, Apache, MariaDB and PHP. You can use LAMP for testing or in a production environment to build web applications using PHP frameworks like Laravel or Yii, or content management systems like WordPress, Drupal, or Joomla.

You may be wondering what is the difference between LAMP and LEMP stack. Well, the only difference is the web servers included – namely Apache (in LAMP) and Nginx (in LEMP or LNMP). Both web servers are quite good and although Apache is the most used, Nginx is on the rise and is predicted to be Apache’s big rival.

Another widely used application that is usually installed alongside the LAMP stack is PhpMyAdmin – which is a  Data Base Management System  (DBMS) is a PHP web based tool for managing MySQL/MariaDB database servers from a web browser.

In this article, you will find out how to install and configure the LAMP  stack  with PhpMyAdmin on Debian Linux or its derivatives such as Ubuntu, Linux Mint, and MX Linux.

Installing LAMP Ubuntu 20.04 – 22.04

LAMP is a Linux-based bash script for installing Apache + PHP + MySQL/MariaDB and so on. You may install Apache + PHP + MySQL / MariaDB very easily; you simply need to select the components you wish to install prior to installation. And everything will be completed within a few minutes.

See also  How to Install Sublime Text Linux Latest + Shortcut

Supported Distros

  • Amazon Linux 2
  • AlmaLinux 8 (recommend)
  • AlmaLinux 9
  • CentOS 7
  • CentOS Stream 8
  • CentOS Stream 9
  • Rocky Linux 8 (recommend)
  • Rocky Linux 9
  • Debian 9
  • Debian 10
  • Debian 11 (recommend)
  • Ubuntu 18.04
  • Ubuntu 20.04 (recommended)
  • Ubuntu 22.04

Application and Module Packages

  • Apache-2.4 (Include HTTP/2 module: nghttp2, mod_http2)
  • Apache Additional Modules: mod_wsgi, mod_security, mod_jk
  • MySQL-5.7, MySQL-8.0, MariaDB-10.3, MariaDB-10.4, MariaDB-10.5, MariaDB-10.6, MariaDB-10.7
  • PHP-7.4, PHP-8.0, PHP-8.1
  • PHP Additional extensions: Zend OPcache, ionCube Loader, PDFlib, APCu, imagick, libsodium, memcached, redis, mongodb, swoole, yaf, yar, msgpack, psr, phalcon, grpc, xdebug
  • Other Software: OpenSSL, ImageMagick, Memcached, phpMyAdmin, Adminer, Redis, re2c, KodExplorer

Installing LAMP

We can use Teddysun’s Github, just run the following commands to start the LAMP stack installation on any supported Linux distro. The following is for Debian distros and derivatives including Ubuntu and MX Linux:

git clone
cd lamp
chmod 755 *.sh
sudo ./

The command will copy the LAMP installer code from Github to the local computer, then install it. At the time of installation, you will be asked what version to install. For example, please see the following options:

-------------------------- apache setting ---------------------------

1. httpd-2.4.54
2. do_not_install

which apache you'd select (default httpd-2.4.54): 1

your selection: httpd-2.4.54

-------------------------- apache_modules install --------------------------

1. mod_wsgi-4.9.3
2. mod_security-2.9.5
3. mod_jk-1.2.48
4. do_not_install

Please input one or more number between 1 and 4 (default do_not_install) (for example: 1 2 3): 4

your selection: do_not_install

-------------------------- mysql setting ---------------------------

1. mysql-5.7.39
2. mysql-8.0.30
3. mariadb-10.3.36
4. mariadb-10.4.26
5. mariadb-10.5.17
6. mariadb-10.6.9
7. mariadb-10.7.5
8. do_not_install

which mysql you'd select (default mysql-5.7.39): 7

your selection: mariadb-10.7.5

mariadb data location(default:/usr/local/mariadb/data, leave blank for default): 

mariadb data location: /usr/local/mariadb/data

mariadb server root password (, leave blank for default): 

mariadb server root password:

-------------------------- php setting ---------------------------

1. php-7.4.30
2. php-8.0.23
3. php-8.1.10
4. do_not_install

which php you'd select (default php-7.4.30): 8

-------------------------- php setting ---------------------------

1. php-7.4.30
2. php-8.0.23
3. php-8.1.10
4. do_not_install

Input error, please input a number between 1 and 4: 3

your selection: php-8.1.10

php-8.1.10 available modules:

-------------------------- php_modules install --------------------------

1. pdflib-10.0.0p1
2. apcu-5.1.21
3. imagick-3.7.0
4. redis-5.3.7
5. mongodb-1.13.0
6. swoole-4.8.11
7. yaf-3.3.5
8. yar-2.3.2
9. grpc-1.45.0
10. xdebug-3.1.3
11. do_not_install

Please input one or more number between 1 and 11 (default do_not_install) (for example: 1 2 3): 11

The code above is a summary of what you chose and determined earlier. Press any key to continue the installation process and wait for it to finish. When finished, my friend can access localhost, it will look like this:

Localhost display after installing LAMP
Localhost display after installing LAMP
Localhost display after installing LAMP
Localhost display after installing LAMP

How to Install Composer

For composer, it can be done after LAMP installation. The latest Composer installation process can be monitored via the official composer website. Or use the command below in Terminal :

php -r "copy('', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer

The composer installer command above will check some php.ini settings, give a warning if the settings are incorrect, and then download the latest composer.phar into the current directory. The 4 (four) lines above will do the following:

  • Download composer installer into current directory
  • Perform the composer installer process and generate composer.phar
  • Uninstalling (setup file)
  • Moved composer.phar into a directory in Linux PATH, so you just call composer from any directory (Global installation).
See also  SQLite Studio - The SQLite Database Browser for Linux

Configuration Location

Just find the settings or configuration file through the following path:

  • Apache
  • Location install Apache: /usr/local/apache
  • Where to save the website: /data/www/default
  • Apache configuration: /usr/local/apache/conf/httpd.conf
  • PHPMyAdmin, Adminer, KodExplorer
  • Lokasi install PHPMyAdmin: /data/www/default/phpmyadmin
  • Location install Adminer: /data/www/default/adminer.php
  • KodExplorer install location: /data/www/default/kod
  • PHP
  • PHP installation location: /usr/local/php
  • PHP configuration: /usr/local/php/etc/php.ini
  • MySQL
  • Lokasi install MariaDB: /usr/local/mariadb
  • Where to save the database: /usr/local/mariadb/data
  • MySQL configuration: /etc/my.cnf

Review LAMP Stack

After the installation of the LAMP stack is complete, you can begin developing web apps or simply testing with the Apache and MariaDB services. It is widely used, and system administrators are strongly encouraged to learn more about it.

LAMP Stack, often known as the LAMP software stack, is a collection of technologies that can be used to provide dynamic web pages and web applications. The term “LAMP” describes the Linux operating system and the Apache web server. The backend data is stored in a MariaDB database, and PHP is used for dynamic processing.