How to build Webalizer with all its bells and whistles*

My favorite (raw) webhosting statistics package is Webalizer. Several official updates to the program have been published in the last few months, following several years of silence (as far as releases were concerned.) I wanted to use the latest version in my DreamHost account, but could only find instructions for installing the binaries for an older version. After some trial and error, I managed to compile the latest version. In order to enable all of Webalizer’s features, I had to download and build two other packages. My shared server on DreamHost already had all the other dependencies. (If you are following these instructions on another web hosting provider, you may need to download additional packages, in addition to the ones mentioned here.)

The following steps would create a webalizer directory under your shell account’s home directory. The webalizer/sources subdirectory will house the code for Webalizer’s dependencies (at least the code for programs which aren’t already installed on the server. If you’re using a different hosting provider, you may need to download more packages in addition to the ones mentioned here.) The webalizer/lib will contain the compiled libraries which webalizer will require at runtime. The webalizer binary and webazolver link will be stored in the webalizer directory.

For these instructions, make sure to replace USERNAME with the username corresponding to your own shell account.

A script that performs these commands is also available.  You can obtain it at the following web page: https://downloads.domador.net/Scripts/buildwebalizer.sh

Steps

  1. Create the webalizer directory.
    mkdir /home/USERNAME/webalizer/
    
  2. Make the directory where the required library files will be stored.
    mkdir /home/USERNAME/webalizer/lib
    
  3. Make a directory to store the source code for the libraries you will use.
    mkdir /home/USERNAME/webalizer/sources
    
  4. Download and build the bzip2 library (http://www.bzip.org/, http://www.bzip.org/downloads.html)
    cd /home/USERNAME/webalizer/sources
    wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz
    tar xvfz bzip2-1.0.5.tar.gz
    cd bzip2-1.0.5/
    make
    make install PREFIX=/home/USERNAME/webalizer
    
  5. Download anb build the matching version of the Berkeley DB library.
    cd /home/USERNAME/webalizer/sources
    wget http://download.oracle.com/berkeley-db/db-4.4.20.tar.gz
    tar xvfz db-4.4.20.tar.gz
    cd db-4.4.20/build_unix/
    ../dist/configure --prefix=/home/USERNAME/webalizer
    make
    make install
    
  6. Download and build Webalizer (http://www.webalizer.org/, http://www.webalizer.org/download.html)
    cd /home/USERNAME/webalizer/sources
    wget ftp://ftp.mrunix.net/pub/webalizer/webalizer-2.21-02-src.tgz
    tar xvfz webalizer-2.21-02-src.tgz
    cd webalizer-2.21-02/
    ./configure --prefix=/home/USERNAME/webalizer --with-language=english --enable-dns --enable-bz2 --enable-geoip --with-bz2lib=/home/USERNAME/webalizer/lib --with-bz2=/home/USERNAME/webalizer/include
    make
    make install
    
  7. Install the Webalizer binaries in the webalizer folder
    cd /home/USERNAME/webalizer
    cp bin/webalizer .
    ln -s webalizer webazolver
    
  8. Include the following lines at the top of any scripts which run Webalizer.
    LD_LIBRARY_PATH=/home/USERNAME/webalizer/lib:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH

Step 8 is needed in order for Webalizer to find all the libraries it needs to run. An alternative is to compile Webalizer statically by adding the –enable-static parameter to the configure script. Doing this eliminates the need for step 8. However, the webalizer binary grows in size from 320 kilobytes to 1.9 megabytes. According to the compiler messages, there could be other caveats, which aren’t covered in these instructions.

  • cd /home/USERNAME/webalizer/sources
    wget ftp://ftp.mrunix.net/pub/webalizer/webalizer-2.21-02-src.tgz
    tar xvfz webalizer-2.21-02-src.tgz
    cd webalizer-2.21-02/
    ./configure --prefix=/home/USERNAME/webalizer --with-language=english --enable-dns --enable-bz2 --enable-geoip --enable-static --with-bz2lib=/home/USERNAME/webalizer/lib --with-bz2=/home/USERNAME/webalizer/include --with-geodb=/usr/share/GeoIP/
    make
    make install
    

Copyright © 2020 Domador Software S.R.L.