![install LiteSpeed web server on CentOS 7 linux](https://www.tuxtips.net/wp-content/uploads/2020/03/How-to-install-LiteSpeed-web-server-on-CentOS-7-linux.jpg)
How to install LiteSpeed web server on CentOS 7 linux
In previous posts, we demonstrated installing Nginx and Apache web servers. Today we show how to install LiteSpeed web server on CentOS 7 linux.
LiteSpeed is a fork of Apache project and has been built to be optimized and generally faster than Apache.
Here is our environment:
OS: CentOS 7 linux on VMware
Firewall: firewalld
SElinux: enforcing
IP address: 192.168.147.128
LiteSpeed version: 5.4.6
1- Install development tools
LiteSpeed requires development. so first we install it:
# yum groupinstall 'Development Tools' # yum install libxml2-devel.x86_64 openssl-devel.x86_64 bzip2-devel.x86_64 libcurl-devel.x86_64 libpng-devel.x86_64 libXpm-devel.x86_64 freetype-devel.x86_64 gmp-devel.x86_64 openldap-devel.x86_64 zlib-devel.x86_64 ncurses-devel.x86_64 pcre-devel.x86_64 unixODBC-devel.x86_64 postgresql-devel.x86_64 sqlite-devel.x86_64 aspell-devel.x86_64 readline-devel.x86_64 recode-devel.x86_64 net-snmp-devel.x86_64 libxslt-devel.x86_64 t1lib-devel.x86_64
2- Download LiteSpeed
At the moment of writing this article, current stable version was 5.4.6. so we download it:
# wget https://www.litespeedtech.com/packages/5.0/lsws-5.4.6-ent-x86_64-linux.tar.gz
then unpack downloaded package:
# tar -xzvf lsws-5.4.6-ent-x86_64-linux.tar.gz
and change current directory to unpacked package:
# cd lsws-5.4.6-ent-x86_64-linux
3- Install LiteSpeed
Note: LiteSpeed needs a valid license or trial license for installation. Here we use trial license and copy it to installation directory.
you can obtain a trial license from https://www.litespeedtech.com/products/litespeed-web-server/download/get-a-trial-license
to install LiteSpeed, we simply run install.sh script and go through setup and answer questions:
# ./install.sh
3.1 License agreement
after running install script, terms will be showed. we must agree to them, press the space bar several times to scroll down. After doing this several times, we will see:
IMPORTANT: In order to continue installation you must agree with above license terms by typing "Yes" with capital "Y"! Do you agree with above license?
Type Yes and press enter to continue.
3.2 Install location
Then setup will ask where LiteSpeed to be installed. we install it in default directory, simply press enter.
Please specify the destination directory. You must have permissions to create and manage the directory. It is recommended to install the web server at /opt/lsws, /usr/local/lsws or in your home directory like '~/lsws'. ATTENTION: The user 'nobody' must be able to access the destination directory. Destination [/usr/local/lsws]:
3.3 Web interface credentials
Then we must enter username for the administrator that will be used to login to web interface.
Please specify the user name of the administrator. This is the user name required to log into the administration web interface. User name [admin]: administrator
then we enter a password for administrator account:
Please specify the administrator's password. This is the password required to log into the administration web interface. Password:
then we enter an email address. We will be notified about anything related to server/LiteSpeed install, the software will send an email to the email addresses listed here to notify is.
Please specify administrators' email addresses. It is recommended to specify a real email address, Multiple email addresses can be set by a comma delimited list of email addresses. Whenever something abnormal happened, a notificiation will be sent to emails listed here. Email addresses [root@localhost]:
3.4 Hosting control panel
here we did not want to use any hosting control panel so we enter 0:
Will you use LiteSpeed Web Server with a hosting control panel? 0. NONE 1. cPanel 2. DirectAdmin 3. Plesk 4. Hsphere 5. Interworx 6. Lxadmin 7. ISPManager Please select (0-7) [0]?
3.5 Process owner
now we must specify the user who web server will run as. Make sure this is a non-root user as using a user with root privileges is very insecure!
As you are the root user, you must choose the user and group whom the web server will be running as. For security reason, you should choose a non-system user who does not have login shell and home directory such as 'nobody'. User [nobody]:
and we repeat this step for group.
3.6 LiteSpeed port
in next step we specify what port the web server listens on. Generally, it will be port 80:
Please specify the port for normal HTTP service. Port 80 is the standard HTTP port, only 'root' user is allowed to use port 80, if you have another web server running on port 80, you need to specify another port or stop the other web server before starting LiteSpeed Web Server. You can access the normal web page at http://<YOUR_HOST>:<HTTP_PORT>/ HTTP port [8088]: 80
also the is an administration web interface available to manage LiteSpeed web server. This web interface will need to run on another port, such as 7080 (default).
Please specify the HTTP port for the administration web interface, which can be accessed through http://<YOUR_HOST>:<ADMIN_PORT>/ Admin HTTP port [7080]: 7080
then it will ask us about using PHP. If you need to use a CMS (such as Joomla! or WordPress), you will need to enable this. Type Y to enable PHP or n not to use it.
You can setup a global script handler for PHP with the pre-built PHP engine shipped with this package now. The PHP engine runs as Fast CGI which outperforms Apache's mod_php. You can always replace the pre-built PHP engine with your customized PHP engine. Setup up PHP [Y/n]: Y
For the next question, simply press enter unless you’re an advanced user and know what you’re doing here.
Suffix for PHP script(comma separated list) [php]:
3.7 chroot process
it’s recommended to enable chroot for LiteSpeed for better security:
LiteSpeed Web Server Enterprise Edition can run in chroot environment. It is impossible for the chrooted process and its children processes to access files outside the new root directory. With chroot configured properly, there is no need to worry about sensitive data being accidentally exposed by insecure CGI programs or web server itself. Even when a hacker some how gain a shell access, all files he can access is under the chrooted directory. This installation script will try to setup the initial chroot environment automatically. However, it is not easy to setup a chroot environment and you CGI program may break. So we do not recommend enabling it for the first time user. It can be enabled later by running this installation script again. Enable chroot [y/N]: y
then specify chroot directory:
Chroot path must be absolute path and the server root /usr/local/lsws must be included in the chroot directory tree. Chroot directory without trailing '/': /usr/local/lsws
3.8 Remaining options
then we must specify if we want to use AWStats. AWStats is a program that generates statistics so we can see detailed information about visitors. Here we type N:
AWStats is a popular log analyzer that generates advanced web server statistics. LiteSpeed web server seamlessly integrates AWStats into its Web Admin Interface. AWStats configuration and statistics update have been taken care of by LiteSpeed web server. Note: If AWStats has been installed already, you do not need to install again unless a new version of AWStats is available. Would you like to install AWStats Add-on module [y/N]? N
Next we type Y to start LiteSpeed automatically when the server being restart:
Would you like to have LiteSpeed Web Server started automatically when the server restarts [Y/n]? Y
Finally type Y to start LiteSpeed right now:
[OK] The startup script has been successfully installed! Would you like to start it right now [Y/n]? Y
If everything goes fine, we see the following message:
LiteSpeed Web Server started successfully! Have fun!
4- Configure firewall
In installing step, we specified two port: 80 and 7080. so we open it in firewall:
# firewall-cmd --add-service=http --permanent # firewall-cmd --add-port=7080/tcp --permanent # firewall-cmd --reload
Finally refer to http://192.168.147.128 to see default web page and http://192.168.147.128:7080 to administer LiteSpeed.