{"id":3676,"date":"2019-07-18T23:31:05","date_gmt":"2019-07-18T20:31:05","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3676"},"modified":"2024-03-12T07:33:24","modified_gmt":"2024-03-12T04:33:24","slug":"install-lemp-stack-on-debian-10-buster","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-lemp-stack-on-debian-10-buster\/","title":{"rendered":"Install LEMP Stack on Debian 10 Buster"},"content":{"rendered":"\n

This guide is about how to install LEMP<\/a> Stack on Debian 10 Buster. LEMP stack is an acronym for the commonly used web application and deployment component; Linux, ENginx<\/a>, MySQL<\/a>\/MariaDB<\/a> and PHP<\/a>.<\/p>\n\n\n\n

Installing LEMP Stack on Debian 10 Buster<\/h2>\n\n\n\n

The first component of the LEMP stack is Linux Operating System, which is in this case is the Debian 10 Buster. If you have not set it up already, see the link below on how to install Debian 10 Buster on VirtualBox.<\/p>\n\n\n\n

Install Debian 10 Buster on VirtualBox<\/a><\/p>\n\n\n\n

Install Nginx on Debian 10 Buster<\/h3>\n\n\n\n

To install Nginx on Debian 10 Buster, just run the command below;<\/p>\n\n\n\n

apt install nginx<\/code><\/pre>\n\n\n\n

To check if Nginx is working, see our link on Installing Nginx on Debian 10 Buster.<\/p>\n\n\n\n

Install Nginx on Debian 10 Buster<\/a><\/p>\n\n\n\n

Install MySQL\/MariaDB on Debian 10 Buster<\/h3>\n\n\n\n

In this guide, we are going to use MariaDB 10. To install MariaDB, run the command below;<\/p>\n\n\n\n

apt install mariadb-server mariadb-client<\/code><\/pre>\n\n\n\n

This installs MariaDB 10.3. If you need to install MariaDB 10.4 instead, see our guide below.<\/p>\n\n\n\n

Install MariaDB 10 on Debian 10 Buster<\/a><\/p>\n\n\n\n

When installed, MariaDB is started and enabled to run on system boot.<\/p>\n\n\n\n

systemctl status mariadb<\/code><\/pre>\n\n\n\n
\n\u25cf mariadb.service - MariaDB 10.3.15 database server\n   Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\n   Active: active (running) since Thu 2019-07-18 15:31:35 EDT; 9min ago\n     Docs: man:mysqld(8)\n           https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Main PID: 2356 (mysqld)\n   Status: \"Taking your SQL requests now...\"\n    Tasks: 31 (limit: 1150)\n   Memory: 76.4M\n   CGroup: \/system.slice\/mariadb.service\n           \u2514\u25002356 \/usr\/sbin\/mysqld\n<\/code><\/pre>\n\n\n\n
systemctl is-enabled mariadb\nenabled<\/code><\/pre>\n\n\n\n

MariaDB initial Security<\/h3>\n\n\n\n

By default, MariaDB uses unix_socket plugin<\/strong> for authentication and thus, it doesn’t require password to login. You can simply run mysql<\/strong> or mysql -u root<\/strong> to login to MariaDB server.<\/p>\n\n\n\n

mysql<\/code><\/pre>\n\n\n\n
\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 48\nServer version: 10.3.15-MariaDB-1 Debian 10\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nMariaDB [(none)]>\n<\/code><\/pre>\n\n\n\n

The unix_socket<\/code> authentication plugin also allows the user to use operating system credentials when connecting to MariaDB via the local Unix socket file.<\/p>\n\n\n\n

To enable password based authentication, login to MariaDB and run the commands below;<\/p>\n\n\n\n

ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;\nSET PASSWORD = PASSWORD('Str0nGPass');\nflush privileges;\nquit<\/code><\/pre>\n\n\n\n

When you now try to login as root, you will be prompted for password.<\/p>\n\n\n\n

mysql -u root -p\nEnter password: <\/code><\/pre>\n\n\n\n

Read more about MariaDB unix socket authentication plugin<\/a>.<\/p>\n\n\n\n

You can also run the mysql_secure_installation<\/strong> script to remove MariaDB test databases, anonymous users and disallow remote root login. To run the script, just run the command below<\/p>\n\n\n\n

mysql_secure_installation<\/code><\/pre>\n\n\n\n

Install PHP 7.3 on Debian 10 Buster<\/h3>\n\n\n\n

PHP 7.3 is available on the default Debian 10 Buster repos. Hence, execute the command below to install PHP and PHP Apache and MySQL\/MariaDB extensions.<\/p>\n\n\n\n

apt install php php-fpm php-mysql<\/code><\/pre>\n\n\n\n

Configure Nginx for PHP Processing<\/h3>\n\n\n\n

For Nginx to process PHP pages, you need to include index.php<\/strong> as a value for the index<\/strong> parameter. Since we are using the default configuration for testing, edit the it as follows;<\/p>\n\n\n\n

vim \/etc\/nginx\/sites-enabled\/default<\/code><\/pre>\n\n\n\n
...\n        root \/var\/www\/html;\n\n        # Add index.php to the list if you are using PHP\n        index index.php index.html index.htm index.nginx-debian.html;\n...<\/code><\/pre>\n\n\n\n

Also, you need to configure Nginx to pass PHP scripts to FastCGI server. Uncomment the line location ~ \\.php$<\/code> and configure it as shown below<\/p>\n\n\n\n

        location ~ \\.php$ {\n                include snippets\/fastcgi-php.conf;\n                fastcgi_pass unix:\/run\/php\/php7.3-fpm.sock;\n        }<\/code><\/pre>\n\n\n\n

Test Nginx configuration<\/p>\n\n\n\n

nginx -t\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/code><\/pre>\n\n\n\n

Restart Nginx and FastCGI process manager.<\/p>\n\n\n\n

systemctl restart  nginx php7.3-fpm<\/code><\/pre>\n\n\n\n

Test PHP Processing<\/h3>\n\n\n\n

To test PHP processing, create a PHP test page under the Apache web root directory, usually, \/var\/www\/html<\/strong>, with the following content.<\/p>\n\n\n\n

vim \/var\/www\/html\/test.php<\/code><\/pre>\n\n\n\n
<?php phpinfo();<\/code><\/pre>\n\n\n\n

To test PHP processing, navigate to the browser and enter the address;<\/p>\n\n\n\n

http:\/\/<server-IP>\/test.php<\/code><\/pre>\n\n\n
\n
\"Install<\/a><\/figure><\/div>\n\n\n

Remove the PHP test page once done.<\/p>\n\n\n\n

rm -rf \/var\/www\/html\/test.php<\/code><\/pre>\n\n\n\n

Well, that is all on how to install LEMP Stack on Debian 10 Buster.<\/p>\n\n\n\n

Related Tutorials;<\/h3>\n\n\n\n

Install LAMP Stack with MariaDB 10 on Debian 10 Buster<\/a><\/p>\n\n\n\n

Install LAMP Stack on Fedora 30<\/a><\/p>\n\n\n\n

Install LAMP Stack on Debian 9<\/a><\/p>\n\n\n\n

How To Install LAMP (Linux, Apache, MySQL, PHP) Stack on Fedora 28\/29<\/a><\/p>\n\n\n\n

How to Install LAMP Stack (Apache,MariaDB, PHP 7.2) on Ubuntu 18.04 LTS<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

This guide is about how to install LEMP Stack on Debian 10 Buster. LEMP stack is an acronym for the commonly used web application and<\/p>\n","protected":false},"author":1,"featured_media":12497,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,235,928],"tags":[1039,5001,1010,970,229],"class_list":["post-3676","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-lemp-stack","category-mariadb","tag-debian-10-buster","tag-install-lemp-stack-on-debian-10","tag-lemp-stack","tag-mariadb-10-3","tag-nginx","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3676"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=3676"}],"version-history":[{"count":8,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3676\/revisions"}],"predecessor-version":[{"id":21172,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3676\/revisions\/21172"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12497"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=3676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=3676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=3676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}