OpenLiteSpeed is a high-performance, open-source web server known for its speed, security, and ease of use. It is the free version of LiteSpeed Enterprise and offers a user-friendly web interface for configuration and management. If you are looking for an efficient way to host web applications, learning how to install OpenLiteSpeed on Ubuntu 20.04 is essential. In this guide, we will take you through the step-by-step process of installing and configuring OpenLiteSpeed on your server.
Prerequisites
Before you begin, ensure you have the following:
- A fresh Ubuntu 20.04 server instance
- A non-root user with sudo privileges
- SSH access to your server
- A stable internet connection
- Basic knowledge of Linux command-line operations
How to Install OpenLiteSpeed on Ubuntu 20.04
Step 1: Update System and Install Required Packages
Before installing OpenLiteSpeed, it is important to update your system to ensure you have the latest security patches and software updates. Run the following command:
sudo apt update && sudo apt upgrade -y
After updating your system, install the required dependencies. These are necessary libraries and tools that OpenLiteSpeed relies on to function properly:
sudo apt-get install build-essential libexpat1-dev libgeoip-dev libpcre3-dev zlib1g-dev libssl-dev libxml2-dev rcs libpng-dev
Install PHP and Required Extensions
OpenLiteSpeed is optimized for PHP-based applications. To ensure proper functionality, install PHP and commonly used extensions:
sudo apt-get install php php-common php-curl php-mysql php-opcache php-imap php-opcache php-cli php-mbstring php-xml php-zip
Install MySQL
If you are planning to host a website or application that requires a database, install MySQL:
sudo apt-get install mysql-server
After installation, secure MySQL by running the following command and following the on-screen instructions:
sudo mysql_secure_installation
Step 2: Install OpenLiteSpeed
There are multiple ways to install OpenLiteSpeed on Ubuntu 20.04, and we will cover three different approaches.
Option 1: Install from the Repository
This method installs OpenLiteSpeed using the official LiteSpeed repository, ensuring you get the latest stable version.
Download the OpenLiteSpeed repository script using:
wget http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh
Run the script to enable the repository:
sudo bash enable_lst_debian_repo.sh
Install OpenLiteSpeed:
sudo apt-get install openlitespeed
Start the OpenLiteSpeed service:
sudo systemctl start lsws
Enable OpenLiteSpeed to start at boot:
sudo systemctl enable lsws
Option 2: Install from Binary File
For those who prefer a manual installation, downloading and compiling the binary package is another option.
Download the latest stable version of OpenLiteSpeed:
wget https://openlitespeed.org/packages/openlitespeed-1.7.14.tgz
Extract the downloaded archive:
tar -xvzf openlitespeed-1.7.14.tgz
Navigate to the extracted directory:
cd openlitespeed
Run the installation script:
sudo bash install.sh
Start OpenLiteSpeed:
sudo /usr/local/lsws/bin/lswsctrl start
Option 3: One-Click Install for WordPress Users
If you are setting up a WordPress site, the one-click install script simplifies the entire process by installing OpenLiteSpeed, PHP, MySQL, and WordPress in one go.
Download the script:
wget https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh
Run the script:
sudo bash ./ols1clk.sh
Step 3: Configure OpenLiteSpeed
Once OpenLiteSpeed is installed, configure the administrator username and password for the web interface:
sudo bash /usr/local/lsws/admin/misc/admpass.sh
You will be prompted to enter a username for the administrative user. If you press ENTER without specifying one, the default username admin will be used. You can choose any administrative username you prefer.
Next, you will be asked to create and confirm a new password for the account. Enter your desired administrative password and press ENTER again.
Once completed, the script will confirm that the update was successful.
Output
Administrator's username/password is updated successfully!
Step 4: Configure Firewall Settings
To ensure that OpenLiteSpeed functions properly, you need to allow traffic through the necessary ports:
sudo ufw allow 8088/tcp sudo ufw allow 7080/tcp sudo ufw enable
- Port 8088 is used for accessing the OpenLiteSpeed web server.
- Port 7080 is used for logging into the OpenLiteSpeed admin panel.
Step 5: Access OpenLiteSpeed Web Interface
Now that OpenLiteSpeed is installed and configured, access the web interface by opening a browser and entering your server’s IP address followed by the relevant port.
To check if OpenLiteSpeed is running, visit:
http://your-server-ip:8088
To log in to the OpenLiteSpeed Web Admin, go to:
http://your-server-ip:7080
Enter the credentials set in the previous step.
Step 6: Additional Configurations
Change Default Port
By default, OpenLiteSpeed runs on port 8088. To change this, log in to the admin panel and modify the listener settings.
Enable SSL for Secure Connections
To enable HTTPS, generate an SSL certificate and configure it in OpenLiteSpeed’s admin panel.
sudo certbot --apache -d yourdomain.com
Conclusion
Now you know how to install OpenLiteSpeed on Ubuntu 20.04. This powerful and lightweight web server is an excellent choice for optimizing web applications. Whether you install it manually or use the one-click script for WordPress, OpenLiteSpeed ensures faster and more secure hosting. Additionally, configuring firewall rules and enabling SSL will further enhance security. Start exploring its features today and optimize your web hosting experience!