Webalizer statistics on DreamHost

In my last post, I detailed the way in which you could activate the Analog statistics application on DreamHost accounts with root WordPress installations. I’m really not a fan of Analog, though – my preferred application for statistics tracking is Webalizer.

I’ll describe the best way to install Webalizer in this shared hosting environment, with information distilled from the DreamHost Customer Support Wiki.

First, you’ll need shell (SSH) access to your Dreamhost account. Once you’ve logged in, carry out the following tasks:

  1. Make a new directory in your home path called webalizer. Also make a new directory for your domain’s statistics.

    mkdir ~/webalizer
    mkdir ~/example.com/webalizer

  2. Change to the directory.

    cd ~/webalizer

  3. Open a new links browser instance to the Webalizer download page.

    links http://www.mrunix.net/webalizer/download.html

  4. When Links opens, press Enter to bypass the information box if it appears.
  5. Arrow down to the Linux ELF – Binary x86 link. (You don’t need the static binary.) Press d to download the file, and then press Enter to save the .tgz file.
  6. Once the file is downloaded, press q and then Enter to exit Links.
  7. Extract the .tgz file (change the version number if necessary).

    tar -zxf webalizer-2.01-10-linuxelf-x86-bin.tgz

  8. Move the contents of the versioned Webalizer directory to the ~/webalizer directory, and delete the version numbered extraction directory.

    mv webalizer-2.01-10-linuxelf-x86/* .
    rm -rf webalizer-2.01-10-linuxelf-x86/

  9. Copy the sample.conf file to a new file with your domain name.

    cp sample.conf example.com.conf

  10. Edit the example.com.conf file using your preferred editor. You will want to uncomment and change the following lines to reflect the DreamHost configuration:

    TheLogFile line should read:
    LogFile /home/username/logs/example.com/http/access.log.0

    The OutputDir command should be:
    OutputDir /home/username/example.com/webalizer/

    The Incremental option should be enabled:
    Incremental yes

    And the IncrementalName directive should be uncommented:
    IncrementalName webalizer.current

  11. Save the file, then run the webalizer application:

    ./webalizer -c example.com.conf

  12. Browse to your site’s webalizer directory and view the statistics. The URL is:

    http://example.com/webalizer/

In order to retrieve each day’s statistics and have Webalizer parse them, you need to set up a cronjob to automatically run each day after midnight. 2 AM is about the best bet for the cycle to run.

  1. Set your EDITOR variable to vi, so that your commands all are on the same line.

    export EDITOR=vi

  2. Edit your crontab file:

    crontab -e

  3. Add the following line to the crontab file. (Press i for Insert mode to begin typing in vi. To exit, type :wq.)

    0 2 * * * /home/username/webalizer/webalizer -c /home/username/webalizer/example.com.conf >/dev/null 2>&1

Your cronjob will now run at 2AM every day, processing the previous day’s log entries.


If you want to secure your /webalizer/ directory from prying eyes, you can create a .htaccess file under ~/example.com/webalizer/ with the following information:

AuthName "Webalizer Statistics"
AuthType Basic
AuthUserFile /home/username/example.com.stats.htpasswd
Require valid-user

Then, use Apache’s htpasswd tool to create the .htpasswd file:

htpasswd -c /home/username/example.com.stats.htpasswd useraccount

You will be prompted for a password for the user account. To add more users to this file, run the htpasswd command without the -c flag:

htpasswd /home/username/example.com.stats.htpasswd anotheruser


While there’s a lot of information to digest, Webalizer is an excellent tool for tracking web statistics and the user interface is slightly more friendly than Analog. I plan to use the two applications concurrently – Analog seems to do a better job of tracking referral URLs and Webalizer provides colourful graphs.

Update 3/07/2007: I’ve updated the crontab section to reflect that the full /home/username/webalizer/example.com.conf path needs to be passed for the -c flag.