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
reboot
yum install epel-release
rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm

While executing last from above list, you face error “nothing provides libmcrypt.so.4()(64bit) …”. To resolve this run:

rpm -Uvh https://distrib-coffee.ipsl.jussieu.fr/pub/linux/altlinux/p10/branch/x86_64/RPMS.classic/libmcrypt-2.5.8-alt1.x86_64.rpm

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:

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

and replace ‘lsphp73’ (version could be different)

$SERVER_ROOT/lsphp73/bin/lsphp

With

$SERVER_ROOT/lsphp81/bin/lsphp

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
./admpass.sh
/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 https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | 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:

mariadb_secure_installation

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!