OpenLiteSpeed is an open-source edition of the LiteSpeed web server developed by LiteSpeed Technologies. It can be installed on all major operating systems including, Debian, Ubuntu, Mac OS, FreeBSD, and many more. It provides a web-based control panel that allows you to configure and manage the web server via a web browser. It is a simple, lightweight, and high-performance HTTP server and can handle hundreds of thousands of concurrent connections.

In this tutorial, we will show you how to install OpenLiteSpeed on Ubuntu 22.04 server.

Requirements

  • A server running Ubuntu 22.04.
  • A root password is configured on your server.

Getting Started

Before starting, it is a good idea to update all your packages with the latest version. You can update them by running the following command:

apt-get update -y

apt-get upgrade -y

Once your packages are updated, restart your system to apply configuration changes.

Next, you will also need to install some required dependencies on your server. You can install all of them by running the following command:

apt-get install build-essential libexpat1-dev libgeoip-dev libpcre3-dev libudns-dev zlib1g-dev libssl-dev libxml2 libxml2-dev rcs libpng-dev libpng-dev openssl autoconf g   make openssl libssl-dev libcurl4-openssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libzip-dev libxml2-dev sqlite3 libsqlite3-dev libonig-dev

After the successfull installation, you can proceed to the next step.

Install OpenLiteSpeed on Ubuntu 22.04

By default, OpenLiteSpeed is not available in the Ubuntu 22.04 default repository. So, you will need to install OpenLiteSpeed from source.

First, download the latest version of OpenLiteSpeed with the following command:

wget https://openlitespeed.org/packages/openlitespeed-1.7.16.tgz

Once the download is completed, extract the downloaded file with the following command:

tar -xvzf openlitespeed-1.7.16.tgz

Next, change the directory to the OpenLiteSpeed directory and install OpenLiteSpeed with the following command:

cd openlitespeed

sh install.sh

Once the OpenLiteSpeed is installed, you should get the following output:

Created symlink /etc/systemd/system/openlitespeed.service → /lib/systemd/system/lshttpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/lshttpd.service → /lib/systemd/system/lshttpd.service.
[OK] lshttpd.service has been successfully installed!
-e Updating webcache manager, please waiting ...
Shared code library already meets minimum API version requirements.
Done!

-e Installation finished, Enjoy!

-e Your webAdmin password is Njg0Mzc0, written to file /usr/local/lsws/adminpasswd.

Set Up an Administrative Password for OpenLiteSpeed

After installing OpenLiteSpeed, you will need to set up the administrative password to access the OpenLiteSpeed web interface. You can do it with the following command:

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

Create admin user and set a password with the following command:

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

User name [admin]: admin

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

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

Next, start the OpenLiteSpeed web service with the following command:

systemctl start openlitespeed

You can also check the status of the OpenLiteSpeed with the following command:

systemctl status openlitespeed

You should see the following output:

? lshttpd.service - OpenLiteSpeed HTTP Server
     Loaded: loaded (/lib/systemd/system/lshttpd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-06-12 04:59:01 UTC; 4s ago
    Process: 21331 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
   Main PID: 21353 (litespeed)
     CGroup: /system.slice/lshttpd.service
             ??21353 "openlitespeed (lshttpd - main)"
             ??21358 "openlitespeed (lscgid)"
             ??21372 "openlitespeed (lshttpd - #01)"
             ??21373 lsphp "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

Jun 12 04:58:59 ubuntu systemd[1]: Starting OpenLiteSpeed HTTP Server...
Jun 12 04:58:59 ubuntu lswsctrl[21331]: [OK] litespeed: pid=21353.
Jun 12 04:59:01 ubuntu systemd[1]: Started OpenLiteSpeed HTTP Server.

OpenLiteSpeed is now running and listening on port 8088. You can check it with the following command:

ss -antpl | grep litespeed

You should see the following output:

LISTEN 0      4096         0.0.0.0:8088      0.0.0.0:*    users:(("litespeed",pid=21372,fd=23),("litespeed",pid=21353,fd=23))
LISTEN 0      4096         0.0.0.0:7080      0.0.0.0:*    users:(("litespeed",pid=21372,fd=21),("litespeed",pid=21353,fd=21))

Now, open your web browser and type the URL http://your-server-ip:8088. You will be redirected to the following page:

<img alt="OpenLiteSpeed installed" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/06/echo/p1.png62b07b726d262.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="386" loading="lazy" src="data:image/svg xml,” width=”750″>

Install MariaDB for OpenLiteSpeed

By default, MariaDB is available in the Ubuntu 22.04 default repository. You can install it by just running the following command:

apt-get install mariadb-server mariadb-client -y

Once the MariaDB is installed, start MariaDB and enable it to start after the system reboot with the following command:

systemctl start mariadb

systemctl enable mariadb

Next, you will need to secure your MariaDB installation. You can secure it by running the following script:

mysql_secure_installation

This script will set up the root password, Remove anonymous users, Disallow root login remotely and Remove test database.

mysql_secure_installation

Answer all the questions as shown below:Advertisement

    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

Once you have finished, you can proceed to the next step.

Install PHP for OpenLiteSpeed

By default, PHP is not available in the OpenLiteSpeed repository. So, you will need to compile PHP from OpenLiteSpeed web interface.

To access the OpenLiteSpeed admin panel, open your web browser and type the URL https://your-server-ip:7080. You should see the following page:

<img alt="OpenLiteSpeed login" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/06/echo/p2.png62b07b728ad3d.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="406" loading="lazy" src="data:image/svg xml,” width=”750″>

Now, provide your admin user name and password which you have created earlier and click on the Login button. You should see the OpenLiteSpeed dashboard in the following page:

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

Now, click on the Tools > Compile PHP, you should see the following page:

<img alt="Compile PHP" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/06/echo/p4.png62b07b72d8eee.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="365" loading="lazy" src="data:image/svg xml,” width=”750″>

Now, select the PHP version you want to install and click on the Next button. You should see the following page:

<img alt="PHP Build Options" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/06/echo/p6.png62b07b731ae0e.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="365" loading="lazy" src="data:image/svg xml,” width=”750″>

Now, choose the build options and click on the Next button to start downloading PHP. Once the process completed successfully, you should see the following page:

<img alt="PHP for OpenLiteSpeed Webserver" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/06/echo/p7.png62b07b734d594.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="339" loading="lazy" src="data:image/svg xml,” width=”750″>

Now, log in to your server from terminal and run the pre-generated script as shown below:

/usr/local/lsws/phpbuild/buildphp_manual_run.sh

This script will download and compile PHP and related modules to your system.

Conclusion

Congratulations! you have successfully installed and configured OpenLiteSpeed on Ubuntu 22.04 server. You can now easily create and manage your website from the OpenLiteSpeed web interface. For more information, you can visit the OpenLiteSpeed official documentation.