Install LiteSpeed Server, PHP 8.1, Mysql (MariaDB) on AlmaLinux (RHEL)

Spread the love

For older post visit here.

Run the following commands in order:

yum -y update
yum install epel-release
rpm -Uvh

While executing last from above list, you face error “nothing provides …”. To resolve this run:

rpm -Uvh

Then continue:

yum install openlitespeed
yum -y install lsphp81
yum -y install lsphp81-mysqlnd lsphp81-gd lsphp81-process lsphp81-mbstring lsphp81-xml lsphp81-zip lsphp81-pdo lsphp81-imap lsphp81-soap lsphp81-bcmath
ln -sf /usr/local/lsws/lsphp81/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
/usr/local/lsws/bin/lswsctrl start

Edit the server config file:


and replace ‘lsphp73’ (version could be different)




Now you have installed LiteSpeed server with PHP 8.1

Your admin URL would be: https://YOURIP:7080 and password would be randomly generated and could be found by following command:

cat /usr/local/lsws/adminpasswd

Output would be like below:

WebAdmin user/password is admin/ZTUzY2Jm

So your username would be: admin and password would be: ZTUzY2Jm

You can change username and password and restart the server by using following commands:

cd /usr/local/lsws/admin/misc
/usr/local/lsws/bin/lswsctrl start

If anytime you want to restart the server use following command

/usr/local/lsws/bin/lswsctrl restart

You can update the listening port from WebAdmin or by using following command:

vi /usr/local/lsws/conf/httpd_config.conf

Then save file by pressing esc and then typing ‘:x’

Now to install Maria DB (MySQL Based) Use following commands:

curl -LsS | sudo bash

yum install MariaDB-server MariaDB-client -y

systemctl enable mariadb.service

systemctl start mariadb.service

And that’s it, you have Maria DB (MySQL) installed and running on your server.

But to secure the installation of MySQL db use the following command:


You will have to go through few question, you change your password, use unix secure socket, remove test DB, reload privileges etc.

Note for Percona server installers. On Redhat Percona database server sets up a temporary password. You can find that by using the following command:

sudo grep "temporary password" /var/log/mysqld.log

And add a swap file if you are low on memory:

cd /

dd if=/dev/zero of=swapfile count=4096 bs=1MiB

sudo chmod 600 /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile

sudo vi /etc/fstab

A file will open and add the following:

/swapfile swap swap sw 0 0

Save the file same as before: esc and then ‘:x’

And finally everything is setup. If have any question then comment below. When I will be do some my own changes on OpenLiteSpeed server installation, then I will post it a new article. Till then peace out!