Learn How To Install LiteSpeed on CentOS

June 3, 2019

Table of Contents

LiteSpeed is a popular web server which is a fork of Apache. It’s built to be optimized and generally faster. We’re going to assume that you have a clean CentOS install.

In this guide, we will install LiteSpeed Standard. This is a free version of LiteSpeed, an alternative for OpenLiteSpeed (an open source version of LiteSpeed which is also free).

Step 1: Updating all software

We need to be sure our server is completely up-to-date. Make sure that’s the case by updating with yum:

yum update -y

This will update all software installed on your server. After upgrading, we can continue and install LiteSpeed.

Step 2: Installing developer tools

LiteSpeed will require developer tools to be installed. Install them with yum:

sudo yum groupinstall 'Development Tools'
sudo yum install libxml2-devel.x86_64 openssl-devel.x86_64 bzip2-devel.x86_64 libcurl-devel.x86_64 db4-devel.x86_64  
libjpeg-devel.x86_64 libpng-devel.x86_64 libXpm-devel.x86_64 freetype-devel.x86_64 gmp-devel.x86_64  
libc-client-devel.x86_64 openldap-devel.x86_64 libmcrypt-devel.x86_64 mhash-devel.x86_64 freetds-devel.x86_64  
zlib-devel.x86_64 mysql-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 
libtidy-devel.x86_64 libxslt-devel.x86_64 t1lib-devel.x86_64

After this command has been completed, the developer tools will be installed, and we can download LiteSpeed.

Step 3: Downloading LiteSpeed

In this guide, we’re going to install LiteSpeed Standard. You can download this from the LiteSpeed website. Scroll down and look for the LiteSpeed Standard edition for Linux (x86). Right-click the download button and copy the link so you will end up with a link like http://www.litespeedtech.com/packages/4.0/lsws-4.2.24-std-i386-linux.tar.gz. In your server, execute:

wget URL

For example:

wget http://www.litespeedtech.com/packages/4.0/lsws-4.2.24-std-i386-linux.tar.gz

Now unpack the LiteSpeed .tar.gz. In order to do this, execute:

tar -zxvf lsws*

Step 4: Installing LiteSpeed

After downloading LiteSpeed, cd into the LiteSpeed folder and execute the install.sh file:

./install.sh

You will now see the terms. If you agree to them, press the space bar several times to scroll down. After doing this several times, you 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” with a capital Y if you agree.

You will now be asked where LiteSpeed will be installed. If you want to install it in the 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]: 

You will now be asked to enter the username for the administrator so that you can login to the 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]: 

If you want to use the name “admin”, just press enter. It is recommended to change the name for security reasons though, so if you want to use another name, enter it and press enter.

You will now be asked to enter a password for your administrator. You will need to use this password to access the web interface.

Please specify the administrator's password.
This is the password required to log into the administration web interface.
Password: 

Make sure it’s a secure password because anyone who can get access with your administrator user will be able to manage your server.

You will now be asked to enter an email address (or more if you like). If you need to be notified about anything related to your server/LiteSpeed install, the software will send an email to the email addresses listed here to notify you.

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

For example:

Email addresses [root@localhost]: admin@domain.com

Alternatively, if you want to use multiple email addresses, use a comma-separated list like this:

    Email addresses [root@localhost]: admin@domain.com, support@domain.com

You will now be asked to enter the user who the 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]: 

If you are not sure what to enter here, just leave it as “nobody”.

Do the same for the next question.

Please choose the group that the web server running as.
User 'nobody' is the member of following group(s):  nobody
Group [nobody]: 

You will now be asked what port the web server listens on. Generally, you want to put this as port 80 as visitors will not need to enter a port after your URL. In specific situations, you might want to change this, but if there’s no obvious reason to, simply put 80 here.

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

There is an administration web interface available to manage your LiteSpeed web server. This web interface will need to run on another port, such as 7080 (default). You can leave it as default, unless you want it to listen on another port. You will then be able to reach the administration web interface by typing http://domain.com:port.

Please specify the HTTP port for the administration web interface,
which can be accessed through http://<YOUR_HOST>:<ADMIN_PORT>/
Admin HTTP port [7080]: 

You will now be asked if you want to use 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]:

You will now be asked if you want to use AWStats. AWStats is a program that generates statistics so you can see detailed information about visitors. Type y if you want to use AWStats, or N if you do not want this.

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 you will be asked if you want LiteSpeed to start automatically when the server restarts. To prevent downtime, you probably want this, so type Y.

Would you like to have LiteSpeed Web Server started automatically
when the server restarts [Y/n]? Y

If you want to start LiteSpeed now, type Y. If you want to start it later manually, type n.

[OK] The startup script has been successfully installed!
Would you like to start it right now [Y/n]? Y

If everything went fine, you should see the following message:

LiteSpeed Web Server started successfully! Have fun!

When you go to your server IP or domain name now, you will see a default page. You can now get started creating websites!

Step 5: Configuring your firewall

In order to allow traffic to our LiteSpeed web server, we need to open the port for our web server (80) and the administration web interface (7080):

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 7080 -j ACCEPT
service iptables save

If you changed these ports during installation, make sure you change them in the iptables rules as well.

Congratulations, you now have a fully functional LiteSpeed web server. Should you have any questions or issues, please refer to the documentation or the LiteSpeed Support Forums.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!