The LOMP Stack is a popular software suite to deliver web applications. LOMP stands for Linux as the operating system, OpenLiteSpeed as the web server, MySQL/MariaDB as the database server, and PHP for the backend of applications.

The LOMP Stack provides flexibility and efficiency to build and deliver web applications. Also, each component of the LOMP Stack is free and open-source. It’s suitable for developers on local development or to deliver applications on server production.

In this tutorial, you will install the LOMP Stack (OpenLiteSpeed, MariaDB, and PHP) on the Debian 11 server. You will also learn how to set up the OpenLiteSpeed web server with PHP 8.x.

Prerequisites

To begin with this guide, you will need some following requirements:

  • One Debian 11 server.
  • A non-root user with sudo root privileges.
  • A domain name pointed to your server IP address.

Installing OpenLiteSpeed

In this first step, you will add the OpenLiteSpeed repository for the Debian system and install the OpenLiteSpeed web server.

The OpenLiteSpeed provides a bash script that allows you to set up the OpenLiteSpeed repository automatically on your system.

Run the following command to download the bash script and add the OpenLiteSpeed repository to your system.

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

As you can see in the following screenshot, the script will automatically detect the current operating system and add the OpenLiteSpeed repository and GPG key. And also, the repository is automatically refreshed.

<img alt="add openmlitespeed repo" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/1-add-openlitespeed-repo.png636bb07143554.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="625" loading="lazy" src="data:image/svg xml,” width=”750″>

Now install the OpenLiteSpeed web server via the apt command below. When prompted to confirm the installation, input y and press ENTER to proceed.

sudo apt install openlitespeed

<img alt="install openlitespeed" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/2-install-openlitespeed.png636bb0718adf5.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="375" loading="lazy" src="data:image/svg xml,” width=”726″>

After OpenLiteSpeed is installed, run the following systemctl command below to verify the OpenLiteSpeed service ‘lsws‘ and make sure the service is running.

sudo systemctl is-enabled lsws

sudo systemctl status lsws

You should see in the following screenshot the OpenLiteSpeed service ‘lsws‘ is enabled and will be run automatically at system boot. And the status of the lsws service is running.

<img alt="check openlitespeed" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/3-check-openlitespeed-service.png636bb071c273f.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="288" loading="lazy" src="data:image/svg xml,” width=”750″>

The default OpenLiteSpeed is running on port 8088. So, open your web browser and visit the server IP address followed by port 8088 (i.e: http://192.168.5.30:8088/) and you will see the default index.html page of the OpenLiteSpeed web server.

<img alt="openlitespeed index" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/4-openlitespeed-index.png636bb0720a5a5.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="408" loading="lazy" src="data:image/svg xml,” width=”750″>

Installing MariaDB Server

After you have installed the OpenLiteSpeed, you will now install and configure the MariaDB database server as part of the LOMP Stack. The default Debian repository provides the latest stable version of the MariaDB server, which is should be fine for production.

Run the following apt command to install the MariaDB database server. When prompted to confirm the installation, input y and press ENTER to proceed.

sudo apt install mariadb-server

<img alt="install mariadb" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/5-install-mariadb.png636bb072483e0.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="394" loading="lazy" src="data:image/svg xml,” width=”750″>

After MariaDB is installed, run the following command to verify the MariaDB service and make sure the service is running.

sudo systemctl is-enabled mariadb

sudo systemctl status mariadb

You will now receive the output like the following. The MariaDB service is enabled and will be run automatically at system boot. And the status of the MariaDB service is running.

<img alt="check mariadb" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/6-start-enable-mariadb.png636bb0728dc8f.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="189" loading="lazy" src="data:image/svg xml,” width=”750″>

At this point, the MariaDB database is running. Now you will be securing the MariaDB deployment via the command line ‘mysql_secure_installation’, which is provided by the MariaDB package.

Run the following command to start configuring the MariaDB server.

sudo mysql_secure_installation

You will now be asked about some of the MariaDB server configurations:

  • Change the root authentication method to unix_socket? Input n.
  • Change the MariaDB root password? Input Y to confirm, then input the new password for your MariaDB root user.
  • Remove the default database test? Input Y to confirm.
  • Disable the remote login for the root user? Input Y to confirm.
  • Remove the default anonymous user from the installation? Input Y to confirm.
  • Reload tables privileges to apply new changes? Input Y to confirm.

Now the MariaDB server deployment is finished and secured. You can now log in to your MariaDB server securely via the root user.

Installing PHP 8.0

To set up PHP with the OpenLiteSpeed web server, you must install PHP packages provided by the OpenLiteSpeed repository. The default OpenLiteSpeed repository provides multiple versions of PHP, including PHP 7.4, 8.0, and 8.1.

For this step, you will install PHP 8.0 and set it up with OpenLiteSpeed.

Run the following apt command to install PHP 8.0 from the OpenLiteSpeed repository. As you can see, the PHP package name for the OpenLiteSpeed begins with ‘lsphp80-package-name‘.

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

When prompted to confirm the installation, input y and press ENTER to proceed to the installation.

<img alt="install php" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/7-install-php.png636bb072cae96.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="347" loading="lazy" src="data:image/svg xml,” width=”750″>

Additionally, this will automatically install the PHP 7.4 version from the OpenLiteSpeed repository. The default PHP version of the current OpenLiteSpeed web server is PHP 7.4.

Now after PHP 8.0 is installed, 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 should receive an output that the PHP 8.0 is installed.

<img alt="check php" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/8-check-php.png636bb07310c68.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="212" loading="lazy" src="data:image/svg xml,” width=”694″>

You can also verify by using the following. This will check the default and enabled modules for PHP 8.0.

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

Setting up Admin User for OpenLiteSpeed

At this point, the LOMP Stack packages are now installed. Now you will be setting up your LOMP Stack installation.

At first, you will be setting up the administrator user for OpenLiteSpeed.

The OpenLiteSpeed web server provides an interactive administration dashboard that runs on the default port 7080. The OpenLiteSpeed administration dashboard allows you to set up an OpenLiteSpeed web server via a GUI or web browser.

Run the following command to start configuring the OpenLiteSpeed administrator user.

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

You will now be asked to set up the admin user for OpenLiteSpeed. The default user is ‘admin‘, but you can change it with your user.

After that, input the new password for the OpenLiteSpeed web server and repeat. Now the administrator user for OpenLiteSpeed is configured.

<img alt="setup admin" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/9-setup-admin.png636bb07341f46.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="331" loading="lazy" src="data:image/svg xml,” width=”720″>

Next, back to the web browser and visit the server IP address followed by the default admin port 7080 with HTTPS protocol (i.e: https://192.168.5.30:7080/).

You will see the OpenLiteSpeed administrator login page. Input the username and password, then click Login.

<img alt="opernlitepseed login page" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/10-login-openlitespeed.png636bb0738024e.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="696" loading="lazy" src="data:image/svg xml,” width=”702″>

If you are using the correct username and password, you should see the OpenLiteSpeed administration dashboard.

<img alt="openlitespeed admin dashboard" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/11-openlitespeed-admin-dashboard.png636bb0739bfb5.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="636" loading="lazy" src="data:image/svg xml,” width=”750″>

Running OpenLiteSpeed on HTTP Port 80

The default OpenLiteSpeed is running on port 8088. Now you will change the default HTTP port for the OpenLiteSpeed to port 80 via the OpenLiteSpeed administration dashboard.

Click the ‘Listener‘ menu on the left side and you will see the ‘Default‘ listener that running on port 8088.

<img alt="list of listener" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/12-setup-listener.png636bb073d3c4a.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="291" loading="lazy" src="data:image/svg xml,” width=”750″>

Click the zoom icon on the ‘Action‘ section to start modifying the ‘Default‘ listener.

Now click the edit button on the top right to modify the ‘Default‘ listener

<img alt="change listener default" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/13-change-listener-port.png636bb07420a2f.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="252" loading="lazy" src="data:image/svg xml,” width=”750″>

Change the default port to 80 and click the Save button.

<img alt="change listener to port 80" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/14-change-listener-to-80.png636bb07469b9e.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="556" loading="lazy" src="data:image/svg xml,” width=”750″>

Next, click the reload button to restart the OpenLiteSpeed web server and apply new changes.

<img alt="reload openlitespeed" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/17-reload-openlitespeed.png636bb07497123.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="129" loading="lazy" src="data:image/svg xml,” width=”599″>

After you click the reload button, you will be prompted for confirmation. So click OK to confirm and then the OpenLiteSpeed will be restarted and you will be redirected to the OpenLiteSpeed login page.

Now open a new tab on your web browser and visit the server IP address with the default HTTP port (i.e: http://192.168.5.30) – You should see the default index.html page of the OpenLiteSpeed web server.

<img alt="openlitespeed run port 80" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/19-openlitespeed-http.png636bb074df8e1.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="458" loading="lazy" src="data:image/svg xml,” width=”750″>

Setting up PHP 8.0 with OpenLiteSpeed

At this point, the default OpenLiteSpeed is running with PHP 7.4 automatically installed during the PHP installation. For this step, you will set up the PHP 8.0 with OpenLiteSpeed.

Click on the ‘Server Configuration‘ menu and select the ‘External App’ tab. And you should get the default external app ‘LiteSpeed SAPI App‘ that runs the default PHP version 7.4.

On the ‘Action‘ section, click the edit button to start modifying the external app.

<img alt="edit php configuration" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/15-setup-php-openlitespeed.png636bb075270b0.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="289" loading="lazy" src="data:image/svg xml,” width=”750″>

On the ‘Command‘ section, change the default PHP version to PHP 8.0 installation ‘lsphp80/bin/lsphp‘.

The starting point for the PHP binary path is ‘/usr/local/lsws‘. And you can verify the PHP 8.0 for OpenLiteSpeed is installed on the ‘/usr/local/lsws/lsphp80’ directory.

Click the Save button to confirm and save the changes.

<img alt="setup php 8" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/16-setup-php-8.png636bb075516b9.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="50" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="reload openlitespeed" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/17-reload-openlitespeed.png636bb07497123.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="129" loading="lazy" src="data:image/svg xml,” width=”599″>

Lastly, open a new tab on your web browser and visit the server IP address followed by the path ‘/phpinfo.php‘ (i.e: http://192.168.5.30/phpinfo.php).

You will see the PHPINFO page with details of your PHP installation – on top of the page you can see the current PHP version configured with OpenLiteSpeed is PHP 8.0.

<img alt="lomp stack phpinfo" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/11/echo/18-phpinfo.png636bb075be254.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="750" loading="lazy" src="data:image/svg xml,” width=”696″>

Conclusion

In this guide, you have installed the LOMP Stack (OpenLiteSpeed, MariaDB, and PHP) on a Debian 11 server. You also have learned how to secure MariaDB deployment and learned the basic configuration of PHP with the OpenLiteSpeed web server.

For the next, you may be interested in how to set up a virtual host on OpenLiteSpeed to deploy multiple PHP web applications or setting up the SSL on OpenLiteSpeed.