CentLinux

Linux Server, DevOps, Kubernetes, and Beyond

How to install OpenLiteSpeed on Rocky Linux 9

Share on Social Media

Learn how to easily install OpenLiteSpeed on Rocky Linux 9 with our comprehensive step-by-step guide. Optimize your web server for speed and efficiency today! #centlinux #linux #openlitespeed

What is OpenLiteSpeed?

OpenLiteSpeed is a lightweight, open-source web server developed by LiteSpeed Technologies. It’s designed to be a high-performance alternative to other web servers like Apache and Nginx. OpenLiteSpeed boasts a user-friendly interface, efficient resource utilization, and excellent scalability, making it ideal for powering websites and web applications of all sizes. It supports various web technologies, including PHP, Python, Ruby, and Node.js, and it’s known for its robust security features and advanced caching mechanisms. Overall, OpenLiteSpeed is a powerful choice for anyone looking to optimize their web server performance while maintaining ease of use and flexibility.

Openlitespeed vs Nginx

OpenLiteSpeed and Nginx are both popular web servers, each with its own strengths and characteristics:

  1. Performance: Both OpenLiteSpeed and Nginx are known for their high performance. OpenLiteSpeed often boasts better performance in certain scenarios due to its event-driven architecture, which can handle high loads efficiently.
  2. Ease of Use: OpenLiteSpeed typically offers a more user-friendly interface and easier configuration compared to Nginx, making it a preferable choice for those who prioritize simplicity.
  3. Features: Nginx has a longer history and a larger community, resulting in a wider range of available modules and third-party integrations. However, OpenLiteSpeed offers many features out-of-the-box, including built-in support for PHP, Python, Ruby, and Node.js, as well as advanced caching mechanisms.
  4. Scalability: Both web servers are capable of handling high traffic and scaling effectively. However, OpenLiteSpeed may have an edge in certain scenarios due to its efficient resource utilization and event-driven architecture.
  5. Support and Community: Nginx has a larger user base and community support, which can be advantageous when seeking help or finding resources online. However, OpenLiteSpeed also has an active community and official support channels.
How to install OpenLiteSpeed on Rocky Linux 9
How to install OpenLiteSpeed on Rocky Linux 9

Ultimately, the choice between OpenLiteSpeed and Nginx depends on factors such as your specific requirements, familiarity with the technology, and preferences regarding ease of use and performance optimization. Both web servers are capable options for serving websites and web applications efficiently.

Environment Specification

We are using a minimal Rocky Linux 9 virtual machine with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – Rocky Linux release 9.1 (Blue Onyx)
  • Hostname – web-01.centlinux.com
  • IP Address – 192.168.116.128/24

Recommended Training: The Linux Command Line Bootcamp: Beginner To Power User from Colt Steele

3998050 2ed8
show?id=oLRJ54lcVEg&bids=1074530

Prepare your Rocky Linux Server

By using a ssh client, login to your Linux machine as root user.

Set a hostname (FQDN) and Local DNS resolution for your Linux Server. Or you can configure a DNS Server for your network.

# hostnamectl set-hostname web-01.centlinux.com
# echo "192.168.116.128 web-01 web-01.centlinux.com" >> /etc/hosts

It is a best practice to update software packages in your Linux operating system, before installation or configuration of a new software.

Therefore, execute dnf command to update your Linux operating system.

# dnf update -y

If your Linux Kernel is updated by the above command, then you should reboot your Linux server with the new Kernel.

# reboot

Note down the versions of Linux Kernel and Linux operating system.

# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.1 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.1"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.1 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.1"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.1"

# uname -r
5.14.0-162.23.1.el9_1.x86_64

Install LiteSpeed Yum Repository

To begin with, you’ll need to install the wget command, as it is an essential tool for downloading files from the internet. In this case, you will use it to fetch third-party yum repositories necessary for the installation of additional software packages on your system. Since wget is not always pre-installed on every Linux distribution, it’s important to install it first to ensure a smooth process when adding external repositories and software to your system.

# dnf install -y wget

To proceed with the installation of LiteSpeed, execute the following Linux command to add the official LiteSpeed repository to your system. This repository contains all the necessary packages and updates for LiteSpeed, ensuring that you are using the latest stable version available. Adding the official repository is a crucial step as it allows you to easily install, update, and manage LiteSpeed on your server using the native package manager.

# wget -O - https://repo.litespeed.sh | sudo bash
--2023-04-18 16:47:24--  https://repo.litespeed.sh/
Resolving repo.litespeed.sh (repo.litespeed.sh)... 34.192.49.9
Connecting to repo.litespeed.sh (repo.litespeed.sh)|34.192.49.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4739 (4.6K) [application/octet-stream]
Saving to: ‘STDOUT’

-                   100%[===================>]   4.63K  --.-KB/s    in 0.04s

2023-04-18 16:47:27 (132 KB/s) - written to stdout [4739/4739]

/tmp ~
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1798  100  1798    0     0   1542      0  0:00:01  0:00:01 --:--:--  1540
~
LiteSpeed repository has been setup!

OpenLiteSpeed software depends on several essential packages that are provided by the EPEL (Extra Packages for Enterprise Linux) and REMI repositories. To ensure a smooth installation and functionality of OpenLiteSpeed, it is necessary to enable both of these repositories on your system. You can easily install and configure them using the following dnf commands. Installing these repositories will grant your system access to a wide range of packages that are not included in the default repositories, ensuring that all dependencies for OpenLiteSpeed are properly met.

# dnf install -y epel-release
# dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm

Build yum cache for newly installed yum repositories.

# dnf makecache
Extra Packages for Enterprise Linux 9 - x86_64  7.5 kB/s | 6.0 kB     00:00
LiteSpeed Tech Repository for CentOS 9 - x86_64 7.7 kB/s | 3.6 kB     00:00
LiteSpeed Tech Update Repository for CentOS 9 - 7.9 kB/s | 3.6 kB     00:00
Remi's Modular repository for Enterprise Linux  636  B/s | 833  B     00:01
Remi's Modular repository for Enterprise Linux  3.0 MB/s | 3.1 kB     00:00
Importing GPG key 0x478F8947:
 Userid     : "Remi's RPM repository (https://rpms.remirepo.net/) <remi@remirepo.net>"
 Fingerprint: B1AB F71E 14C9 D748 97E1 98A8 B195 27F1 478F 8947
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el9
Is this ok [y/N]: y
Remi's Modular repository for Enterprise Linux  426 kB/s | 882 kB     00:02
Safe Remi's RPM repository for Enterprise Linux 834  B/s | 833  B     00:00
Safe Remi's RPM repository for Enterprise Linux 3.0 MB/s | 3.1 kB     00:00
Importing GPG key 0x478F8947:
 Userid     : "Remi's RPM repository (https://rpms.remirepo.net/) <remi@remirepo.net>"
 Fingerprint: B1AB F71E 14C9 D748 97E1 98A8 B195 27F1 478F 8947
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el9
Is this ok [y/N]: y
Safe Remi's RPM repository for Enterprise Linux 492 kB/s | 910 kB     00:01
Rocky Linux 9 - BaseOS                          1.3 kB/s | 4.1 kB     00:03
Rocky Linux 9 - AppStream                       1.2 kB/s | 4.5 kB     00:03
Rocky Linux 9 - Extras                          1.2 kB/s | 2.9 kB     00:02
Metadata cache created.

How to install OpenLiteSpeed

To begin the installation of OpenLiteSpeed and all required dependencies, execute the following command in your Linux terminal. This command will initiate the installation process, fetching OpenLiteSpeed along with any necessary software packages that it relies on for optimal performance. Ensuring that all dependencies are properly installed is essential for the correct functioning of the web server and to avoid potential issues during setup or runtime.

# dnf install -y openlitespeed

PHP 7.2 is already installed with OpenLiteSpeed software. However, if you want to install PHP 8.1 then you can use following Linux command.

# dnf install -y lsphp81 lsphp81-common lsphp81-mysqlnd lsphp81-gd lsphp81-process lsphp81-mbstring lsphp81-xml lsphp81-pdo lsphp81-imap lsphp81-soap lsphp81-bcmath

The OpenLiteSpeed web server has been installed successfully. Default installation directory is /usr/local/lsws.

OpenLiteSpeed installation process generates a random password for admin user. You can get this password by displaying the content of the file by using cat command.

# cat /usr/local/lsws/adminpasswd
Web Admin user/password is admin/MTUzN2Qw

Note down the admin password for future use.

Enable and start OpenLiteSpeed service.

# systemctl enable --now lsws

Configure Linux Firewall:

This web server is configured to use port 8088/tcp for hosting websites and port 7080/tcp for accessing the OpenLiteSpeed Admin Panel. To ensure that these services are accessible over the network, it is essential to allow both of these ports through the Linux firewall. Failing to do so will result in restricted access to your web server and admin panel, preventing users from reaching your websites and administrators from managing the server settings.

Execute following commands to configure your firewall and open the required ports for smooth operation.

# firewall-cmd --permanent --add-port={8088,7080}/tcp
success
# firewall-cmd --reload
success

Access OpenLiteSpeed Admin Panel & Website

Open URL http://web-01.centlinux.com:8088/ in web browser.

OpenLiteSpeed Welcome Page
OpenLiteSpeed Welcome Page

You can also access the OpenLiteSpeed Admin Panel at http://web-01.centlinux.com:7080/

OpenLiteSpeed Admin Panel Login
OpenLiteSpeed Admin Panel Login

Login as admin user and auto-generated password.

OpenLiteSpeed Admin Panel
OpenLiteSpeed Admin Panel

You have reached at the Dashboard of OpenLiteSpeed Admin Panel.

Video Tutorial

YouTube player

Final Thoughts

When it comes to install OpenLiteSpeed on Rocky Linux 9, it’s all about efficiency and performance. With the right installation process, you can ensure that your web server operates smoothly, delivering fast and reliable service to your users. By following a comprehensive guide and understanding the intricacies of the setup, you can optimize your system for peak performance. So, dive in, follow the steps, and unlock the full potential of OpenLiteSpeed on your Linux 9 environment.

Your Linux servers deserve expert care! I provide reliable management and optimization services tailored to your needs. Discover how I can help on Fiverr!

Looking for something?

2 responses to “How to install OpenLiteSpeed on Rocky Linux 9”

  1. Anonymous Avatar
    Anonymous

    LOL I would never use the command line for everything and I still go it working oFedora 38 x86. See if you can follow the same instructions using UTM on a machine with an Apple M chip.

  2. neurontnS Avatar
    neurontnS

    I needs to spend some time learning more or understanding more.

Leave a Reply