Welcome Demo
If you want to use MariaDB instead of MySQL in your LAMP stack on Debian, follow the steps below:
Step 1: Install Debian
Step 2: Update the System
sudo apt update
sudo apt upgrade
Step 3: Install Apache Web Server
Install Apache using the package manager:
sudo apt install apache2
Start the Apache service and enable it to start on boot:
sudo systemctl start apache2
sudo systemctl enable apache2
Step 4: Install MariaDB Database Server
Install MariaDB server and client packages:
sudo apt install mariadb-server mariadb-client
During the installation, you will be prompted to set the root password for MariaDB. Choose a strong password and remember it.
Start the MariaDB service and enable it to start on boot:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Secure your MariaDB installation by running the security script:
sudo mysql_secure_installation
Step 5: Install PHP
Install PHP and necessary modules:
sudo apt install php libapache2-mod-php php-mysql
After installation, restart Apache for the PHP module to be loaded:
sudo systemctl restart apache2
Step 6: Test PHP
Create a PHP info file to check if PHP is working correctly:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/phpinfo.php
Open a web browser and access http://your_server_ip/phpinfo.php
. You should see the PHP info page displaying various PHP configuration details.
Step 7: Configure Firewall (Optional)
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
Step 8: Optional Steps
That's it! With these steps, you have now set up a LAMP server using Debian with MariaDB as the database server. You can proceed to deploy web applications or host websites on your server. Remember to keep your system and software up-to-date and maintain security best practices.