LAMP stack is a popular web development platform that consists of Linux, Apache, MySQL, and PHP. However, there are alternative stacks that offer better performance and scalability. One such alternative is LOMP stack (OpenLiteSpeed, MariaDB, and PHP), which is a lightweight and high-performance web development platform. In this article, we will explain how to install LOMP stack on Debian 11.
First, we need to update the package index and upgrade the installed packages on our system. We can do this by running the following command:
apt-get update
apt-get upgrade
This will update the package index and upgrade the installed packages to their latest versions.
Next, we need to install the OpenLiteSpeed web server. OpenLiteSpeed is a high-performance and lightweight web server that is an alternative to Apache. We can install OpenLiteSpeed by running the following command:
apt-get install openlitespeed
This will install OpenLiteSpeed on our system. After the installation is complete, we can start the OpenLiteSpeed service by running the following command:
systemctl start openlitespeed
This will start the OpenLiteSpeed service.
Next, we need to install MariaDB, which is a popular open-source database management system. We can install MariaDB by running the following command:
apt-get install mariadb-server
This will install MariaDB on our system. After the installation is complete, we can start the MariaDB service by running the following command:
systemctl start mariadb
This will start the MariaDB service.
Next, we need to secure the MariaDB installation by running the mysql_secure_installation
script. This script will guide us through the process of setting a strong root password for MariaDB, disabling remote root access, and removing anonymous user accounts and test databases. We can run the mysql_secure_installation
script by running the following command:
mysql_secure_installation
This will start the mysql_secure_installation
script. Follow the on-screen instructions to secure the MariaDB installation.
After securing the MariaDB installation, we need to create a database and a user for our web application. We can do this by logging in to the MariaDB prompt and running the following commands:
mysql -u root -p
This will open the MariaDB prompt. At the prompt, we can run the following commands to create a database and a user:
CREATE DATABASE myapp;
GRANT ALL PRIVILEGES ON myapp.* TO 'myappuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
Replace myapp
with the name of your database, myappuser
with the name of your user, and password
with a strong password of your choice. This will create a database called myapp
and a user called myappuser
with the password that you specified.
To install the PHP packages with extensions provided by OpenLiteSpeed on a Debian 11 server, you will need to add the OpenLiteSpeed repository to your system and then install the openlitespeed-php-extras
package.
First, add the OpenLiteSpeed repository to your system by running the following commands:
wget -O - <https://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh> | bash
apt update
Next, you can install the openlitespeed-php-extras
package by running the following command:
apt-get install lsphp81 lsphp81-common lsphp81-curl lsphp81-mysql lsphp81-opcache lsphp81-imap lsphp81-opcache
This will install all of the necessary PHP packages provided by OpenLiteSpeed, including PHP 8.1, as well as additional PHP modules and extensions that may be useful for running a dynamic website or web application.
After the installation is complete, you will need to restart the OpenLiteSpeed service to enable the PHP module. You can do this by running the following command: systemctl restart openlitespeed
You can verify that PHP is working properly by creating a test PHP file in the OpenLiteSpeed document root (/usr/local/lsws/Example/html
by default) with the following content:
<?php
phpinfo();
You can then access the file in your web browser by visiting http://your-server-ip/test.php
. You should see a page with information about your PHP installation, including a list of the installed PHP modules and extensions.
That’s it! You have successfully installed LOMP stack (OpenLiteSpeed, MariaDB, and PHP) on Debian 11. You can now use this high-performance web development platform to create and deploy web applications.