Install OLS from Source Code for 1.5 and lower version

How Can We Help?
< Back
You are here:
Print

Installation of OLS 1.5 or lower version from Source Code

OpenLiteSpeed can also be installed from source code through a command line terminal as detailed below. The following KB is for OLS 1.5 and the lower version only. While starting from 1.6 and later version, we will use ./build.sh to compile and build,  and ./install.sh to install to the destination. ./configure is not valid to OLS 1.6 and above.  Please refer to this guide for detailed steps for OLS 1.6 and above build from source.   OLS 1.5 supports both  ./configure and ./build.sh scripts hence you can choose either way you prefer.

OpenLiteSpeed will normally be installed by root user at default location at /usr/local/lsws. For production use, it should be installed into a system directory which requires root access or using sudo). Openlitespeed can also be installed into a home directory by a non-privileged user. The following instructions will assume OpenLiteSpeed to be installed by root. For non-root user installation, please refer here

Dependencies

OpenLiteSpeed requires pcre, expat, openssl, geoip, udns, and zlib to be installed before you run the configure command.

Below you will find instructions for installing the packages depending on your system.

CentOS 5, 6 and 7

You may need to enable EPEL repository to get access to some of these packages.

yum install epel-release
yum install gcc gcc-c++ make autoconf glibc rcs git
yum install pcre-devel openssl-devel expat-devel geoip-devel zlib-devel udns-devel

Ubuntu/Debian

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install rcs libpcre3-dev libexpat1-dev libssl-dev libgeoip-dev libudns-dev zlib1g-dev libxml2 libxml2-dev libpng-dev openssl git

FreeBSD

Use pkg or ports.

Here are some examples using ports.

If ports not installed, please install as the following or refer to https://www.freebsd.org/doc/handbook/ports-using.html

To download a compressed snapshot of the Ports Collection into /var/db/portsnap:

# portsnap fetch

When running Portsnap for the first time, extract the snapshot into /usr/ports:

# portsnap extract

Then install required packages using ports:


cd /usr/ports/devel/pcre; make install clean; rehash;
cd /usr/ports/devel/rcs; make install clean; rehash;
cd /usr/ports/dns/udns; make install clean; rehash;
cd /usr/ports/textproc/expat2; make install clean; rehash;
cd /usr/ports/security/openssl; make install clean; rehash;
cd /usr/ports/lang/perl5.26; make install clean; rehash;

Note: you should use perl5.26 as indicated above, other Perl version may cause an issue at the time of this writing.

then download package run

./configure --with-pcre=/usr/local

Mac OS X

  1. Install Xcode from https://developer.apple.com/xcode/ (This requires registering with your AppleID.)
  2. Download Command Line Tools for Xcode from the Apple Developer page above.
  3. Install MacPorts from http://www.macports.org/install.php#pkg
sudo port install pcre expat openssl rcs libgeoip zlib libudns

Installation Steps

  • Download the package into a convenient location and decompress it.
  • Go to the installation directory, compile, and install the package as the root user (for production use):
cd openlitespeed-1.x.x
./configure
make && make install

Note1: A number of options and settings can be configured pre-installation. Use ./configure --help to see the configurable options.

  • By default, the Installer will install a sample site on port 8088 and set the WebAdmin console (the LiteSpeed GUI) to port 7080. (user: admin password: 123456 for the earlier version, and “admin” and randomly generated password from v1.6.5 and v1.5.11.)

Note2: On newer versions of OS X, you may have to use ./configure CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib --with-openssl=/opt/local as recent versions of OS X have deprecated usage of the OpenSSL library. On FreeBSD, you may have to use  ./configure --with-pcre=/usr/local

Note3: Check here on how to enable HTTP2 support during the configure.

Note4: Normally install openlitespeed as root user and the default installation directory is /usr/local/lsws. In some rare case, you might want to install as a non-root user and to a home directory, you will need to set prefix at configure. For example, ./configure –prefix=/home/$USER1/lsws

Errors

If you run into errors or problems during installation, please consult our errors article for common problems.

Install PHP

OpenLiteSpeed use php build with LSAPI. For CentOS/Ubuntu/Debian, LSPHP can be installed through RPMS. If RPMS are not available for your system, such as FreeBSD and Mac OS, you may compile PHP by yourself.

Installing LSPHP via RPM

Installing LSPHP via APT

Compile PHP for LSWS

  • On CentOS, the shipped php binary /usr/local/lsws/fcgi-bin/lsphp can be run but it is only for testing purpose. On FreeBSD, Mac OS X, and Ubuntu the shipped PHP (for CentOS) will not run any all. On any case, you need to follow the above steps to setup PHP properyly.

Getting Started

  • The default installation directory is /usr/local/lsws.
To start the server, simply run /usr/local/lsws/bin/lswsctrl start. (To stop it, run /usr/local/lsws/bin/lswsctrl stop.)
  • A sample site should be running on the server.
To access your site, point your browser to http://[address]:8088/, [address] being the IP address or domain name of your web server machine. Use “localhost” if the server is on the machine you are using. By default, OpenLiteSpeed runs on port “8088”.
A congratulations page linked to other testing pages should load into the browser when pointed to the above address. If not, try testing the WebAdmin interface.
  • The default port for the WebAdmin console is 7080.
Plug https://[address]:7080/, into your browser to go to the WebAdmin interface.
Remember the “https://” and that for [address] you can use “localhost” if you’re currently using the machine the server is on.
A login page should load. 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.
For detailed information regarding configuration, please refer to our Configuration Guide, or click the “Help” link at the top of each page.
  • If your server uses a firewall, please make sure that localhost is trusted.
For instance, Linux with IPTables should include a rule ALLOW INPUT from LO.
  • If your website and the WebAdmin console are inaccessible, please take a look at the error log /usr/local/lsws/logs/error.log.
If there is a TCP port conflict with other server applications, you will need to stop the application currently running on port 7080. The following command can be used to check port 7080: netstat -an | grep 7080. If the port is available, the command will produce no output.
If the swapping directory is not writable, you can either grant writing permission for the swapping directory to the user whom the web server is running as, or change the swapping directory’s configurations manually. The swapping directory is configured in the server’s XML configuration file: /usr/local/lsws/conf/httpd_config.xml. Search the XML file for “swappingDir”. The default location for the swapping directory is /tmp/lshttpd/swap.
If you still have problems with installation, please check the OpenLiteSpeed Development Group.

Uninstallation Steps

  • Stop OpenLiteSpeed if it is running: /usr/local/lsws/bin/lswsctrl stop
  • Remove the install directory: rm -rf /usr/local/lsws

Upgrading

You can change your OpenLiteSpeed version by simply installing a different version of OpenLiteSpeed. Re-installing will not affect your configuration files.