LAMP (Debian Installation)
Linux, Apache, MariaDB/MySQL, and PHP/Perl

LAMP stands for Linux, Apache, MySQL, and PHP/Python/Perl. It is a popular open-source software stack used for web development.

In the LAMP stack, Linux is the operating system, Apache is the web server software, MySQL is the relational database management system, and PHP/Python/Perl are the programming languages for dynamic web content. Apache serves web pages and handles HTTP requests, MySQL manages the database where data is stored and retrieved, while PHP/Python/Perl are used to develop dynamic web applications and interact with the database.  Together, LAMP provides a powerful and scalable environment for hosting and developing web applications, with Linux as the foundation, Apache as the web server, MySQL as the database, and PHP/Python/Perl as the programming languages to build dynamic websites.

Single line command to fresh Installation   Apache (Webserver) , PHP, PHP modules for Apache, MySQL Server & PhpMyAdmin

sudo apt update && sudo apt install apache2 php libapache2-mod-php phpmyadmin php-mbstring php-zip php-gd php-json php-curl php-mysql mysql-server -y && sudo service apache2 restart && sudo systemctl enable apache2 && sudo ufw app info "Apache Full" && sudo ln -sf /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf && sudo a2enconf phpmyadmin && sudo service apache2 restart && echo '<?php phpinfo(); ?>' | sudo tee /var/www/html/info.php && sudo chmod -R 755 /var/www/html && sudo find /var/www/html -type f -exec chmod 644 {} \;

Please note above command automatically created a php.info page on /var/www/html and also creates a symbolic link between the configuration file of phpMyAdmin and the Apache web server configuration directory and give the proper file and directory permission.

Click here for Break Down details.

Single line command to for Uninstall of Apache (Web Server) , PHP, PHP modules for Apache, MySQL Server & PhpMyAdmin

sudo apt purge apache2 php libapache2-mod-php php-mysql mysql-server -y && sudo apt remove --purge '^php*' -y mysql-server mysql-client phpmyadmin && sudo apt autoremove --purge -y


Below command is show that the package is there or not.

php -v && mysql -V && apache2 -v && sudo dpkg -s phpmyadmin | grep Version

The command "sudo mysql" is used to start the MySQL command-line interface with administrative privileges.
sudo mysql

You will get mysql prompt 

mysql>

CREATE USER 'lalatendu'@'LOCALHOST' IDENTIFIED WITH CACHING_SHA2_PASSWORD BY 'Your-Password-Here' ;

ALTER USER 'lalatendu'@'LOCALHOST' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY 'Your-Password-Here' ;

GRANT ALL PRIVILEGES ON *.* TO 'lalatendu'@'LOCALHOST' WITH GRANT OPTION ;


SHOW DATABASES ;

CREATE DATABASE lalatendu ;

USE lalatendu  ;

SELECT DATABASE();  [To check the currently selected database in MySQL]

SHOW TABLES ;


DROP TABLE IF EXISTS USER;

CREATE TABLE USER (

  id INT PRIMARY KEY,

  name VARCHAR(50),

  email VARCHAR(100),

  phone VARCHAR(20)

);


DESCRIBE `USER`;


To add a new table named "lalatendu" in the currently selected database, you can use the CREATE TABLE statement. Here's an example:


CREATE TABLE lalatendu (

  id INT PRIMARY KEY,

  name VARCHAR(50),

  email VARCHAR(100)

);


In this example, a new table named "lalatendu" is created with three columns: "id" of type INT as the primary key, "name" of type VARCHAR(50), and "email" of type VARCHAR(100). Modify the column definitions according to your requirements. After executing the CREATE TABLE statement, the "lalatendu" table will be created in the currently selected database. You can use the SHOW TABLES; command to verify that the new table has been added.


DESCRIBE `lalatendu`;

SHOW DATABASES;

USE mysql ;

SELECT User FROM mysql.user;