Search
Close this search box.

How to Install LOMP Stack on Debian 11

Table of Contents

In this guide, we will walk you through the steps to install the LOMP stack on Debian 11. The LOMP stack, which stands for Linux, OpenLiteSpeed, MySQL/MariaDB, and PHP, is a powerful and efficient setup for serving dynamic web applications. OpenLiteSpeed is a lightweight, high-performance web server that works seamlessly with PHP, while MySQL/MariaDB serves as the robust database backend.


Debian 11 provides a stable and secure foundation for this stack, ensuring optimal performance and reliability for your applications.

Whether you are setting up a new server or looking to switch to OpenLiteSpeed for its speed and ease of use, this guide will provide you with the necessary steps and commands to get your LOMP stack up and running. By the end of this tutorial, you will have a fully functional server ready to host your PHP applications with the efficiency and scalability of OpenLiteSpeed and the reliability of MariaDB.



To start, make sure you’ve created a VPSie account if you haven’t already. Next, proceed by deploying an Debian 11 server configured to meet your specific needs.

Once the server is deployed, SSH into the command line interface. Before installing any packages, it’s essential to update your system’s package list to ensure you have access to the latest versions. Open a terminal and run the following command:

 

sudo apt-get update -y

Install OpenLiteSpeed

OpenLiteSpeed provides a bash script that simplifies setting up its repository on your system. Run the following command to download and execute the script, which will add the OpenLiteSpeed repository to your system:

wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | bash


Now, install the OpenLiteSpeed web server using the following apt command:

sudo apt install openlitespeed -y


Run the following systemctl command to verify the OpenLiteSpeed service:

sudo systemctl is-enabled lsws
sudo systemctl status lsws


Now the installation is successfull, you can open your web browser and visit the server’s IP address followed by port 8088 (e.g., http://192.168.5.30:8088). You should see the default index.html page of the OpenLiteSpeed web server.

Install MySQL/MariaDB

You can choose between MySQL or MariaDB. We’ll use MariaDB for this guide. Install MariaDB by running:

sudo apt install mariadb-server mariadb-client -y

 

Secure the installation:

sudo mysql_secure_installation

 

Follow the prompts as shown below:

Enter current password for root (enter for none):
Set root password? [Y/n]: N
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

 

Start and enable MariaDB with:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Install PHP

OpenLiteSpeed uses its own PHP build called LSAPI. We’ll install PHP 8.1 along with common extensions.

sudo apt install lsphp80 lsphp80-common lsphp80-mysql lsphp80-dev lsphp80-curl

 

Run the following command to ensure that the PHP 8.0 is installed on your system. The PHP installation directory for OpenLiteSpeed is available at the ‘/usr/local/lsws’ directory.

/usr/local/lsws/lsphp80/bin/php8.0 -v

You can change the admin password (if not already done):

sudo /usr/local/lsws/admin/misc/admpass.sh

Configure OpenLiteSpeed to Use PHP 8.0

Now we need to configure OpenLiteSpeed to Use PHP 8.0, Access the OpenLiteSpeed WebAdmin console by navigating to http://<your_server_ip>:7080 and Login using the Admin User credentials.

 

At this point, OpenLiteSpeed is running with PHP 7.4, which was automatically installed during the PHP installation.

 

Navigate to the ‘Server Configuration‘ menu and select the ‘External App‘ tab. Here, you will see the default external app ‘LiteSpeed SAPI App‘ configured to run PHP version 7.4.

  1. Navigate to the ‘Action‘ section.
  2. Click the edit button.
  3. In the ‘Command‘ section, set the default PHP version to PHP 8.0 by specifying ‘lsphp80/bin/lsphp‘.

Now, click the reload button to restart OpenLiteSpeed and apply the new changes.

Finally, open a new tab in your web browser and navigate to your server’s IP address followed by ‘/phpinfo.php‘ (e.g., http://<server-ip>/phpinfo.php).

 

This will display the PHPINFO page, showing detailed information about your PHP installation.

 

 

In conclusion, setting up the LOMP stack on Debian 11 provides a robust platform for hosting web applications with Linux, Nginx, MariaDB, and PHP. By following these steps, you can efficiently deploy and manage a secure and performant server environment tailored to your development needs.

Make a Comment
Share on
Facebook
Twitter
LinkedIn
Print
VPSie Cloud service

Fast and Secure Cloud VPS Service

Try FREE
For a month

The First 1 orders gets free discount today! Try Sign up on VPSie to get a chance to get the discount.