LiteSpeed web server is a popular choice and an alternative for replacing the Apache web server. It is the 4th most popular web server on the the Internet these days. The LiteSpeed web server will improve your system performance and lower its operating cost. It is compatible with commonly used Apache features like mod_rewrite, .htaccess, and mod_security. Using LiteSpeed web server you can load apache configuration files directly and it works as a drop-in replacement for the apache web server. This guide will help you to install the LiteSpeed web server on CentOS 7.
To install LiteSpeed web server you'll only need a CentOS 7 server with root privileges on it. Remember you can always switch between root user and non root user using
Updating the System
Before going through the installation process it is recommended you update the system to upgrade the available packages and to do so run following command.
yum -y update
Installation must be performed in a command line terminal. For testing purposes, LiteSpeed Web Server can be installed into a home directory by a non-privileged user. For production use, it should be installed into a system directory.
Install Developer Tools
To download and install LiteSpeed web server first we have to install the developer tools that are required for installing it.
Please run following command to install developer tools.
yum groupinstall 'Development Tools'
Now you'll have to install libraries for LiteSpeed web server so install them all using this command as shown below.
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
We have successfully installed the developer tools and libraries so now we can further proceed to downloading the LiteSpeed package.
The version for 64Bit Linux systems should be the Linux (x86_64) which is default on today's server so we have to install LiteSpeed web server compatible with this version.
But if you are unsure about the kernel version then run the command:
It will return the kernel version. If it contains the word "x86_64" then you run a 64Bit Kernel.
Now we will use wget command to download the latest stable release of LiteSpeed web server, You can check for latest release on this LiteSpeed Website .
If in case you don't have wget package already installed on your system then you can download using
yum install wget.
Now use the wget command to download the LiteSpeed web server as shown below.
Now extract the downloaded file and to do so run below given command.
tar -zxvf lsws*
The installation will be started by running install.sh file located in LiteSpeed folder. So change the directory to LiteSpeed and then run below given command.
By running this command, the license agreement terms will be prompted on your screen. If you are in agreement of the terms then please press space bar several times to scroll down untill you'll see this:
IMPORTANT: In order to continue installation you must agree with above license terms by typing "Yes" with capital "Y"!
Press a capital Y to continue installation now you'll be asked to select the directory for installation. To install in the default directory simply hit Enter button when you'll see this on your 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 directory. Destination [/usr/local/lsws]:
Now you'll be asked to enter an administrator username and password so please provide the details and hit enter button. The password is necessary for logging into web interface later. The screen will look like 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. But, we recommend that you should 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. Password:
The password that you use must be strong enough that no one can guess or access by random methods. Otherwise, they may be able to manage, and access your server.
You will now be asked to enter an email address, to mail any important or urgent information related to installation or may be for maintenance of your server so please enter your email address, you can add more than one 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 [root@localhost]:
Email addresses [root@localhost]: firstname.lastname@example.org
You will now be asked 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". You should see following output on your screen.
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 unsure of what to enter then 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 Group [nobody]:
You'll now be asked to provide the details on which port LiteSpeed shall listen. Port 80 is default port for web servers and we recommend you 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. You should see following output on your screen.
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 : 80
Simply enter the port number. As shown above we entered the port number 80 which is default port for web servers.
Now you'll asked to provide a separate administration interface to ease management of the web server. Port 7080 is the default port that it runs on. You can change it if you are specific about listening on other port. But remember to open up administration web interface, the web URL must be given as http://domain.com:port. You should see following output on your screen as shown below.
Please specify the HTTP port for the administration web interface, which can be accessed through http://<YOUR_HOST>:<ADMIN_PORT>/ Admin HTTP port :
The next prompt will ask you for the details regarding usage of PHP. If you are using a CMS like wordpress or any other then PHP needs to be enabled. To enable PHP please press 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]:
Now you'll be asked to provide details in case you are interested in using AWStats. If you want detailed visitor information then type Y otherwise type N to continue further installation process.
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
Now you'll see following output on your screen.
Would you like to have LiteSpeed Web Server started automatically when the server restarts [Y/n]? Y
We recommend you to type Y to avoid down times in a server. Now you'll see a result like this on your screen.
[OK] The startup script has been successfully installed! Would you like to start it right now [Y/n]? Y
You can type N to start it manually later but we recommend you to type Y and start it right now.
You'll see following message displayed on your screen on successful installation of LiteSpeed web server.
LiteSpeed Web Server started successfully! Have fun!
You can access your LiteSpeed server open your favorite web browser and visit http://yourserverIP and you'll see a default web page.
Run these below given commands to configure firewalld.
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-port=7080/tcp
Now reload the firewalld services using this command as shown below.