Webalizer Install

Webalizer may now come pre-installed on many versions of Linux (e.g. CentOS). Unfortunately, it also appears to come pre-broken on these same versions. So, if you install it and it doesn't work, you may want to remove the RPM and try again, as described below.

If you wish, you can download the latest Webalizer tar file from http://www.mrunix.net/webalizer/download.html. Any currently installed version of Webalizer should work with the latest Apache. Furthermore, development on Webalizer is fairly static but having the latest version of Webalizer is cool so untar it in the top level source directory (e.g. /rpm/webalizer):

     tar -xvzf webalizer-a.b-yy.tar.gz

It will create a new directory for that version of Webalizer. Switch to that directory and build Webalizer:

     cd Webalizer-a.b.yy
     ./configure --enable-dns --with-dblib=ldb-4.0
     make

Note that the Webalizer configure script finds db_185.h in the correct place but then screws up when it comes to finding the actual link library containing the db 185 modules. It configures the makefile to link with ldb1 instead of ldb-4.0. If you are running on a system where configure figures this out properly, the "--with-dblib" parameter may be omitted.

A Webalizer userid should be set up to run Webalizer under. No home directory is required and the userid is usually set up as a system userid. All of the typical Linux installations come with one already installed but if yours doesn't do the following:

     /usr/sbin/useradd -c "Web statistics package" -d /var/www/html/usage \
       -r -s /sbin/nologin -u 67 webalizer

Installing Webalizer is simple. The executable itself is copied to a system directory, a symlink is added to give it an alternate name and then a couple of png files are copied to the directory where the Web statistics will be written. Switch to super-duper user and install Webalizer:

     su
     cp webalizer /usr/local/bin/webalizer
     chown webalizer:root /usr/local/bin/webalizer
     chmod u=rwx,go=rx /usr/local/bin/webalizer
     ln -s /usr/local/bin/webalizer /usr/local/bin/webazolver
                                                      (if not already there)
     chown webalizer:root /usr/local/bin/webazolver

You can try the "make install" command (which also copies the documentation), if you wish but doing it by hand gets the permissions correct. At the very least, you probably want:

     su
     make install
     chown webalizer:root /usr/local/bin/webalizer
     chmod u=rwx,go=rx /usr/local/bin/webalizer
     chown webalizer:root /usr/local/bin/webazolver

If the usage directory is not already part of the html tree, create it and copy the logos into it:

     mkdir /var/www/html/usage
     cp webalizer.png msfree.png /var/www/html/usage
     chown webalizer:root -R /var/www/html/usage
     chmod u=rwx,go=rx -R /var/www/html/usage

Also, the directory where the history, incremental checkpoint and DNS cache are to be kept should be created, if not already done:

     mkdir /var/lib/webalizer
     chown webalizer:root /var/lib/webalizer
     chmod u=rwx,go=rx /var/lib/webalizer

The sample Webalizer config file should be put in /etc/webalizer.conf. Here are some of the high spots that you might want to configure:

     LogFile         /var/log/httpd/access_log
     OutputDir       /var/www/html/usage
     HistoryName     /var/lib/webalizer/webalizer.hist
     Incremental     yes
     IncrementalName /var/lib/webalizer/webalizer.current
     PageType        htm
     PageType        cgi
     PageType        shtm
     PageType        pdf
     PageType        php
     PageType        pl
     DNSCache        /var/lib/webalizer/dns_cache.db
     DNSChildren     10
     Quiet           yes

Finally, you will need to add a file into the cron.daily directory to cause the webalizer to be run every day.

/etc/cron.daily/webalizer:

     #! /bin/bash
     # Update access statistics for the local Web site(s).
     if [ -s /var/log/httpd/access_log ] ; then
         /usr/local/bin/webalizer
     fi
     exit 0

Don't forget to set its permissions as follows:

     chown root:root /etc/cron.daily/webalizer
     chmod u=rwx,go=rx /etc/cron.daily/webalizer