Install LAMP Stack on System KALI Linux Version 2022.2
Published: 2022-06-07 17:47:19

#linux #software #kali_Linux

## Install LAMP Stack on System KALI Linux Version 2022.2

A LAMP Stack is a set of open-source software that can be used to create websites and web applications.
LAMP is an acronym, and these stacks typically consist of:

* Linux operating system.
* Apache HTTP server.
* MySQL relational database management system.
* PHP programming language.
* PhpMyAdmin

" note important " ==> { Install the LAMP stack on Kali Linux is different from Ubuntu } .

** Please Focus Step by step **

1. _Update System_.
sudo apt update && sudo apt full upgrade -y

2. _install php , mysql server ,apache2_
sudo apt -y install wget php php-cgi php-mysqli php-pear php-mbstring libapache2-mod-php php-common php-phpseclib php-mysql

3. _install phpMyAdmin last version_
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
tar xvf phpMyAdmin-5.0.4-all-languages.tar.gz

** now add commands configuration files **

* sudo mv phpMyAdmin-*/ /usr/share/phpmyadmin
* sudo mkdir -p /var/lib/phpmyadmin/tmp
* sudo chown -R www-data:www-data /var/lib/phpmyadmin
* sudo mkdir /etc/phpmyadmin/
* sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
* sudo nano /usr/share/phpmyadmin/config.inc.php
* $cfg['blowfish_secret'] = 'H2TxcGXxflSd8JwrXVlh6KW4s2rER63i';
* $cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';
* sudo nano /etc/apache2/conf-enabled/phpmyadmin.conf

* add commands in file
########################################

Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
<IfModule mod_php5.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
php_admin_value mbstring.func_overload 0
</IfModule>
<IfModule mod_php.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
php_admin_value mbstring.func_overload 0
</IfModule>
</Directory>
# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
<IfModule mod_authz_core.c>
<IfModule mod_authn_file.c>
AuthType Basic
AuthName "phpMyAdmin Setup"
AuthUserFile /etc/phpmyadmin/htpasswd.setup
</IfModule>
Require valid-user
</IfModule>
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Require all denied
</Directory>
########################################

* sudo systemctl restart apache2
* systemctl status apache2
* sudo mysql -u root
* systemctl restart mysql
* CREATE USER 'admin'@'%' IDENTIFIED BY 'admin4321';
* GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
* CREATE DATABASE database_name ;
* EXIT;
* now login in PhpMyAdmin :
http://localhost/phpmyadmin/index.php

                        ***** Done *****