How to Install OpenLiteSpeed on Rocky Linux/AlmaLinux

In this tutorial guide we will learn how to install Openlitespeed server on Rocky Linux/Alma Linux

Openlitespeed is an easy to use open source web server. It offers unbeatable features and performance to your website along with top notch security. The server understands all the Apache rewrite rules and has intelligent cache acceleration features that let you implement the fastest caching on your server.

Prerequisites

  • Rocky Linux 8 Server
  • User account with sudo privileges
  • Strong internet connection

Table of Contents

  1. Update our System
  2. Add OpenLiteSpeed to Rocky Linux 8 to the repository
  3. Install OpenLiteSpeed on Rocky Linux
  4. Install PHP
  5. Install and confiogure MySQL
  6. Set up OpenLiteSpeed login Admin credentials
  7. Test OpenLiteSpeed

Related Articles

1. Update Rocky Linux Repositories

First we need to update our system so that our repositories are up to date. This is the first step whenever you are doing any installation in the system. Type the following command into our terminal.

$ sudo dnf update -y

When the update is complete proceed to add OpenLiteSpeed to repository.

2. Add OpenLiteSpeed to EPEL repository

To add OpenLiteSpeed into our repository in Rocky 8 Linux, type the following into our terminal;

$ sudo dnf install epel-release

Sample output

....
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                         1/1 
  Installing       : epel-release-8-13.el8.noarch                                                            1/1 
  Running scriptlet: epel-release-8-13.el8.noarch                                                            1/1 
  Verifying        : epel-release-8-13.el8.noarch                                                            1/1 

Installed:
  epel-release-8-13.el8.noarch                                                                                   

Complete!

Add OpenLiteSpeed to our repository

$ sudo rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm

Retrieving http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:litespeed-repo-1.2-1.el8         ################################# [100%]

3. Install OpenLiteSpeed on Rocky Linux/AlmaLinux

Now that we have added the OpenLiteSpeed Repository to our system, we can now install OpenLiteSpeed with the following command:

$ sudo dnf install openlitespeed

After the installation is complete, you check the status of OpenLiteSpeed server with the following command;

$ # sudo systemctl status lsws
● lshttpd.service - OpenLiteSpeed HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/lshttpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-11-12 12:22:52 UTC; 1min 41s ago
  Process: 63411 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
 Main PID: 63435 (litespeed)
   CGroup: /system.slice/lshttpd.service
           ├─63435 openlitespeed (lshttpd - main)
           ├─63439 openlitespeed (lscgid)
           └─63452 openlitespeed (lshttpd - #01)

Nov 12 12:22:49 rockylinux systemd[1]: Starting OpenLiteSpeed HTTP Server...
Nov 12 12:22:50 rockylinux lswsctrl[63411]: [OK] litespeed: pid=63435.
Nov 12 12:22:52 rockylinux systemd[1]: Started OpenLiteSpeed HTTP Server.

It must show the status as active for us to continue with this tutorial. If not start your server first with the following command

$ /usr/local/lsws/bin/lswsctrl start.

4. Install PHP for OpenLiteSpeed

PHP is not embedded in OpenLiteSpeed as is the case with Apache. OpenLiteSpeed delegates PHP execution to external PHP executables. This will allows for better security, stability and handling of multiple connections.

Begin installation of PHP74 with the following command

$ sudo dnf -y install lsphp74 lsphp74-common lsphp74-mysqlnd lsphp74-gd lsphp74-process lsphp74-mbstring lsphp74-xml lsphp74-mcrypt lsphp74-pdo lsphp74-imap lsphp74-soap lsphp74-bcmath

Once the installation of PHP74 is complete, we can now move to install MySQL server

5. Install MySQL server

You can run the following command to install MySQL server

$ sudo dnf install mysql mysql-server

Run secure installation script to make MyQL safe, but first you need to start mysqld service;

$ sudo systemctl start mysqld
$ sudo systemctl enable mysqld

Check the status now with the following command;

$ sudo systemctl status mysqld

Sample Output

● mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-11-12 12:56:55 UTC; 2min 48s ago
 Main PID: 66270 (mysqld)
   Status: "Server is operational"
    Tasks: 37 (limit: 11189)
   Memory: 458.0M
   CGroup: /system.slice/mysqld.service
           └─66270 /usr/libexec/mysqld --basedir=/usr

Nov 12 12:56:47 rockylinux systemd[1]: Starting MySQL 8.0 database server...
Nov 12 12:56:47 rockylinux mysql-prepare-db-dir[66189]: Initializing MySQL database
Nov 12 12:56:55 rockylinux systemd[1]: Started MySQL 8.0 database server.

It is now time to run our secure installation, do the following;

$ sudo mysql_secure_installation

For easy logging into the system it is better you do not set validate password. Type N and the consequent prompts you can type Y to allow installation to continue.

When it is complete we can now move forward to set up OpenLiteSpeed administration panel.

5. Configure OpenLiteSpeed Admin panel

To change the default password in the OpenLiteSpeed dashboard, we need to run the following command;

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

Sample output

# 
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!

We have successfuly added the administrator, it is now good we configure firewall to allow OpenLiteSpeed run successfully.

6. Configure Firewall Settings

OpenLiteSpeed listens on port 8088 and 7080, so we must allow this ports access. To do so we can do the following;

$ firewall-cmd --zone=public --permanent --add-port=8088/tcp

Do the same for port 7080

$ firewall-cmd --zone=public --permanent --add-port=7080/tcp

Then you need to reload the system for changes to take effect

$ sudo firewall-cmd --reload

If incase you run into issues with the following please ensure that firewalld is up and running. Run the folllowing command to enable it.

$ systemctl enable --now firewalld

Lastly we can test our OpenLiteSpeed to see if it is running with the following on your prefered browser;

http://<Your_IP_address:8088>
openLiteSpeed on port 8088
OpenLiteSpeed on port 8088

To access the admin site we need to use port 7080 like this

http://<Your_IP_address:7080>
OpenLiteSpeed login screen
openLiteSpeed login screen
OpenLiteSpeed Dashboard
OpenLiteSpeed Dashboard

Conclusion

I am glad you have learned how to install OpenLiteSpeed on Rocky Linux/Alma Linux. Continue playing around with the configuration to learn more. In case of problem don not hesitate to contact us or consult OpenLiteSpeed Documentation

About Mason Kipward

I am a technology enthusiast who loves to share gained knowledge through offering daily tips as a way of empowering others. I am fan of Linux and all other things open source.
View all posts by Mason Kipward →

Leave a Reply

Your email address will not be published. Required fields are marked *