OpenLiteSpeed is very powerful, high-performance, lightweight, open source HTTP server which is easy to use.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Software installations tasks.
In this context, we shall look into the steps to install OpenLiteSpeed in Centos.
To install OpenLiteSpeed on Centos, the following steps need to be taken accordingly;
i. Configure OpenLiteSpeed Repository
ii. Install PHP from OpenLiteSpeed Repositories
iii. Install & Secure MariaDB database server
iv. OpenLiteSpeed install with dnf command
v. Change the default Administrator Password
vi. Accessing OpenLiteSpeed webserver
Now we will look into each step briefly.
To begin, Log into your Server via an SSH tool such as putty as the root user and then add the OpenLiteSpeed repository to the CentOS 8 or RHEL 8 instance. This will allow us to install the OpenLiteSpeed web server and associated packages and dependencies.To do this execute the command;
sudo rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm
Then update the package lists by running the command;
sudo dnf update
In this case, we are going to install PHP 7.4 using the OpenLiteSpeed repository colloquially referred to as LSPHP. But before that, ensure that we have added the EPEL repo using the command:
sudo dnf install -y epel-release
After installing the EPEL repo, install "LSPHP" as shown below;
sudo dnf install -y lsphp74 lsphp74-mysqlnd lsphp74-process lsphp74-mbstring lsphp74-mcrypt lsphp74-gd lsphp74-opcache lsphp74-bcmath lsphp74-pdo lsphp74-common lsphp74-xml
Once PHP packages have been installed successfully using the above dnf command, let us install the MariaDB database server.
To install the MariaDB database server, execute;
sudo dnf install -y mariadb mariadb-server
Once installed, start the MariaDB database server by executing;
sudo systemctl start mariadb
sudo systemctl enable mariadb
Next, run following systemctl command to check the status of MariaDB service;
sudo systemctl status mariadb
To secure MariaDB and avoid security breaches, let us proceed with some additional steps:
sudo mysql_secure_installation
Begin by setting the root password if none was assigned.
For the remainder of the prompts. Simply press "Y" for Yes to enforce best practice settings.
Install OpenLiteSpeed with dnf command
Now, we need to get OpenLiteSpeed installed on the CentOS 8 instance. To install the web server, simply invoke the following dnf command:
sudo dnf install -y openlitespeed
Once the installation is completed, we can check the status of the web server using the command:
sudo systemctl status lsws
If the webserver is not active and running, we can start it by running the command:
sudo systemctl start lsws
The web server listens on two ports: 8088 and 7080. Port 8088 is for demo purposes while the port 7080 gives us access to the administrative UI.
We can confirm the ports that the webserver is listening on using the netstat command as shown:
sudo netstat -pnltu
Now, we need to open these ports in the firewall:
sudo firewall-cmd --zone=public --permanent --add-port=8088/tcp
sudo firewall-cmd --zone=public --permanent --add-port=7080/tcp
sudo firewall-cmd --reload
By default, the Admin password is set to "123456". For security reasons, we need to change it to a secure one. To achieve this execute the script shown below;
sudo /usr/local/lsws/admin/misc/admpass.sh
Then, specify a different username and password.
To access the default page for the OpenLiteSpeed web server, browse the server's address as shown below;
http://server-ip:8088
This takes us to the demo page. To access the administrative section, browse the server’s IP with the port 7080 using the HTTPS protocol.
https://server-ip:7080
We can log in with the new username and password that we set in the step earlier.
This leads us to the OpenLiteSpeed dashboard.
From here, we can configure virtual hosts, change the default port from port 8088 to another port and other settings.
This article will guide you on how to perform installation of OpenLiteSpeed on Centos Server.