Install LiteSpeed Server, PHP 8, Mysql on CentOS 8

Spread the love

LiteSpeedServer is better then Apache server in terms of handling high visitor count. So today I will posting how I installed the ListSpeedServer, PHP 8 and Maria DB (MySQL) server on CentOS 8. Sit tight as it would not take long as long as you have terminal access to a CentOS server and a good internet connection.

Commands to Install Latest LiteSpeedServer on CentOS 8:

yum -y install epel-release

yum -y update

yum -y install openlitespeed

yum -y install lsphp80

yum -y install lsphp80-mysqlnd lsphp80-gd lsphp80-process lsphp80-mbstring lsphp80-xml lsphp80-pdo lsphp80-imap lsphp80-soap lsphp80-bcmath lsphp80-zip

ln -sf /usr/local/lsws/lsphp80/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 (version could be different)

$SERVER_ROOT/lsphp73/bin/lsphp

With

$SERVER_ROOT/lsphp80/bin/lsphp

Now you have installed LiteSpeed server with PHP 8

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 password on your webadmin panel and restart the server using following command:

/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

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:

mysql_secure_installation

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

And add a swap file:

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

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!