OpenLiteSpeed is a free, open-source, and lightweight HTTP web server that is quickly growing in popularity throughout the world. It supports all major operating systems including Linux, FreeBSD, and macOS. OpenLiteSpeed can handle thousands of concurrent connections with low resource usage. It provides a simple and user-friendly web interface that helps you to manage OpenLiteSpeed through a web browser.
In this post, we will show you how to install OpenLiteSpeed, MariaDB, and PHP 8.0 on Ubuntu 20.04.
Step 1 – Install Openlightspeed
By default, OpenLiteSpeed is not included in the Ubuntu default repository, so you will need to add the OpenLiteSpeed repository to your server. You can add it using the following commands:
apt-get update -y wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash
Once the repository is added, install OpenLiteSpeed with the following command:
apt-get install openlitespeed -y
After the installation, start the OpenLiteSpeed service and enable it to start at system reboot:
systemctl enable lshttpd systemctl start lshttpd
Next, verify the status of OpenLiteSpeed with the following command:
systemctl status lshttpd
Sample output:
● lshttpd.service - OpenLiteSpeed HTTP Server Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2021-07-12 08:35:13 UTC; 23s ago Main PID: 4556 (litespeed) CGroup: /system.slice/lshttpd.service ├─4556 openlitespeed (lshttpd - main) ├─4566 openlitespeed (lscgid) ├─4595 openlitespeed (lshttpd - #01) └─4596 lsphp Jul 12 08:35:11 ubuntu2004 systemd[1]: Starting OpenLiteSpeed HTTP Server... Jul 12 08:35:11 ubuntu2004 lswsctrl[4512]: [OK] litespeed: pid=4556. Jul 12 08:35:13 ubuntu2004 systemd[1]: Started OpenLiteSpeed HTTP Server.
You can also verify the OpenLiteSpeed version with the following command:
/usr/local/lsws/bin/openlitespeed -v
Sample output:
LiteSpeed/1.7.12 Open module versions: modgzip 1.1 cache 1.62 modinspector 1.1 uploadprogress 1.1 mod_security 1.4 (built: Wed Jul 7 02:28:18 UTC 2021) module versions: modgzip 1.1 cache 1.62 modinspector 1.1 uploadprogress 1.1 mod_security 1.4
Step 2 – Change OpenLiteSpeed Port
By default, OpenLiteSpeed listens on port 8088. You can check it using the following command:
ss -antpl | grep 8088
Sample output:
LISTEN 0 4096 0.0.0.0:8088 0.0.0.0:* users:(("litespeed",pid=4595,fd=22),("litespeed",pid=4556,fd=22))
It is recommended that you change the default port to 80. To do so, edit the OpenLiteSpeed default configuration file:
nano /usr/local/lsws/conf/httpd_config.conf
Find the following line:
address *:8088
And, replaced it with the following line:
address *:80
Save and close the file, then restart the OpenLiteSpeed service to apply the changes:
systemctl restart lshttpd
Now, open your web browser and type the URL http://your-server-ip. You should see the OpenLiteSpeed default page:
Step 3 – Install MariaDB Server
You can install the MariaDB server and client package using the following command:
apt-get install mariadb-server mariadb-client -y
After the installation, start the MariaDB service and enable it to start at system reboot:
systemctl start mariadb systemctl enable mariadb
You can verify the installed version of MariaDB with the following command:
mariadb --version
Sample output:
mariadb Ver 15.1 Distrib 10.3.29-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Step 4 – Install PHP8.0
You can install PHP version 8.0 with other extensions using the following command:
apt-get install lsphp80 lsphp80-mysql lsphp80-common lsphp80-opcache lsphp80-curl -y
After the installation, verify the PHP version with the following command:
/usr/local/lsws/lsphp80/bin/php8.0 -v
Sample output:
PHP 8.0.8 (cli) (built: Jul 1 2021 08:13:46) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.8, Copyright (c) Zend Technologies with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies
By default, OpenLiteSpeed is configured to use PHP version 7.3. You can check the current PHP version using the URL http://your-server-ip/phpinfo.php
Next, you will need to configure it to use PHP version 8.0.
You can do it by editing the httpd_config.conf file:
nano /usr/local/lsws/conf/httpd_config.conf
Find the following line:
path lsphp73/bin/lsphp
Replaced it with the following line:
path lsphp80/bin/lsphp
Save and close the file, then restart the LiteSpeed service to apply the changes:
systemctl restart lsws
Now, open your web browser and verify the PHP version using the URL http://your-serverip/phpinfo.php. You should see the following page:
Step 5 – Create OpenLiteSpeed Admin User
Next, you will need to create an admin user to access the OpenLiteSpeed admin interface.
Run the following script to create an admin user:
/usr/local/lsws/admin/misc/admpass.sh
Set your admin username and password as shown below:
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!
You can now access the OpenLiteSpeed web interface using the URL https://server-ip-address:7080/login.php. You should see the following page:
Provide your admin username and password and click on the Login button. You should see the OpenLiteSpeed dashboard on the following page:
Conclusion
Congratulations! OpenLiteSpeed web server is now installed with MariaDB and PHP 8.0 support. You can now host your website using the high-performance OpenLiteSpeed web server – try it on dedicated server hosting from Atlantic.Net today!