Internet, IT and Technology

How to install OpenLiteSpeed in Debian 12 Bookworm

OpenLiteSpeed SVG logo

OpenLiteSpeed ​​can be installed in Debian 9, 10 and 11 from the official LiteSpeed ​​repositories according to its official documentation. The LiteSpeed ​​repositories have not yet been updated to support Debian 12 Bookworm, if we try we will get several errors in the process. This does not mean that it cannot be done, we have two options, the first is using the binary files, and the second is making some small modifications to the system to be able to install the web server cleanly and almost automatically.

Note: at some point the LiteSpeed ​​repository will be compatible with Debian 12, if we follow this guide we will not have any problems, because in the installation section we can verify if it is already available.

Installation

We start with the official documentation. In the instructions, it asks us to add the repositories. These instructions must be executed with the root user or through a user with sudo privileges in a terminal with an SSH connection (SSH for remote servers only).

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

Then we run the installation:

apt update
apt install openlitespeed

If there are no errors in this procedure, it means that LiteSpeed ​​has already added support for Debian 12, so we must continue with the instructions mentioned on the previous page to install the remaining PHP extensions.

Installing and fixing errors

Errors during installation

There can be two common errors, when we run apt update we see:

E: The repository 'http://rpms.litespeedtech.com/debian bookworm Release' does not have a Release file.

And the other error when executing apt-get install openlitespeed will show us:

E: Unable to locate package openlitespeed

Debian 12 OpenLiteSpeed error

Troubleshooting installation errors

We go to folder /etc/apt/sources.list.d/ and we edit the file lst_debian_repo.list.

nano /etc/apt/sources.list.d/lst_debian_repo.list

The file has the following content.

deb http://rpms.litespeedtech.com/debian/ bookworm main
#deb http://rpms.litespeedtech.com/edge/debian/ bookworm main

We must change the word bookworm to bullseye in both lines. It has to look like this:

deb http://rpms.litespeedtech.com/debian/ bullseye main
#deb http://rpms.litespeedtech.com/edge/debian/ bullseye main

If we want to use the latest version of OpenLiteSpeed ​​we remove the comment from the last line, in this case it is the numeral symbol #. We save the file changes.

We can do all of the above automatically with the following commands:

sed -i 's/bookworm/bullseye/g' /etc/apt/sources.list.d/lst_debian_repo.list
sed -i '/\/edge\/debian\//s/^#//g' /etc/apt/sources.list.d/lst_debian_repo.list

The first command replaces bookworm with bullseye and the second one uncomments the last line to use the latest version of OpenLiteSpeed.

Dependencies configuration

For this we will need to use APT pinning. This will help us use packages from other repositories.

With the following command, we add the dependencies that OpenLiteSpeed ​​needs from the Bullseye repository. It's a single command, you have to copy all the lines and execute it all at once.

sudo echo "Package: libssl1.1 libwebp6
Pin: release n=bullseye
Pin-Priority: 900" > /etc/apt/preferences.d/openlitespeed-preferences

If we want to do it manually, we create the openlitespeed-preferences file in the /etc/apt/preferences.d/ folder.

nano /etc/apt/preferences.d/openlitespeed-preferences

With the following content:

Package: libssl1.1 libwebp6
Pin: release n=bullseye
Pin-Priority: 900
Dependencies repository configuration

In order to use Bullseye dependencies, we need to add the repository and make some small adjustments.

To do this automatically, I have prepared some commands that work well so far.

Default repository.

First, the system needs to know which repository is preferred. We run the following command to set Bookworm as the default version.

sudo echo 'APT::Default-Release "bookworm";' > /etc/apt/apt.conf.d/00default-release

Adding Bullseye repository.

We add the Bullseye repository automatically with this command.

sudo echo "deb https://deb.debian.org/debian bullseye main" > /etc/apt/sources.list.d/bullseye.list

Bullseye repository priority.

We have to lower the priority, this prevents other packages from the repository from being installed automatically. We execute the whole command, you have to copy and execute it.

sudo echo "Package: *
Pin: release n=bullseye
Pin-Priority: 1" > /etc/apt/preferences.d/bullseye-preferences

Final install

If we followed the previous steps correctly, all that remains is to install OpenLiteSpeed.

sudo apt update
sudo apt install openlitespeed

Everything else is installed as usual, PHP extensions, etc. If there is a dependency error when updating, you will have to try a test installation. This works for the Stable and Edge versions of OpenLiteSpeed.

Related content