Previously, we published a guide on installing the OpenLiteSpeed web server on Ubuntu 22.04; in this article, you will get instructions on how to do the same on RHEL-based Linux CentOS 8 or AlmaLinux 8.
What is OpenLiteSpeed, and why should you use it for your web projects? have also been covered there. We’ll get right to the installing phase here.
- Must have root access
- RHEL-based Linux CentOS 6, 7, 8, or AlmaLinux 8
- Minimum 0.5GB RAM for better performance
Install OpenLiteSpeed on CentOS/AlmaLinux/RHEL
It only takes a few commands to install OpenLiteSpeed on CentOS, AlmaLinux, or other distributions based on RHEL, and all the commands are listed below.
Step – 1. Update System
sudo yum update
Using the following command, first, we need to update the system. It is recommended to update before proceeding with OpenLiteSpeed installation.
Step – 2. Add LiteSpeed Repository
After updating the system, add the OpenLiteSpeed repository to the system using the following command.
For CentOS 8 or AlmaLinux 8 or RHEL 8:
rpm -i http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm
For CentOS 7 or RHEL 7:
rpm -i http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
For CentOS 6 or RHEL 6:
rpm -i http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el6.noarch.rpm
Since CentOS 8 was used in this article if your system version differs you must also use the command as indicated above.
The command utilizes the
rpm -Uvh option in the official OpenLiteSpeed documentation, however, we solely used the
-i, and another source specified the
-ivh option to add the repository. We tested other options as well, but they didn’t work, so we stuck with the
-i option, which stands for install, and it works as a charm.
Do You Need Affordable & Clutter-free Cloud Hosting?
Vultr cloud is one of the best cloud hosting platforms for bloggers, developers, and businesses. Their pricing starts from $2.5 per month, claim $100 free credit for Vultr Cloud.
Step – 3. Install OpenLiteSpeed on CentOS/AlmaLinux
The following commands must be run in order to install OpenLiteSpeed on our Linux system as we already added the LiteSpeed repository in accordance with the operating system version.
EPEL (Extra Packages for Enterprise Linux) packages must be installed before OpenLiteSpeed.
Install EPEL Packages:
sudo yum install epel-release
sudo yum install openlitespeed
Additionally, you can specify the OpenLiteSpeed version, for instance, sudo yum install openlitespeed-1.7.16 will install OLS version v1.7.16.
The system will ask you whether you want to install additional pancakes during installation. To continue, you must type Y and then press Enter.
Step – 4. Check OpenLiteSpeed Status
Use the following command to see if OpenLiteSpeed is running or not after installing it on CentOS or AlmaLinux.
sudo systemctl status lsws
[ssh-key-2021-07-19@centos ~]$ 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 Mon 2022-11-28 08:13:25 UTC; 53s ago
Process: 206679 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
Main PID: 206703 (litespeed)
├─206703 openlitespeed (lshttpd - main)
├─206707 openlitespeed (lscgid)
├─206723 openlitespeed (lshttpd - #01)
Nov 28 08:13:22 centos systemd: Starting OpenLiteSpeed HTTP Server…
Nov 28 08:13:23 centos lswsctrl: [OK] litespeed: pid=206703.
Nov 28 08:13:25 centos systemd: Started OpenLiteSpeed HTTP Server.
As you can see from the output, if you got the same then the installation is successful, and OpenLiteSpeed is active and running. If your system shows it is not active or not running then use $
sudo systemctl start lsws to start the service.
Step – 5. Create LiteSpeed Webadmin Console Login Credential
After the installation is complete, we must configure the OpenLiteSpeed web admin login information. Once everything is set up, we will access the server and configure it using those login credentials. Use the following command to obtain your web admin login credentials:
The system will prompt you to provide a new username and password as seen in the above screenshot when you run the command to set a username and password.
Install the latest PHP with the required Modules
After installing OpenLiteSpeed, you may check the installed version of PHP by going to
http://server ip:8088/phpinfo.php. PHP is included with OpenLiteSpeed.
The most recent version of PHP is PHP 8.1, but in our test, we discovered that OpenLiteSpeed on CentOS 8/RHEL 8 comes pre-installed with PHP 7.3 (outdated for WordPress). You can install a specific version of PHP with helpful modules by using the following commands.
Install PHP 7.4
sudo yum install lsphp74 lsphp74-common lsphp74-mysqlnd lsphp74-gd lsphp74-process lsphp74-mbstring lsphp74-xml lsphp74-pdo lsphp74-imap lsphp74-soap lsphp74-bcmath lsphp74-imagick
Install PHP 8.0
sudo yum install lsphp80 lsphp80-common lsphp80-mysqlnd lsphp80-gd lsphp80-process lsphp80-mbstring lsphp80-xml lsphp80-pdo lsphp80-imap lsphp80-soap lsphp80-bcmath lsphp80-imagick
Install PHP 8.1
sudo yum install lsphp81 lsphp81-common lsphp81-mysqlnd lsphp81-gd lsphp81-process lsphp81-mbstring lsphp81-xml lsphp81-pdo lsphp81-imap lsphp81-soap lsphp81-bcmath
Installing the most recent PHP version, which is more secure than the out-of-date one, is advised if you wish to host WordPress websites on the OpenLiteSpeed server. Check out our most recent article for instructions on upgrading PHP 8.0 to PHP 8.1 on Ubuntu.
Install MariaDB Database Server
You can set up MySQL or MariaDB as a database server, which OpenLiteSpeed also needs. In this tutorial, we’ll be using the MySQL offshoot MariaDB database server. For OpenLiteSpeed MariaDB installation, run the command below.
Step – 1. Install & Enable MariaDB Server
sudo yum install mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb
Step – 2. Secure MariaDB on OpenLiteSpeed
After installing MariaDB, you must set a password to protect it. It is open to everyone by default and has no security. Therefore, you can disable anonymous login and set a password using the following commands.
When you run the command, it will ask you a few questions, such as the current root password, which you can skip by pressing the enter key, and others listed below.
- Set root password? [Y/n] Y
- 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
By visiting the OpenLiteSpeed web admin dashboard page at
http://server ip:7080 and entering the credentials we previously created there. The dashboard will display various graphs and a sidebar menu when you log in. You may access all the options and configurations by clicking them.
We now need to configure the most recent version of PHP for OpenLiteSpeed on CentOS. Log in to your dashboard, go to “Server Configuration,” and from the list of several horizontal tabs there, select “External app” and make any necessary edits.
Scroll down and edit the command field from
$SERVER_ROOT/lsphp81/bin/lsphp. If you want the most recent version of PHP, you can mention lsphp81(PHP 8.1) here instead of the default lsphp73 (PHP 7.3).
This tutorial teaches you how to set up OpenLiteSpeed web servers on Linux distributions built on RHEL, including CentOS, AlmaLinux, Oracle Linux, etc. One of the fastest web servers, OpenLiteSpeed, may be customized in a variety of ways to increase its usefulness for your project.
We strongly advise you to utilize it if you are using WordPress or want to host a WordPress website. Please leave a comment or get in touch with us on social media if you have any questions or concerns about OpenLiteSpeed.