After a long-time Debian is finally released their latest built called Debian 10 Buster. As we collected some data about the latest build, it is clear that Debian 10 is featured rich with the latest stable software for a server. In this tutorial, we will see how to install LEMP (Linux, Nginx, MySQL, and PHP) stack on Debian 10, Buster.
Linode (aff. link) is one of the most trusted Cloud VPS Provider. I personally use their servers for most of my tasks and they are reliable enough to compete with others.
First, all we need is a Debian 10 clean server. Make sure nothing is pre-installed. To get started ssh into the server and access the root user.
Just to make sure everything is updated run following command.
Now we can move ahead to install our LEMP stack.
Nginx will be our web server and it is very easy to install.
apt install nginx -y
Install MariaDB (MySQL)
MariaDB is similar to MySQL but with better performance and stability.
apt install mariadb-client mariadb-server -y
Now we need to secure the default installation of MariaDB. Just run following command
mysql_secure_installation and follow the instructions.
Enter current password for root (enter for none): ⏎ - Hit Enter Set root password? [Y/n] ------------------------ Y Remove anonymous users? [Y/n] ------------------- Y Disallow root login remotely? [Y/n] ------------- Y Remove test database and access to it? [Y/n] ---- Y Reload privilege tables now? [Y/n] -------------- Y
We have successfully secured the database access from remote logins. It will be accessible from localhost only. In case you need one for remote logins then create a new user with root privileges and secure it with hard to guess password.
mariadb GRANT ALL PRIVILEGES ON . TO 'username'@'localhost' IDENTIFIED BY 'usersecret' WITH GRANT OPTION; exit
Just make sure you use a different username and a strong usersecret password.
Debian 10 released with latest PHP7.3 version which is the fastest version of itself. Here we will install PHP-FPM and some common and needed libraries too.
apt install php7.3-fpm php7.3-cli php7.3-common php7.3-curl php7.3-gd php7.3-mbstring php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-zip -y
By default, everything will be running without any issue. By any chance, if anything is not working then restart all the services once to make sure everything is running.
service mysql restart service php7.3-fpm restart service nginx restart
That is it. Your LEMP setup is complete on Debian 10.
Now you can use this setup as you want to. You can further install and setup phpMyAdmin, WordPress CMS or anything else.