How To Install OpenLiteSpeed on Ubuntu 20.04 LTS (Focal Fossa)

DigitalOcean Referral Badge
Start your VPS now with FREE $100 credit.

In today’s guide we will guide you on how to install and configure OpenLiteSpeed web server on Ubuntu 20.04 LTS (Focal Fossa). OpenLiteSpeed is a high-performance, lightweight, free and open source HTTP web server which actively developed and maintenanced by LiteSpeed Technologies Inc. It’s actualy free and open-source edition of LiteSpeed Web Server Enterprise (LSWS), so you can use, modify, and distribute it freely without at any costs. OpenLiteSpeed is released under GPLv3 license and it’s currently developed and maintained directly by the same engineer team behind LiteSpeed Web Server Enterprise (LSWS). So you will get the same high-quality coding standard as you found on LSWS.

LiteSpeed Web Server have been know for a long time in the web hosting industry for its high-performance and compability with Apache mod_rewrite module. But, if you want to use LiteSpeed you must spend money to buy the license and it’s not cheap since it will depend on how many CPU or vCPU (proccessor) used by your machine. Well, OpenLiteSpeed Web Server (OLSWS) come to the web hosting and cloud computing industry with their commitment to support the Open Source software community. Almost all of the essential features on LiteSpeed Web Server Enterprise (LSWS) can be found on OpenLiteSpeed.

The following are essential features found on the OpenLiteSpeed:

* Event-Driven Architecture
OpenLiteSpeed utilize Event driven processes, less overhead, and enormous scalability. Keep your existing server hardware.

* Understands Apache Rewrite Rules
Apart from that, just like the LiteSpeed web server, OpenLiteSpeed is also mod_rewrite compatible without new syntax to learn. Continue to use your existing .htacess rewrite rules. It means OpenLiteSpeed can read Apache Rewrite Rules via .htaccess file as well.

* Friendly Admin Interfaces
There is built-in WebAdmin GUI (Graphical User Interface) on the OpenLiteSpeed. In addition, OLSWS is also offering Control Panel support. OpenLiteSpeed is compatible with some of the most popular control panels, including CyberPanel, DirectAdmin, and RunCloud. So, if you want to use and run OpenLiteSpeed with a Control Panel you can use above control panels.

* Built for Speed and Security
OpenLiteSpeed is build with Anti-DDoS connection features, bandwidth throttling, ModSecurity v3 integration, and much more.

* Intelligent Cache Acceleration
There is also Built-in full-page cache module, it’s highly-customizable and efficient for an exceptional user experience.

* PageSpeed Optimization
OpenLiteSpeed automatically implement Google’s PageSpeed optimization system with the Apache mod_pagespeed module. So you will get better website speed experience.

READ:  How To Install Jenkins on Ubuntu 20.04 LTS (Focal Fossa)

* PHP LiteSpeed SAPI
OpenLiteSpeed built-in with PHP LiteSpeed SAPI a.k.a LSAPI. It’s Native SAPI for PHP which allows external applications written in PHP to run up to 50% faster rather than using other PHP handler like cgi, fcgi and suphp.

* One-Click Installation
The developer at LiteSpeed provides single one-click installation method to Install OpenLiteSpeed, MariaDB and WordPress on various operating systems.

* WordPress Acceleration with LSCache
Similar to the LiteSpeed Web Server Enterprise (LSWS), there is a measurable performance improvement on the OpenLiteSpeed with LSCache module which available for WordPress-based websites.

Friendly Open-Source Package

OpenLiteSpeed is bundled in a one friendly open-source software package which combine speed, scalability, optimization, security and simplicity. OpenLiteSpeed support the following Linux-based operating system:

1.) RedHat Enterprise Linux and its derivatives, icluding CentOS, CloudLinux, Oracle Linux, AlmaLinux, and RockyLinux.
2.) Debian and Ubuntu-based distros (Debian 7, 8, 9, 10 and Ubuntu 14.04, 16.04, 18.04, and 20.04).

So, before installing and configuring OpenLiteSpeed on your machine, make sure to meet the following requirement.

PREREQUISITES:

* VPS, Cloud, or Bare-Metal Server
* Laptop or Desktop PC if you want to run OpenLiteSpeed on Localhost
* Running under Operating System Ubuntu 20.04 LTS (Focal Fossa)
* Server IPv4 Address with Superuser Privileges (Root Access)
* Gnome Terminal for Linux Desktop with GUI
* PuTTy SSH Client for Windows or Mac
* Powershell for Windows 10/11

1.) Add LiteSpeed Repositories to your System

Actualy there are many ways to bring OpenLiteSpeed web server on your Ubuntu 20.04 machine. LiteSpeed developer provide some methods to install OpenLiteSpeed on Linux machine, including:

Install using LiteSpeed Repositories
Install with Pre-Complied Binary
1-Click Install (OLS, PHP, MySQL, WP and LSCache on DigitalOcean)
1-Click WordPress Installation
Install with CyberPanel
Build from Source code as Non-Root User
Build from Source with Build Script for OLS 1.6 and above
Build from Source Code for version 1.5 or lower

Well, on this tutorial we will install OpenLiteSpeed using LiteSpeed repository. We can use the following software repository which support Debian and Ubuntu-based distros, including Debian 7/8/9/10 and Ubuntu 14.04/16.04/18.04/20.04 LTS (Focal Fossa).

$ wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash

2.) Install OpenLiteSpeed

After that you can using the following command to installs the latest stable release of OpenLiteSpeed web server (OLSWS). Don’t forget to run system update first on your machine to get the latest stable available software and package from the official OS vendors repository.

READ:  Migrate from MySQL 8.0 to MariaDB 10.6 on Ubuntu 20.04 LTS (Focal Fossa)

A.) Run System Update

$ apt update -y

B.) Install OpenLiteSpeed

$ apt install openlitespeed

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
enchant libc-client2007e libenchant1c2a libonig5 libzip5 lsphp74
lsphp74-common lsphp74-imap lsphp74-json lsphp74-mysql lsphp74-opcache
mlock php-common php-readline php7.4-common php7.4-readline rcs
Suggested packages:
uw-mailutils libenchant-voikko php-pear php-user-cache
The following NEW packages will be installed:
enchant libc-client2007e libenchant1c2a libonig5 libzip5 lsphp74
lsphp74-common lsphp74-imap lsphp74-json lsphp74-mysql lsphp74-opcache
mlock openlitespeed php-common php-readline php7.4-common php7.4-readline
rcs
0 upgraded, 18 newly installed, 0 to remove and 22 not upgraded.
Need to get 19.3 MB of archives.
After this operation, 88.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

3.) Install Specific Version of OpenLiteSpeed

Apart from that, you can also install specific version of OpenLiteSpeed web server. Simply install it with specify version numbers like this:

$ apt install openlitespeed-1.6.20

PLEASE NOTE: It will install OpenLiteSpeed version 1.6.20, so make sure to change the version number with your preffered OLSWS version number you want to install on your Ubuntu machine. Apart from that, the OpenLiteSpeed packages in LiteSpeed repositories include OpenSSL library, since it needed to run SPDY.

4.) Install PHP 8.1

The current stable release of PHP branches include PHP 7.4, PHP 8.0 and PHP 8.1. Well, we will stick to PHP 8.1 as the current latest stable release of PHP: Hypertext Preprocessor which have Active Support until 25 November 2023 (in 1 year, 6 months) and Security Support until 25 November 2024 (in 2 years, 6 months).

You can run the following commands to install PHP 8.1 on your OpenLiteSpeed web server using LiteSpeed repository. It will include all commonly-used packages and its PHP extensions, then force OpenLiteSpeed to use this PHP version.

A.) Install PHP 8.1

$ apt install lsphp81 lsphp81-common lsphp81-curl lsphp81-mysql lsphp81-opcache lsphp81-imap lsphp81-opcache

B.) Let’s Create Symbolic Link (Symlink) or Hard Link

Simply run the following command to create a symbolic link (symlink) from “bin” directory into “fcgi-bin” directory.

ln -sf /usr/local/lsws/lsphp81/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5

PLEASE NOTE: You can also install another PHP version on OpenLiteSpeed like PHP 8.0 or PHP 7.4. Simply replace lsphp81 with other version PHP numbers.

5.) Start, Stop, Restart and Check Status of the OpenLiteSpeed Web Server

You can run the following command to start, stop, restart or check status of the OpenLiteSpeed Web Server services.

READ:  How To Install MariaDB 10.6 Database Server on Ubuntu 20.04 LTS (Focal Fossa)

To Start OpenLiteSpeed services

$ systemctl start lsws

To Stop OpenLiteSpeed services

$ systemctl stop lsws

To Restart OpenLiteSpeed services

$ systemctl restart lsws

To Check Status of OpenLiteSpeed services

$ systemctl status lsws
● lshttpd.service - OpenLiteSpeed HTTP Server
Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2022-04-28 21:24:36 WIB; 11s ago
Process: 386731 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
Main PID: 386750 (litespeed)
CGroup: /system.slice/lshttpd.service
├─386750 openlitespeed (lshttpd - main)
├─386753 openlitespeed (lscgid)
├─386754 openlitespeed (lshttpd - #01)
├─386755 openlitespeed (lshttpd - #02)
├─386756 openlitespeed (lshttpd - #03)
├─386757 openlitespeed (lshttpd - #04)
└─386758 lsphp

Apr 28 21:24:34 fcgid-MS-7C13 systemd[1]: Starting OpenLiteSpeed HTTP Server...
Apr 28 21:24:34 fcgid-MS-7C13 lswsctrl[386731]: [OK] litespeed: pid=386750.
Apr 28 21:24:36 fcgid-MS-7C13 systemd[1]: Started OpenLiteSpeed HTTP Server.

6.) Access OpenLiteSpeed WebAdmin Console on Port 7080

Finally, OpenLiteSpeed installation is now successfully completed and now you can log in into the OpenLiteSpeed WebAdmin Console on port 7080 via localhost if you run it on your localachine (laptop / desktop PC) or server IPv4 address if you run OpenLiteSpeed on VPS, Cloud or Bare-Metal server.

For example, we access our OpenLiteSpeed WebAdmin Console via localhost on port 7080 in the Google Chrome browser, as follow.

URL: https://localhost:7080/login.php
Username: admin (default)
Password: 123456 (default)

PLEASE NOTE: You can reset OpenLiteSpeed WebAdmin Console password using admpass.sh script. Simply run the following command to execute the script to reset the password.

$ /usr/local/lsws/admin/misc/admpass.sh
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!

CONCLUSION:

You have successfully install and configure OpenLiteSpeed Web Server (OLSWS) on Ubuntu 20.04 LTS (Focal Fossa). Then you can use this stack to host and manage your web application over the public internet.

Leave a Comment