How to install LiteSpeed web server on CentOS 7
LiteSpeed web server is a popular choice for replacing Apache web server. Its features include an optimization of the web content and content delivery which maximizes the download speed and combines better performance with a smaller memory footprint. Being compatible with Apache features is also an added benefit, which helps to reduce downtime during migration from Apache to LiteSpeed. This installation assumes that you have installed a clean CentOS 7 server.
There are 3 editions of this software available:
- OpenLiteSpeed is the open-source version of the LiteSpeed server.
- The LiteSpeed standard edition, as well as OpenLiteSpeed, are available free of charge.
- LiteSpeed is also available in advanced commercial web server package.
Before any server package installation, the server must be checked for updates and these have to be installed. So we start with the command yum update.
yum update -y
The output should be similar to the one below:
This may take some time, depending on how frequently the server is updated. Do not interrupt the update.
Installing the Developer Tools for LiteSpeed
Use these yum commands to install the development tools first and then the libraries for LiteSpeed.
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
The install output should be similar to the one below:
After installing the said developer tools, one can proceed to download the free standard package from LiteSpeed.
Downloading LiteSpeed Package using wget
To get the LiteSpeed standard edition package file, one must acquire the web link at which this is available. To get this, one can go to LiteSpeed website and search for Linux (x86_64) LiteSpeed Standard edition, that's the version for 64Bit Linux systems which should be the default on today's server.
If you are unsure, run the command:
Which returns the Kernel version. If it contains the word "x86_64" then you run a 64Bit Kernel.
To copy the link, right click on it and select copy link address. The address to the link may resemble:
Now use the wget command and append the link address to it. The format to use wget is:
Following the above example, the command to download LiteSpeed Standard Edition is:
Next step is to unpack the tar file. Execute the folowing command to do the same.
tar -zxvf lsws*
Installation of LiteSpeed
The installation is started by running the install.sh file located in LiteSpeed folder. In order to do so, change directory to LiteSpeed and then follow the execute command as shown below:
Upon running this command, user agreement terms are showcased. One can scroll down the terms and conditions agreement by pressing the space bar, and reach the declaration at the end which displays:
IMPORTANT: In order to continue installation you must agree with above
license terms by typing "Yes" with capital "Y"!
Upon agreement, press Y, which prompts the user to select the directory for installation. To continue installation in a default directory simply hit enter, when the following comes on screen.
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
A prompt which asks to enter administrator username and password details comes up. The password is necessary for logging into web interface later. Continue giving appropriate details and hit enter. The screen will look like the following:
Please specify the user name of the administrator.
This is the user name required to log into the administration web interface.
User name [admin]:
In the event that you want to use the name "admin", simply press enter. I recommend that you change the name for security reasons. Enter your custom administrator username and hit enter.
You will now be asked to enter a password for your administrator user. You will need to use this password later to access the web interface.
Please specify the administrator's password.
This is the password required to log into the administration web interface.
The password that you use must be secure so that no one can guess or access it via random methods. Otherwise, they may be able to manage, and access your server.
The prompt will then ask for an email address, to mail any important or urgent notification related to installation or server performance and maintenance. You can add a list of email addresses separated by commas.
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 [[email protected]]:
Email addresses [[email protected]]: [email protected]
When providing a list of email addresses, the following syntax must be followed.
Email addresses [[email protected]]: [email protected], [email protected]
The installer will then prompt to provide the user name under which this server is run. You can either create a separate user with non-root privileges and provide the details here or choose the default user "nobody". It is important that root user should not run the server. It makes the server vulnerable and insecure. The following is displayed on screen which prompts you to enter the user name.
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
When you are unsure of what to enter, it is best to leave the username as ''nobody''. Continue this in the next prompt which resembles the following:
Please choose the group that the web server running as.
User 'nobody' is the member of following group(s): nobody
The next prompt is for providing details on which port LiteSpeed shall listen. The default port for web servers is port 80 and I recommend to keep that. This helps in simplifying the URL for the visitors, which otherwise would have required the mentioning of the port number after the URL. For specialized access, this port number may be changed to appropriate value.
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
You can access the normal web page at http://<YOUR_HOST>:<HTTP_PORT>/
HTTP port : 80
LiteSpeed provides a separate administration interface to ease management of the web server. The default port that it runs on is 7080. You can change it if you are specific about listening on other port. To open up administration web interface, the web URL must be given as 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 :
Then the prompt will ask for details regarding usage of PHP. In case you are using a CMS like, WordPress or Joomla, PHP needs to be enabled. To enable PHP, enter Y otherwise type N.
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
After this prompt, you can specify a different PHP file extension. Normally it is not necessary to specify a different extension here, so just hit enter and proceed further.
Suffix for PHP script(comma separated list) [php]:
The next prompt asks for providing details in case you are interested in using AWStats. This is a program which is a statistics generation tool used to check visitor numbers, page views etc. To be able to collect detailed visitor information, enter Y otherwise type N and proceed further.
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
The next prompt will probe whether you prefer LiteSpeed to run automatically whenever the server is restarted. Write Y to avoid downtimes in a server.
Would you like to have LiteSpeed Web Server started automatically
when the server restarts [Y/n]? Y
This, when executed, notifies about successful startup script addition for LiteSpeed and prompts the user to choose to start the server right now. Type Y to do the same, or N to start it manually at a later stage. I recommend to start it right now.
[OK] The startup script has been successfully installed!
Would you like to start it right now [Y/n]? Y
Upon successful installation, the following message is displayed.
LiteSpeed Web Server started successfully! Have fun!
After this is successful installation message, accessing server by IP or the domain name will open up a default web page. Now, you can get building your website.
To allow the visitor traffic to access the server, web ports, 80 (server port) and 7080 (administration web interface) must be opened. Most CentOS 7 Servers use firewalld, These commands open the ports in firewalld:
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-port=7080/tcp
If you use a IPTables firewalla nd not firewalld, then use these commands instead.
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 7080 -j ACCEPT
service iptables save
In case you have altered the port numbers during script installation, do reflect the same in the iptables and firewalld rules.
Congratulations on your new functional LiteSpeed server.