1. Home
  2. Linux

How to install the Lighttpd web server on Linux

Lighttpd is a slim alternative to the Apache web server for Unix, Linux and Windows server operating systems. Its primary objective is to deliver web content in a fast, secure manner.

The Lighttpd web server is handy, especially for those that need to deliver content on the web on Linux but don’t necessarily have an impressive amount of CPU and RAM.

Setting up the Lighthttpd web server isn’t much like setting up Apache or Nginx on Linux. There are no packages available on the development website. Instead, if you want to use it, you must download a package, and install it manually. Here’s how to do it.

Download Lighttpd RPM package

A while ago, there was a Lighttpd RPM package for CentOS/RedHat Enterprise Linux. However, it seems that the developers of the web server don’t distribute these anymore. So, if you’d like to use Lighttpd, the source code is required.

Get wget

To download the source code, you will need the wget downloading tool. As most server operating systems don’t always include this program, installation is required.

Ubuntu

sudo apt install wget

Debian

sudo apt-get install wget

Arch Linux

sudo pacman -S wget

CentOS

sudo yum install wget

Fedora

sudo dnf install wget

OpenSUSE

sudo zypper install wget

Once you’ve got the wget downloading tool up a d running on your Linux server (or Desktop you’re using as a server,) use the CD command and move the terminal session to the /tmp directory.

Doing the downloading in the /tmp (aka temporary) directory will ensure that once the software is up and running, it doesn’t litter your file system.

cd /tmp

Source code

Now that the terminal is in the temporary directory invoke wget and grab the source code release of lighttpd.

wget https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.52.tar.gz

Alternatively, if you have issues with the TarGZ release, the developers have a TarXZ release available.

wget https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.52.tar.xz

The lighttpd web server package should take a couple of seconds to download, depending on your internet connection. When the process is complete, move on to the next section of this tutorial.

Extract source code

With the code now done downloading on Linux server system inside of the temporary directory (/tmp), it is now time to extract the code from its archive. Extracting the Lighttpd code files on Linux is done with the tar command.

In a terminal, write tar with the “zxvf” switches. This will allow you to extract and view the contents of the TarGZ archive.

tar zxvf lighttpd-1.4.52.tar.gz

Alternatively, if you downloaded the TarXZ archive instead of the TarGZ, you will need to use the tar command with a different set of switches. Specifically, the “xvJf” ones.

tar xvJf lighttpd-1.4.52.tar.xz

With the code extracted, run the CD command and move the terminal into the new folder.

cd lighttpd-*

From there, use ls and view the contents of the directory.

ls

Compile Lighttpd on Linux

Building the Lighttpd web server has a few steps. It’s not overly complicated, and it starts by installing the required dependencies.

Ubuntu

sudo apt install libpcre3-dev libbz2-dev zlib1g-dev

Debian

sudo apt-get install libpcre3-dev libbz2-dev zlib1g-dev

Arch Linux

sudo pacman -S pcre-8 zlib bzip2

Fedora

sudo dnf install pcre-devel zlib-devel libbz2-devel

OpenSUSE

sudo zypper install pcre-devel zlibary-devel libbz2-devel

With the dependencies installed, it’s time to scan your system and create the make files on the system. Make files are created with the “Configure” script.

./configure

Let the script run. It may take a few times of running and re-running the script, especially if it determines your system is missing dependency files.

In our guide, we do our best to help you install the dependencies that the script needs to generate the Make files correctly. However, it may not always work. If you have issues, check the documentation.

Once Configure is done, it’s time to build the installation using the Make command.

make

sudo make installĀ 

When everything is done installing, will need to configure the server. To do this, head over to the official website.

Distribution-specific packages

For the most part, Lighttpd doesn’t go out of its way to maintain distro-specific packages for their web server. For this reason, we’ve covered how you can compile and build the source code. Furthermore, downloading the source code is a good way to ensure that you can get the latest release of the software, regardless of what your Linux OS is. With that said, some distributions may have a Lighttpd web server package in their primary software sources.

To find out more, head over to pkgs.org. On the page, you’ll see information about listed for several Lighttpd packages. Though, keep in mind that if you install the distribution-specific releases, it may not be updated as often as getting it straight from the developers.

Leave a comment