How To Install LAMP Stack on Debian 10
Abstract: we will install the Apache web server. Update the package repository index. sudo apt update Install Apache server package using the apt command. sudo
LAMP Stack stands for Linux, Apache, MariaDB, and PHP stack. These four popular open source software components are used by most of the web hosting companies, web developers, blogs, and others to host websites.
Install LAMP Stack Install LinuxFollow the Step by Step installation of Debian 10 or Upgrading Debian 9 Stretch to Debian 10 Buster to have Debian OS.
Now, we will proceed to the install Apache v2.4, PHP v7.3, MariaDB v10.3 on Debian 10.
Install ApacheFirst, we will install the Apache web server.
Update the package repository index.
sudo apt update
Install Apache server package using the apt
command.
sudo apt install -y apache2 apache2-utils
Check the status of the Apache server.
sudo systemctl status apache2Install LAMP Stack on Debian 10 – Apache Web Server Service Status
We will now test the Apache web server to check if it is working correctly or not.
Open up a web browser and then go to the following URL.
http://localhost/OR
http://your-ip-add-ress/You will get the 「Apache2 Debian Default Page「. This page confirms that the Apache server is working fine.
Install LAMP Stack on Debian 10 – Apache2 Default PageApache HTTP server’s default document root is /var/www/html/
on Debian and the main configuration file is /etc/apache2/apache2.conf
. Additional configuration files are found in the /etc/apache2
directory.
MariaDB is the popular database server and it is the drop in replacement of MySQL server, developed by the original developers of MySQL.
Install MariaDB server using the following command
sudo apt install -y mariadb-server mariadb-client
Check the status of MariaDB service.
sudo systemctl status mariadbInstall LAMP Stack on Debian 10 – MariaDB Service Status
Run the mysql_secure_installation
command to improve the security of your MariaDB installation.
sudo mysql_secure_installation
READ: How to Secure MariaDB installation using mysql_secure_installation
Install PHPBy default Apache server supports the .html documents only, not PHP. To support PHP, you need to install PHP and the PHP extension package for MariaDB to connect the database.
sudo apt install -y php php-mysql libapache2-mod-php
You would need to restart the Apache server after the installation of the PHP package.
sudo systemctl restart apache2Test LAMP Stack
To test a PHP 7.3, we will place a .php file on the default document root of Apache server.
The output will display lots of useful details about our PHP installation, such as the installed PHP version, PHP extension details.
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
Now open a web browser and go to the following URL.
http://localhost/info.phpOR
http://your-ip-add-ress/info.phpThe page will look like below,
Install LAMP Stack On Debian 10 – PHP InformationYou can also see MariaDB support for PHP.
Install LAMP Stack on Debian 10 – PHP MariaDB Support ConclusionYou have successfully installed the LAMP Stack on Debian 10. Please share your feedback in the comments section.