This post shows students and new users the steps to install and use OpenLiteSpeed ​​on Ubuntu Linux. OpenLiteSpeed ​​is an open source web server developed by LiteSpeed ​​Technology. It is designed to be lightweight, it comes with an administration portal to easily manage the server from your favorite web browser.

The administration portal that is installed with OpenLiteSpeed ​​makes it easy for new users and students to manage the server. From the administration portal, you can configure advanced web server settings, manage users, and restart services.

The steps below will also show you how to install MariaDB, PHP8.0 to enable a dynamic to create a dynamic website that can run popular open source content management systems such as WordPress, Joomla, and Drupal.

If you are looking for an alternative web server, you should consider OpenLiteSpeed.

To start installing OpenLiteSpeed ​​on Ubuntu Linux, follow the steps below:

How to install OpenLiteSpeed ​​on Ubuntu from the repository

You can build and compile the OpenLiteSpeed ​​server on Ubuntu Linux. However, the easiest way to install it on Ubuntu Linux is to add its repository and then install it from there. When you add the repository, the new updates will be available automatically to update your system.

To add the repository, run the following commands:

wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash

The above command will also import the OpenLiteSpeed ​​GPG key into Ubuntu and activate it. You can then run the following commands to install OpenLiteSpeed.

sudo apt update
sudo apt install openlitespeed

After installing OpenLiteSpeed, the following commands can be used to stop, start, and enable the OpenLiteSpeed ​​services to start automatically when the server starts.

sudo systemctl stop lshttpd
sudo systemctl start lshttpd
sudo systemctl enable lshttpd

To see if the OpenLiteSpeed ​​service is running, run the following commands.

sudo systemctl status lshttpd

That should generate lines similar to the ones shown below:

lshttpd.service - OpenLiteSpeed HTTP Server
     Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-09-11 17:43:24 CDT; 13s ago
   Main PID: 5773 (litespeed)
     CGroup: /system.slice/lshttpd.service
             ├─5773 openlitespeed (lshttpd - main)
             ├─5783 openlitespeed (lscgid)
             ├─5813 openlitespeed (lshttpd - #01)
             └─5814 lsphp

Sep 11 17:43:22 ubuntu2004 systemd[1]: Starting OpenLiteSpeed HTTP Server...
Sep 11 17:43:22 ubuntu2004 lswsctrl[5745]: [OK] litespeed: pid=5773.

How to configure OpenLiteSpeed ​​on Ubuntu Linux

Once OpenLiteSpeed ​​is installed, it is automatically assigned port 8080 for the administrator panel. Port 80 is a default port for the web server, so we will want to change OpenLiteSpeed ​​to listen on port 80.

YOU CAN ALSO READ:   How to install WordPress on Ubuntu Linux with Apache

To do that, run the following commands to open your configuration file.

sudo nano /usr/local/lsws/conf/httpd_config.conf

Then find the line below and change the highlighted port to 80.

listener Default{
    address                  *:80
    secure                   0
    map                      Example *
}

Save your changes and exit.

Restart OpenLiteSpeed ​​by running the following commands.

sudo systemctl restart lshttpd

Now open your browser and search for the server’s hostname or IP address. That should open the welcome page of the default OpenLiteSpeed ​​web server.

http://localhost
With the default port changed to 80, run the following commands to configure the administrator password that will be used to log into the OpenLiteSpeed ​​admin panel.
sudo /usr/local/lsws/admin/misc/admpass.sh

When you run the above command, it will ask you to enter the administrator username and create a password. The default username is admin. Leave blank to use.

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [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!

The admin panel can be accessed using the link below:

https://localhost:7080/login.php

Login with the administrator login details above.

How to install PHP 8.0 support for OpenLiteSpeed

When you install OpenLiteSpeed, you also install a version of PHP that is not the latest. If you want the latest version of PHP, you can install it separately.

At the time of this writing, the latest version of PHP is 8.0. Run the following commands to install it.

sudo apt install lsphp80 lsphp80-mysql lsphp80-common lsphp80-opcache lsphp80-curl

To make OpenLiteSpeed ​​use PHP 8.0, log into the admin panel, then go to Server Configuration -> External Application, click the + button to add a new external application.

When prompted to choose the type of application you want to add, choose SAPI LiteSpeed ​​application. Then click Next (arrow).
In the PHP configuration, use these recommended values:
  • Name: lsphp8.0
  • Address: uds: //tmp/lshttpd/lsphp80.sock
  • Maximum connections: 10
  • Environment: PHP_LSAPI_CHILDREN = 10
    LSAPI_AVOID_FORK = 200M
  • Initial request timeout (seconds): 60
  • Retry timeout (seconds):
  • Persistent connection: Yes
  • Response buffer: No
  • Command: lsphp80 / bin / lsphp
  • Reservation: 100
  • Instances: 1
  • Priority:
  • Memory soft limit (bytes): 2047M
  • Memory Hard Limit (Bytes): 2047M
  • Process soft limit: 1400
  • Strict process limit: 1500
Save your changes.

Then go to Server Configuration ==> Script Handler and click Edit under Actions to edit the existing controller.

Then choose the new PHP 8.0 driver created above and save.
Restart the server, then go to the server name or IP address followed by /phpinfo.php.
http://localhost/phpinfo.php

PHP 8.0 is now the default driver.

How to install MariaDB on Ubuntu Linux

MariaDB is fast, secure, and the default server for almost all Linux servers. To install MariaDB, run the following commands:

sudo apt install mariadb-server
sudo apt install mariadb-client

After installing MariaDB, the following commands can be used to stop, start, and enable MariaDB services to always start when the server starts.

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Then run the following commands to protect the database server with a root password if you were not prompted to do so during installation.

sudo mysql_secure_installation

When prompted, use the guide below to respond:

If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): PRESS ENTER

Switch to unix_socket authentication [Y/n] n

Change the root password? [Y/n] n

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

All done!

To verify and validate that MariaDB is installed and working, log into the database console using the following commands:

sudo mysql -u root -p

It should automatically log into the database server as we started the login request as root. Only root can login without password and only from server console.

If you see a screen similar to the one shown above, then the server installed successfully.

You should do that!

In this tutorial we have seen how to install OpenLiteSpeed ​​with support for PHP 8.0 and MariaDB. If you find any errors above or have something to add, use the comment form below.

Write A Comment