How to Install OpenLiteSpeed on Ubuntu Linux

laptop 5822575 640
laptop 5822575 640

This post shows students and new users the steps to install and use the OpenLiteSpeed web server on Ubuntu Linux. OpenLiteSpeed is an open-source web server developed by LiteSpeed Technology. It is designed to be lightweight and comes with an admin panel to manage the server easily from your favorite web browsers.

The admin portal installed with OpenLiteSpeed makes it easier for new users and students to manage the server. One can configure advanced web server settings from the admin portal, manage users’ permissions, and restart services.

The steps below will also show you how to install MariaDB, and PHP8.0 to enable you to create a dynamic website that can run popular open-source content management systems, like WordPress, Joomla, and Drupal.

If you’re looking for an alternative to popular webservers like Apache and Nginx, OpenLiteSpeed should be considered.

To get started with installing OpenLiteSpeed on Ubuntu Linux, follow the steps below:

How to install OpenLiteSpeed on Ubuntu from the repository

You can build and compile OpenLiteSpeed server packages on Ubuntu Linux. However, the easiest way to get it installed on Ubuntu Linux is to add its repository, then install it from there. When you add the repository, new updates will automatically be made available to the system.

To add the repository, run the commands below:

wget -O - | sudo bash

The above command will also import the OpenLiteSpeed GPG key to Ubuntu and activate it. You can then run the commands below to install OpenLiteSpeed.

sudo apt update
sudo apt install openlitespeed

After installing OpenLiteSpeed, the commands below can be used to stop, start and enable OpenLiteSpeed services to automatically startup when the server boots.

sudo systemctl stop lshttpd
sudo systemctl start lshttpd
sudo systemctl enable lshttpd

To see if the OpenLiteSpeed service is running, run the commands below.

sudo systemctl status lshttpd

That should output similar lines as shown below:

lshttpd.service - OpenLiteSpeed HTTP Server
     Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-09-11 17:43:24 CDT; 13s ago
   Main PID: 5773 (litespeed)
     CGroup: /system.slice/lshttpd.service
             ├─5773 openlitespeed (lshttpd - main)
             ├─5783 openlitespeed (lscgid)
             ├─5813 openlitespeed (lshttpd - #01)
             └─5814 lsphp

Sep 11 17:43:22 ubuntu2004 systemd[1]: Starting OpenLiteSpeed HTTP Server.
Sep 11 17:43:22 ubuntu2004 lswsctrl[5745]: [OK] litespeed: pid=5773.

How to configure OpenLiteSpeed on Ubuntu Linux

Once OpenLiteSpeed is installed, it is automatically assigned port 8088. Port 80 is the default port for the web server, so we’ll want to change OpenLiteSpeed to listen on port 80 instead.

To do that, run the commands below to open its configuration file.

sudo nano /usr/local/lsws/conf/httpd_config.conf

Then look for the lines below and change the highlighted port from 8088 to 80.

listener Default{
    address                  *:80
    secure                   0
    map                      Example *

Save your changes and exit.

Restart OpenLiteSpeed by running the commands below.

sudo systemctl restart lshttpd

Now open your browser and browse to the server hostname or IP address. That should open the OpenLiteSpeed default web server welcome page.


With the default port changed to 80, run the commands below to set up the administrator password which will be used to log on to the OpenLiteSpeed admin panel.

sudo /usr/local/lsws/admin/misc/

When you run the command above, it will prompt you to type in the admin username and create a password. The default username is admin. Leave blank to use it.

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: 

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Retype password: 
Administrator's username/password is updated successfully!

The admin panel can be accessed using the link below:


Login using the admin login details above.

How to install PHP 8.0 support for OpenLiteSpeed

When you install OpenLiteSpeed, it also installs a version of PHP that is not the latest. If you want the latest version of PHP, you can install it separately.

As of this writing, the latest version of PHP is 8.0. Run the commands below to install it.

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

To make OpenLiteSpeed use PHP 8.0, log on to the admin panel, then go to Server Configuration -> External App, and click the + button to add a new external app.

When prompted to choose the type of app you want to add, choose LiteSpeed SAPI App. Then click Next (arrow).

On the PHP configuration settings, use these recommended values:

Name: lsphp8.0
Address: uds://tmp/lshttpd/lsphp80.sock
Max Connections: 10
Environment: PHP_LSAPI_CHILDREN=10
Initial Request Timeout (secs): 60
Retry Timeout (secs): 0
Persistent Connection: Yes
Response Buffering: No
Command: lsphp80/bin/lsphp
Backlog: 100
Instances: 1
Priority: 0
Memory Soft Limit (bytes): 2047M
Memory Hard Limit (bytes): 2047M
Process Soft Limit: 1400
Process Hard Limit: 1500

Save your changes.

Next, go to Server Configuration ==> Script Handler and click Edit under Actions to edit the existing handler.

Then choose the new PHP 8.0 handler created above and save.

Restart the server, then go to the server name or IP address followed by /phpinfo.php.


PHP 8.0 is now the default handler.

How to install MariaDB on Ubuntu Linux

MariaDB is fast, secure and the default server for almost all Linux servers. To install MariaDB, run the commands below:

sudo apt install mariadb-server
sudo apt install mariadb-client

After installing MariaDB, the commands below can stop, start and enable MariaDB services to start up when the server boots.

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Next, run the commands below to secure the database server with a root password if you were not prompted to do so during the installation.

sudo mysql_secure_installation

When prompted, use the guide below to answer:

If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): PRESS ENTER

Switch to unix_socket authentication [Y/n] n

Change the 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

All done!

To verify and validate that MariaDB is installed and working, log in to the database console using the commands below:

sudo mysql -u root -p

You should automatically be logged in to the database server since we initiated the login request as root. Only the root can log in without a password and from the server console.

mariadb welcome

The server was successfully installed if you see a similar screen as shown above.

That should do it!


This post showed you how to install OpenLiteSpeed with support for PHP 8.0 and MariaDB. Please use the comment form below if you find any errors above or have something to add.

Posted by
Richard W

I love computers; maybe way too much. What I learned I try to share at

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: