Install OpenLiteSpeed on AlmaLinux 9: Free and Fast Load

Posted on

Install OpenLiteSpeed on AlmaLinux 9: Free and Fast Load

Install OpenLiteSpeed on AlmaLinux 9: Free and Fast Load

This tutorial aims to guide you through the process of installing Install OpenLiteSpeed on AlmaLinux 9 (or any RHEL 9 distribution) with PHP and MySQL. OpenLiteSpeed is a high-performance, lightweight, open-source HTTP server designed to deliver exceptionally fast website loading speeds. Follow the steps outlined below to complete your OpenLiteSpeed installation and access the OpenLiteSpeed admin console.

To Install OpenLiteSpeed on AlmaLinux 9, you’ll need access to your server as a non-root user with sudo privileges and a basic firewall setup. Refer to our guide on Initial Server Setup with AlmaLinux 9 for assistance with this prerequisite.

Step 1 – Install Remi Enterprise Linux 9 Repository

First, update your system using the following command:

sudo dnf update -y

Next, install and enable the Remi repository on AlmaLinux 9 using these commands:

# sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
# sudo dnf config-manager --set-enabled remi

Then, install the libxcrypt-compat package:

sudo dnf install libxcrypt-compat -y

Step 2 – Download and Install OpenLiteSpeed on AlmaLinux 9

Now, use the wget command to add the OpenLiteSpeed repository:

sudo wget -O - https://repo.litespeed.sh | sudo bash

Output:

HTTP request sent, awaiting response... 200 OK
Length: 5592 (5.5K) [application/octet-stream]
Saving to: ‘STDOUT’

-                   100%[=================>]   5.46K  --.-KB/s    in 0.02s

2023-06-06 08:23:40 (340 KB/s) - written to stdout [5592/5592]

LiteSpeed repository already setup!

Install OpenLiteSpeed with the following command:

sudo dnf install openlitespeed -y

OpenLiteSpeed should start automatically during the installation process.

Verify that the OpenLiteSpeed web server is active and running using this command:

sudo systemctl status lsws

Output:

● lshttpd.service - OpenLiteSpeed HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/lshttpd.service; enabled; preset: disabled)
     Active: **active** (**running**) since Tue 2023-06-06 08:43:38 EDT; 1min 19s ago
    Process: 78537 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
   Main PID: 78550 (litespeed)
     CGroup: /system.slice/lshttpd.service
             └─78550 "openlitespeed (lshttpd - main)"
...

Note: If the web server is not active, start it using:

sudo /usr/local/lsws/bin/lswsctrl start

Step 3 – Install PHP for OpenLiteSpeed

Install PHP for enhanced security, stability, and connection handling.

Install PHP 8.1 and its extensions with this command:

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

Step 4 – Install MySQL on AlmaLinux 9

Install MySQL on AlmaLinux 9 with:

sudo dnf install mysql mysql-server -y

Start and enable the MySQL service:

# sudo systemctl start mysqld
# sudo systemctl enable mysqld

Run the secure installation for enhanced security:

sudo mysql_secure_installation

Answer the questions as follows:

Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: n
Please set the password for root here.
New password:
Re-enter new password:
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

After completing the secure installation, you can configure the OpenLiteSpeed Admin panel.

Step 5 – Configure OpenLiteSpeed on AlmaLinux 9

Change the default password for the Admin user to log in to the administration web interface:

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

You will be prompted to enter the admin username and set a password.

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!

Step 6 – Configure Firewall For OpenLiteSpeed

Assuming you have enabled firewalld, open the OpenLiteSpeed ports through the AlmaLinux 9 firewall:

# sudo firewall-cmd --zone=public --permanent --add-port=8088/tcp
# sudo firewall-cmd --zone=public --permanent --add-port=7080/tcp

Reload the firewall to apply the changes:

sudo firewall-cmd --reload

Step 7 – Access OpenLiteSpeed Admin Web Interface

Access the OpenLiteSpeed Admin panel on AlmaLinux 9 by typing your server’s IP address in your web browser followed by :7080:

http://Your_IP_address:7080

Enter your credentials and click on the Login button.

[Image of OpenLiteSpeed Admin Console Login]

You will then see the OpenLiteSpeed Admin dashboard:

[Image of OpenLiteSpeed Admin Dashboard]

From the dashboard, you can control and configure all OpenLiteSpeed Web Server settings. For more information, visit the official website.

Here are some features of the AlmaLinux OpenLiteSpeed Admin Console:

  • Virtual Host Management
  • Listeners Configuration
  • Server Configuration
  • Web Application Deployment
  • Real-Time Statistics

Conclusion

You have now learned how to Install OpenLiteSpeed on AlmaLinux 9 and access your Admin Console. The admin console provides a user-friendly interface to manage your OpenLiteSpeed web server.

Enjoy using your fast new web server! You might also be interested in these articles:

Installing OpenLiteSpeed on Debian 12 Bookworm

Change LiteSpeed WebAdmin Console Login

Install and Configure OpenLiteSpeed on Ubuntu 22.04

Install and Configure OpenLiteSpeed on Centos 7

Alternative Solutions for Installing OpenLiteSpeed on AlmaLinux 9

While the above method provides a straightforward approach, here are two alternative solutions to Install OpenLiteSpeed on AlmaLinux 9:

1. Using Docker Compose:

Docker provides a containerization platform that allows you to run applications in isolated environments. Using Docker Compose, you can define and manage multi-container Docker applications. This method offers portability and simplifies the deployment process.

Explanation:

  • Dockerization: OpenLiteSpeed, PHP, and MySQL (or MariaDB) can be containerized separately. This isolates each component, preventing conflicts and ensuring consistent behavior across different environments.
  • Docker Compose: Docker Compose allows you to define the services, networks, and volumes required for your application in a docker-compose.yml file. This simplifies the deployment and management of the entire stack.
  • Configuration: You can configure OpenLiteSpeed, PHP, and MySQL using environment variables and volume mounts. This allows you to customize the installation without modifying the container images directly.

Example docker-compose.yml file:

version: "3.8"
services:
  openlitespeed:
    image: litespeedtech/openlitespeed:latest #Use an OLS image from Docker Hub
    ports:
      - "80:8080" # Expose HTTP port
      - "443:4443" # Expose HTTPS port
      - "7080:7080" # Expose Admin port
    volumes:
      - ./ols_data:/usr/local/lsws
    depends_on:
      - mysql
    environment:
      ADMIN_PASSWORD: "your_admin_password"

  mysql:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: "your_mysql_root_password"
      MYSQL_DATABASE: "your_database_name"
      MYSQL_USER: "your_database_user"
      MYSQL_PASSWORD: "your_database_password"
    volumes:
      - ./mysql_data:/var/lib/mysql

  php:
    image: php:8.1-fpm-alpine
    volumes:
      - ./ols_data/html:/var/www/html
    depends_on:
      - mysql

Steps:

  1. Install Docker and Docker Compose: Follow the official Docker documentation for installing Docker and Docker Compose on AlmaLinux 9.
  2. Create docker-compose.yml: Create a file named docker-compose.yml in a directory of your choice and paste the example configuration above. Modify the environment variables and volume paths as needed.
  3. Run Docker Compose: Navigate to the directory containing the docker-compose.yml file and run the command docker-compose up -d. This will download the necessary images and start the containers in detached mode.
  4. Access OpenLiteSpeed: Access the OpenLiteSpeed admin panel using your server’s IP address and port 7080 (e.g., http://your_server_ip:7080).

2. Using a Control Panel (e.g., CyberPanel):

CyberPanel is a free and open-source web hosting control panel that simplifies the management of web servers. It includes OpenLiteSpeed as its default web server.

Explanation:

  • Automated Installation: CyberPanel automates the installation and configuration of OpenLiteSpeed, PHP, MySQL, and other essential components.
  • User-Friendly Interface: CyberPanel provides a web-based interface for managing websites, databases, email accounts, and other server resources.
  • Security Features: CyberPanel includes built-in security features such as a firewall, ModSecurity integration, and automatic SSL certificate installation.

Steps:

  1. Download CyberPanel Installer: Download the CyberPanel installer script using wget:

    wget https://cyberpanel.net/install.sh
  2. Run the Installer: Execute the installer script with root privileges:

    sudo bash install.sh
  3. Follow the Prompts: The installer will guide you through the installation process. You’ll be prompted to choose the installation type (full or basic), set the admin password, and configure other options.

  4. Access CyberPanel: Once the installation is complete, access the CyberPanel web interface using your server’s IP address and port 8090 (e.g., https://your_server_ip:8090).

  5. Configure Websites: Use the CyberPanel interface to create websites, databases, and other resources.

Using Docker Compose or CyberPanel simplifies the process of Install OpenLiteSpeed on AlmaLinux 9 and offers a more manageable environment compared to manual installation. They both provide efficient alternatives for deploying and managing OpenLiteSpeed and related services.

Leave a Reply

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