Install the Apache web server:
sudo apt update
sudo apt install apache2
Verify that Apache is working:
sudo systemctl status apache2
Install PHP and required modules:
sudo apt install libapache2-mod-php8.1 php8.1-mysql php8.1-curl -y
Restart Apache to apply changes:
sudo systemctl restart apache2
Create a PHP info file:
sudo nano /var/www/html/phpinfo.php
Add the following content:
<?php
phpinfo();
?>
Access http://localhost/phpinfo.php in your browser. you must see informations about php
Install MySQL server and client:
sudo apt install mysql-server mysql-client
Restart MySQL:
sudo systemctl restart mysql
Install phpMyAdmin:
sudo apt install phpmyadmin
Restart Apache:
sudo systemctl restart apache2
Edit the Apache configuration file:
sudo nano /etc/apache2/apache2.conf
Add the following line at the end to include phpMyAdmin configuration:
Include /etc/phpmyadmin/apache.conf
Restart Apache:
sudo systemctl restart apache2
Restart MySQL to apply changes:
sudo systemctl restart mysql
sudo mysql
Press enter
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
Access http://localhost/phpmyadmin in your browser. Log in with your MySQL credentials to start managing your databases.