====== Installation/Uninstallation ======
===== Installation =====
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.
You can also use the sudo command to install LSWS into a system directory without enabling the root user, but system folders will still only be manipulable by the root user. This means that every time you want to control LSWS from the command line terminal (like when you want to start or stop LSWS), you will have to use the sudo command.
==== Decompress ====
Decompress the package into a convenient location:
tar xvfz lsws-xxxx.tar.gz
or
gunzip -c lsws-xxxx.tar.gz | tar xvf -
**Note:** Replace ''%%xxxx%%'' in the above filenames with the correct values. It will vary based on the version of LSWS you are installing.
==== Install Trial License Key or Serial Number ====
=== Trial License ===
- A trial license is for evaluation purposes and is only good for 15 days after download. A trial license can be requested from [[https://www.litespeedtech.com/products/litespeed-web-server/download/get-a-trial-license|the LiteSpeed website]].
- A trial license key will be sent to you as an attachment in a confirmation email. Please save the attachment as ''%%trial.key%%'' and copy it to the installation directory.
- When you switch from a trial license to a production license, you can simply run the install script again after following the steps below to update your license.
=== Production License ===
- Licenses can be leased or purchased in [[https://store.litespeedtech.com|the LiteSpeed store]].
- A serial number will be sent to you in the confirmation email after your order has been successfully processed. Each serial number allows for one server installation.
- Save the serial number as ''%%serial.no%%'' in the installation directory (where ''%%install.sh%%'' is located). The LiteSpeed products registration server will use this file to retrieve your license key during the installation process.
==== Begin Installation ====
Run the following commands to go to the installation directory and start LiteSpeed's Installer (remember to replace ''%%xxxx%%'' with the correct value):
cd lsws-xxxx
./install.sh
**Note**: Only by running these commands as the root user can you install the server into a system directory. Other users should install it to somewhere under their home directory.
Read the **End User License Agreement** and type ''%%Yes%%'' to confirm your agreement.
Specify the directory where you would like to install LiteSpeed Web Server. For the root user, the default is ''%%/usr/local/lsws%%''. For non-privileged users, the default is their home directory.
==== Generate License Request ====
If the Installer only finds a serial number but no valid license key, it will prompt you to generate a license request. The installer will talk to the LiteSpeed products registration server and obtain a valid license key automatically. Upon procuring the license key, installation will proceed to the next step.
If the automatic process fails, the installer will exit and leave a license request file. In this case, you can create a ticket for the license department from [[https://store.litespeedtech.com/store/clientarea.php|the LiteSpeed store client area]].
==== Complete Installation ====
Follow the instructions on the screen. The Installer will ask you to set the following:
- If a previously installed copy exists, the Installer will ask you to choose from ''%%upgrade%%'', ''%%reinstall%%'', or ''%%change directory%%''. Upgrading will preserve your current configuration.
- Administrator's username and password for the WebAdmin interface.
- What control panel, if any, you will use with LSWS.
- User and group that the server process will run on behalf of.
- TCP port for normal web service.
- TCP port for WebAdmin interface.
- Whether to set up LiteSpeed PHP.
- The root user has the option to enable ''%%chroot%%''. The installer will set up the initial ''%%chroot%%'' environment automatically. Chroot is an advanced feature and your CGI may fail without configuration tuning. We strongly recommend //not// enabling chroot unless you are familiar with it. You can always enable it later by performing an upgrade installation.
At the end of the installation process, the Installer will ask you if you want to install the AWStats add-on module to keep track of your web statistics. Root user can also choose to run LiteSpeed Web Server automatically at system startup as a service.
Installation is complete! The Installer can now start up the server.
==== Testing Installation ====
**Note**: For detailed information on controlling the server processes, please see the [[https://www.litespeedtech.com/docs/webserver/admin|Administration Guide]].
To start the server, simply run ''%%[your_install_dir]/bin/lswsctrl start%%'' from the terminal.
To access your site, point your browser to ''%%http://[your_domain]:8088/%%'', ''%%[your_domain]%%'' being the IP address or domain name of your web server machine. Use ''%%localhost%%'' if the server is on the machine you are using. ''%%8088%%'' is the default port. If you changed the port during installation, use the port number you designated. A congratulations page should load into the browser. If not, try the WebAdmin Console.
The default port for the WebAdmin Console is ''%%7080%%''. Point your browser to ''%%http://[your_domain]:7080/%%'', ''%%[your_domain]%%'' being the IP address or domain name of your web server machine. Use ''%%localhost%%'' if the server is on the machine you are using. If you changed the port for WebAdmin during installation, use that port instead. The WebAdmin Console welcome page should load. Click the **Log on** link and use the administrator's username and password specified during installation to log on. For detailed information regarding configuration, please refer to our [[https://www.litespeedtech.com/docs/webserver/config|Configuration Guide]], or click the **Help** link on top of each page.
=== Troubleshooting ===
* 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 web site and the WebAdmin interface are inaccessible, please take a look at the error log - ''%%[your_install_dir]/logs/error.log%%''
* If the error log shows a TCP port conflict with other server applications, the web server should be reinstalled with an available port. Use ''%%netstat -an | grep XXXX%%'' to find an available port, where ''%%XXXX%%'' is a port number. If the port is available, the command will produce no output.
* If the error log shows the swapping directory is not writable, you can either grant writing permission for the swapping directory to the user running the web server, or change the swapping directory manually. The swapping directory is configured in the server's XML configuration file located at ''%%[your_install_dir]/conf/httpd_config.xml%%''. Search for ''%%%%''. The default value is ''%%/tmp/lshttpd/swap%%''.
If you still have problems with installation, please check out our [[https://www.litespeedtech.com/support/wiki|wiki]] or post your problem on our support [[https://www.litespeedtech.com/support/forum/|forum]].
===== Upgrading =====
There are a few scenarios where you would need to update or upgrade the server:
* A new release is available
* Upgrade from Standard Edition to Enterprise Edition
* Upgrade from a trial license to production license
* Upgrade/downgrade to a different production license
Upgrade to the latest release, force reinstall, or downgrade to an old version using the command line tool ''%%lsup.sh%%''. See detailed usage information via ''%%[your_install_dir]/admin/misc/lsup.sh --help%%''
===== Uninstalling =====
- Simply run ''%%[your_install_dir]/admin/misc/uninstall.sh%%'' and follow the instructions on the screen.
- The Uninstaller will ask the following questions:
* whether to keep the log directory
* whether to keep the configuration directory
- Directories that were not created by the Installer will not be touched, even if they are in ''%%[your_install_dir]%%''. All the files created by the Installer will be removed.
- ''%%[your_install_dir]%%'' will be removed as well, but only if it is empty.