Try OpenLiteSpeed on CentOS8

4 minute read

Introduction

I recently heard that OpenLite Speed is wonderful and tried it

OpenLiteSpeed
https://openlitespeed.org/

Installation

See CentOS 8 on the official installation page
https://openlitespeed.org/kb/install-ols-from-litespeed-repositories/

[root@ip-172-31-25-255 centos]# rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm
Retrieving http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm

Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:litespeed-repo-1.2-1.el8         ################################# [100%]
[root@ip-172-31-25-255 centos]#
[root@ip-172-31-25-255 centos]# yum install openlitespeed
LiteSpeed Tech Repository for CentOS 8 - x86_64                                                                                                591 kB/s | 538 kB     00:00
LiteSpeed Tech Update Repository for CentOS 8 - x86_64                                                                                         304 kB/s | 242 kB     00:00
Last metadata expiration check: 0:00:01 ago on Fri 25 Sep 2020 06:59:12 AM UTC.
Error:
 Problem: package openlitespeed-1.6.16-1.el8.x86_64 requires lsphp73-mcrypt, but none of the providers can be installed
  - cannot install the best candidate for the job
  - nothing provides libmcrypt.so.4()(64bit) needed by lsphp73-pecl-mcrypt-1.0.3-1.el8.7.3.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
[root@ip-172-31-25-255 centos]# 

No good
lsphp73-mcrypt is required
Insert the LiteSpeed library first.

[root@ip-172-31-25-255 centos]# yum install epel-release
・ ・ ・
Installed:
  epel-release-8-8.el8.noarch

Complete!
[root@ip-172-31-25-255 centos]# yum install lsphp73 lsphp73-common lsphp73-mysql lsphp73-gd lsphp73-process lsphp73-mbstring lsphp73-xml lsphp73-mcrypt lsphp73-pdo lsphp73-ima                                                                p lsphp73-soap lsphp73-bcmath
ln -sf /usr/local/lsws/lsphp73/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5Extra Packages for Enterprise Linux Modular 8 - x86_64                   [===                                                                                          Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                                          99 kB/s | 132 kB     00:01
Extra Packages for Enterprise Linux 8 - x86_64                                                                                                 3.1 MB/s | 8.0 MB     00:02
No match for argument: lsphp73-mysql
Error: Unable to find a match: lsphp73-mysql
[root@ip-172-31-25-255 centos]# ln -sf /usr/local/lsws/lsphp73/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5

Yes again
[lsphp73-mysql] It is said that there is no such thing, so if you look it up

[root@ip-172-31-25-255 centos]# yum list | grep lsphp73-mysql
lsphp73-mysqlnd.x86_64                               7.3.22-1.el8                                     litespeed
lsphp73-mysqlnd-debuginfo.x86_64                     7.3.22-1.el8                                     litespeed
[root@ip-172-31-25-255 centos]#

Change because the name is slightly different

# [lsphp73-mysql] -> [lsphp73-mysqlnd]
[root@ip-172-31-25-255 centos]# yum install lsphp73 lsphp73-common lsphp73-mysqlnd lsphp73-gd lsphp73-process lsphp73-mbstring lsphp73-xml lsphp73-mcrypt lsphp73-pdo lsphp73-imap lsphp73-soap lsphp73-bcmath
・ ・ ・
Complete!
[root@ip-172-31-25-255 centos]#

Finally installed

[root@ip-172-31-25-255 centos]# yum install openlitespeed
・ ・ ・
#Put a link
[root@ip-172-31-25-255 centos]# ln -sf /usr/local/lsws/lsphp73/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
start
[root@ip-172-31-25-255 centos]# /usr/local/lsws/bin/lswsctrl start
[OK] Send SIGUSR1 to 52930
[root@ip-172-31-25-255 centos]#

Process confirmation

[root@ip-172-31-25-255 centos]# ps -ef| grep lite
root       53006       1  0 07:21 ?        00:00:00 openlitespeed (lshttpd - main)
root       53011   53006  0 07:21 ?        00:00:00 openlitespeed (lscgid)
nobody     53015   53006  0 07:21 ?        00:00:00 openlitespeed (lshttpd - #01)
nobody     53016   53006  0 07:21 ?        00:00:00 openlitespeed (lshttpd - #02)
root       53022    4339  0 07:23 pts/0    00:00:00 grep --color=auto lite
[root@ip-172-31-25-255 centos]#

Then Netstat

[root@ip-172-31-25-255 centos]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1439/sshd
tcp        0      0 0.0.0.0:8088            0.0.0.0:*               LISTEN      53006/openlitespeed
tcp        0      0 0.0.0.0:7080            0.0.0.0:*               LISTEN      53006/openlitespeed
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd
tcp6       0      0 :::22                   :::*                    LISTEN      1439/sshd
[root@ip-172-31-25-255 centos]#

Regular web page: 8088
web administration page: 7080

Access immediately
http://XXX.XXX.XXX.XXX:8088

image.png
Looked

Next web management screen
https://XXX.XXX.XXX.XXX:7080/login.php

image.png

Username and password are officially

The defaults for the administrator’s user name and password are “admin” and “123456” for the earlier version, and “admin” and randomly generated password from v1.6.5 and v1.5.11.

So, when I checked how to issue a password, I used the following command

[root@ip-172-31-25-255 centos]# /usr/local/lsws/admin/misc/admpass.sh

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]:

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Password:
Retype password:
Administrator's username/password is updated successfully!
[root@ip-172-31-25-255 centos]#

Login safely

image.png

Localizing into Japanese

image.png

PHP installation

litespeed allows you to compile PHP from the screen (some consoles)
image.png
Select “Compile PHP” from Tools

Version selection

image.png
This time select the latest 7.4.10.

Build options

image.png
Leave the default

Source download

image.png

compile

I’ve had a lot of missing errors here and there, so I’ll list what I need below.

yum install gcc libxml2-devel openssl-devel sqlite-devel libcurl-devel make
#Only oniguruma couldn't be put in with yum, so I put it directly from rpm.
#This time it is centos8 so the following link
rpm -ivh http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-1.el8.x86_64.rpm
#reference:

#compile
/usr/local/lsws/phpbuild/buildphp_manual_run.sh

oniguruma Reference:
https://centos.pkgs.org/8/centos-powertools-x86_64/oniguruma-devel-6.8.2-1.el8.x86_64.rpm.html

Binary confirmation

$ pwd
/usr/local/lsws/lsphp7/bin
$ ls -l
total 203240
-rwxr-xr-x. 1 root root 51719856 Oct 20 15:20 lsphp
lrwxrwxrwx. 1 root root        9 Oct 20 15:20 phar -> phar.phar
-rwxr-xr-x. 1 root root    14900 Oct 20 15:20 phar.phar
-rwxr-xr-x. 1 root root 51814232 Oct 20 15:20 php
-rwxr-xr-x. 1 root root 51663904 Oct 20 15:20 php-cgi
-rwxr-xr-x. 1 root root     2827 Oct 20 15:20 php-config
-rwxr-xr-x. 1 root root 52887072 Oct 20 15:20 phpdbg
-rwxr-xr-x. 1 root root     4548 Oct 20 15:20 phpize

$ ./php -v
PHP 7.4.10 (cli) (built: Oct 20 2020 15:19:40) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

$ ./lsphp -v
PHP 7.4.10 (litespeed) (built: Oct 20 2020 15:19:47)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
$

PHP version change

Even if you compile it, litespeed still uses the existing PHP version, so you need to change it.

image.png
“Server settings” → “External application”
Change lsphp path for “command”

SSL settings with Let’s encrypt

Obtaining a certificate by Let’s encrypt

# Let'Certbot to use s encrypt-auto install
yum install -y epel-release
curl https://dl.eff.org/certbot-auto -o /usr/bin/certbot-auto
chmod a+x /usr/bin/certbot-auto

EMAIL="[mail address]"
DOMAIN="[Domain name]"
WEBROOT_DIR="/usr/local/lsws/Example/html"
#For the time being, only authentication, so use the existing Example directory

#Obtaining a certificate
certbot-auto certonly --webroot -w $WEBROOT_DIR -m $EMAIL -d $DOMAIN --agree-tos

#If it can be obtained normally, the certificate file will be placed in the following directory
/etc/letsencrypt/live/[Domain name]/

Certificate placement

For the time being, make the webadmin page SSL
image.png
“Web Admin Settings” → “Listener”

68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f3236353732332f65656566386661392d356232322d383861652d356563392d3433.png

“Action”-> “View”-> “SSL” tab
Settings such as private key and certificate
ls SSL check after reboot

in conclusion

Whether to use it in the future or not is something that must be evaluated by performance, but the introduction was relatively easy.
I’m happy that it is compatible with apache when migrating existing services.