How to Install LAMP Stack on Debian 10

Install LAMP Stack on Debian 10

In this article, we will have explained the necessary steps to install and configure LAMP on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

LAMP is a complete package to run any web application on a server. LAMP stands for Linux, Apache, MariaDB, and PHP stack. Apache is used as the web server for hosting of an application whereas MySQL/MariaDB is used as systematic data storage of application and PHP is popular server-side scripting language which is used for web development as well bridging the gap between application and the database.

Install LAMP Stack on Debian

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

Step 2. Install Apache.

Apache Web server packages are available on Debian 10 official repositories. All that’s needed is execution of install command with sudo:

After completion of the above command, Apache is installed on your system. Run the following command to check apache service status:

You can also start, stop, restart and get the status of Apache web server using the following systemctl commands:

Confirm Apache build and version:

Step 3. Install MariaDB.

MariaDB is a relational database management system forked from MySQL. It is free and Open source. Install MariaDB server using the following command:

Once MariaDB installed, it is recommended to run the following security script that will remove some insecure default settings and disable access to your database system:

Install LAMP Stack on Debian 10

To create a database and grant your users permissions to use databases, run:

Step 4. Install PHP 7.3.

At the the time of this writing, PHP7.3 is the latest stable version of PHP and has minor performance improvement over previous versions. To install the PHP package, run the following command:

Enable the Apache php7.3 module then restart Apache Web server:

One can get a list of all PHP modules using the combination of apt-cache command and grep command:

Confirm your PHP version:

Step 5. Testing PHP

Now you should create info.php file to test php to do so type following:

Then open the following link in your web browser and we will be able to see all the information about PHP and its other configurations: http://your-domain/phpinfo.php (replacing your IP address with the one above).

Congratulation, you have learned how to install and configure LAMP on Debian 10 Buster. If you have any question, please leave a comment below.