Install OpenLiteSpeed Web Server on CentOS, RHEL 8

OpenLiteSpeed is the Open Source edition of LiteSpeed Web Server Enterprise. OpenLiteSpeed contains all of the essential features found in LiteSpeed Enterprise, and represents its commitment to support the Open Source community.
This guide will walk you through the steps to install and configure OpenLiteSpeed web server on a CentOS, RHEL 8 machine.
 
Note: With CentOS, RHEL 8 release, yum command has been replaced with dnf and in near future yum package manager will be discontinued. It is now recommended to use dnf for installing packages but if you still wish to use yum you can use it.

OpenLiteSpeed Features:

OpenLiteSpeed combines speed, security, scalability, optimization and simplicity in one friendly open-source package.

  • Event-Driven Architecture: Fewer processes, less overhead, and enormous scalability. Keep your existing hardware.
  • Upgrade from Apache: OpenLiteSpeed is mod_rewrite compatible, so you can continue to use your current rewrite rules.
  • Friendly Admin Interfaces: OLS comes with a built-in WebAdmin GUI. Control panel support is available with CyberPanel.
  • Built for Speed and Security: Features Anti-DDoS connection and bandwidth throttling, ModSecurity v3 integration, and more.
  • Intelligent Cache Acceleration: Built-in full-page cache module is highly-customizable and efficient for an exceptional user experience.
  • PageSpeed Optimization: Automatically implement Google's PageSpeed optimization system with the mod_pagespeed module.
  • PHP LiteSpeed SAPI: Native SAPI for PHP allows external applications written in PHP to run up to 50% faster.
  • One-Click Installation: Install OpenLiteSpeed, MariaDB and WordPress on various operating systems with just one click.
  • WordPress Acceleration: Experience a measurable performance boost with OpenLiteSpeed and LSCache for WordPress.
  • HTTP/3 Support: LiteSpeed is the first to provide a production-ready implementation of this new Internet protocol, previously known as HTTP-over-QUIC.


Prerequisites

You will need one CentOS 8 (physical or virtual) machine with minimal installed having root user privileges.

Turnoff SELinux

You should change from SELINUX=enforcing to SELINUX=disabled in /etc/selinux/config file for smooth installation of the packages:
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
Save and close.

Now reboot your machine to take changes into effect.
reboot

Add Epel Repository

It is recommended to install extra packages for enterprise Linux repository before proceeding to install packages using yum package manager:
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
ARCH=$( /bin/arch )
dnf config-manager --set-enabled PowerTools

Install Required Packages

You will need to install following required dependencies prior to install openlitespeed web server:
dnf -y install openssl openssl-libs libargon2 wget tar zip unzip php python36

Install OpenLiteSpeed

OpenLiteSpeed provides a repository for its software you can use to download and install the server with CentOS’s standard yum command.
rpm --import https://rpms.litespeedtech.com/centos/RPM-GPG-KEY-litespeed
dnf -y install https://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm
dnf -y install openlitespeed lsphp73

Setting the Administrative Password

By default, the password is set to 123456, so you should change this immediately. You can do this by running a script provided by OpenLiteSpeed:
/usr/local/lsws/admin/misc/admpass.sh

Verify Server Status

OpenLiteSpeed should have started automatically after it was installed. You can verify this using the lswsctrl command:
sudo /usr/local/lsws/bin/lswsctrl status

Output
litespeed is running with PID 9776.
If it is not started, you can start the server using lswsctrl:
sudo /usr/local/lsws/bin/lswsctrl start

 Update Firewall Rules

Now you need to allow these ports from firewall to access OpenLiteSpeed web interface.
firewall-cmd --zone=public --permanent --add-port=8088/tcp
firewall-cmd --zone=public --permanent --add-port=7080/tcp
firewall-cmd --reload

 Test Web Interface

Open up your favorite web browser and navigate to your server's hostname or IP address, followed by :8088 to specify the port:

http://server_name_or_IP:8088

You will see the default OpenLiteSpeed web page, which looks like below:


When you are done exploring the default site, you can navigate to the administrative interface. In your web browser, using HTTPS, navigate to your server’s name or IP address followed by :7080 to specify the port:

https://server_name_or_IP:7080

You will be prompted to enter the administrative username admin and password that you selected with the admpass.sh script in the earlier step:


Once you correctly authenticate, you will be presented with the OpenLiteSpeed administration interface:


From this administrative web console the majority of your configuration for the web server will take place.

Optional - Changing the 8088 Port to the Default 80

Perform this step if you wish to change the default port from 8088 to the conventional HTTP port 80:

To accomplish this, first click Listeners in the list of options on the left side of the interface. A list of all available listeners will load.

In the list of listeners, click the “View/Edit” button for the Default listener:


This will load a page with more details about the Default listener. Click the edit button in the top-right corner of the “Address Settings” table to modify its values:


On the next screen, change port 8088 to port 80, then click the floppy disk icon, Save:


After the modification, you will need to restart the server. Click the “reload” arrow icon to restart OpenLiteSpeed:

Additionally, you’ll need to open up port 80 on your firewall:
firewall-cmd --zone=public --permanent --add-port=80/tcp
firewall-cmd --reload

Wrapping up

You now have a OpenLiteSpeed web server that is primarily managed through the administrative web interface.

1 comment:

  1. This was super helpful. Thank you! Are we supposed to re-enable SELinux after the installation? Or leave it off completely?

    ReplyDelete

Powered by Blogger.