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
Table of Contents
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:
- 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.
- 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.
- 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.
- 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.
- 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.
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
Prepare your Rocky Linux Server
By using a ssh client, login to your Linux machine as root user. If you are a Linux newbie then we recommend that you should read Linux for Beginners (PAID LINK) by Ethem Mining before deep diving into Linux command line.
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
First of all, install wget command, because you will need it to download and install third party yum repositories.
# dnf install -y wget
Execute following Linux command to install LiteSpeed Official repository.
# 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 requires some software packages from EPEL and REMI yum repositories. Therefore, install both of them by using following dnf commands.
# 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
Execute following command at Linux terminal to install OpenLiteSpeed and dependent software packages.
# 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 uses port 8088/tcp for websites and port 7080/tcp for OpenLiteSpeed Admin Panel.
You need to allow both of these ports in Linux Firewall to enable network access.
# 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.
You can also access the OpenLiteSpeed Admin Panel at http://web-01.centlinux.com:7080/
Login as admin user and auto-generated password.
You have reached at the Dashboard of OpenLiteSpeed Admin Panel.
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. To start hosting awesome websites with OpenLiteSpeed web server, we recommend that, you should attend online training LiteSpeed Fundamentals