Install LiteSpeed Server, PHP 8, Mysql on CentOS 8

Spread the love

Update: For latest steps. Visit Here.

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.

Add one the following repositories:

CentOS 6: rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el6.noarch.rpm

CentOS 7: rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm

CentOS 8: rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm

For the latest repository and for other flavours you can visit the Litespeed website for repo link.

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 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

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.

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:

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!