Building Webalizer v2.01 on Linux

The purpose of this article is to document the steps that were taken to install Webalizer v2.01-10 from source code on my Fedora Core 2 machine. This article discusses three optional means you can get started:

  • Quick Method - using the YUM installer
  • Installing from source code
  • Installing from source code with DNS reverse Look up support

Quick Method - YUM!

Assuming that your system has the YUM installed, this would be the easiest route to go for sure. You can see if your system has YUM installed and configured by issuing the following command:

yum search webalizer

This command on Fedora Core 2 will yeild the following:

[root@canon root]# yum search webalizer
Gathering header information file(s) from server(s)
Server: Fedora Core 2 - i386 - Base
Server: Fedora Core 2 - i386 - Released Updates
Finding updated packages
Downloading needed headers
Looking in available packages for a providing package
Available package: webalizer.i386 0:2.01_10-22 from base matches with webalizer
1 results returned
Looking in installed packages for a providing package
No packages found

Issue the following command:

yum install webalizer 

Yum will install the rpm pkg and prompt for dependencies.

Installing Webalizer from Source

Since I maintain my own compiled versions of apache2, php, and openssl, I figured it would be better to compile it from source myself to retain control over where it installs.

The following sequence should be used to get webalizer setup:

  1. download the source from
  2. use gzip to unzip the source: gunzip webalizer-2.01-10.tar.gz
  3. use tar to unpack the archive: tar -xvf webalizer-2.01-10.tar

enter the webalizer-2.01-10 source directory and do the following

make install

Installing Webalizer from source with DNS looukp support

After reading about Webalizer's ability to perform DNS lookups, I wanted the tool to perform DNS lookups to resolve the IP address data in my Apache web logs and present fully-qualified domain information in the webalizer output data. To enable the DNS resolution capability, simply add '--enable-dns' to the configure command:

./configure --enable-dns

This command failed when I first attempted it. It failed b/c my system did not have Berkeley DB 1.85 installed. I downloaded a copy of the source code and patches from . The build instructions were not readily available and the software is somewhat dated. An alternative solution that worked on my Fedora Core 2 system was to download an old Red Hat 7.3 RPM and install that directly. you can obtain a copy of this RPM here.

Install the rpm using the following command:

rpm -ivh db1-1.85-8.i386.rpm

Then repeat the steps to build the webalizer from source:

./configure --enable-dns --with-db=/usr/lib
make install

Lastly, copy /etc/webalizer.conf.sample to /etc/webalizer.conf and edit the file to your liking. All that is needed to run the webalizer is 'webalizer -c /etc/webalizer.conf'.

How do I view postfix smtp mail queues?

Use the following command to view the current postfix MTA queue:

# postqueue -p

You should see something like the following for output:

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
4C63F2300BA 876 Mon Jun 5 09:31:54 This email address is being protected from spambots. You need JavaScript enabled to view it.
(connect to[]: Connection timed out)

This email address is being protected from spambots. You need JavaScript enabled to view it.
-- 1 Kbytes in 1 Request.

How do I delete items from a postfix mail queue?

I have queued entries in my Postfix MTA deferred queue. I want to clear the queue. How do I do that? First you should view the queue with the following command:

# postqueue -p
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
4C63F2300BA 876 Mon Jun 5 09:31:54 This email address is being protected from spambots. You need JavaScript enabled to view it.
(connect to[]: Connection timed out)
This email address is being protected from spambots. You need JavaScript enabled to view it.
-- 1 Kbytes in 1 Request.

To Remove a particular component from the queue, issue the following command:

# postsuper -d 4C63F2300BA

That will remove the item from the queue. You should see notifications in the /var/log/maillog on Linux systems.

Reset lost root password in MySQL

This is a handy procedure that can be used to reset the root password for the MySQL account. I had to use this procedure on a failed installation. It appeared that I had a problem with the bin/install_db command, and it failed to pre-populate the mysql.user table with the correct initial permissions and grants. Without this information, I was dead in the water. I had an empty grant / access table so I couldn't log in.

The following sequence was taken to correct this problem:

  1. stop the server

    /etc/init.d/mysql.server stop
  2. start the server, but tell it to skip the grant tables

    /opt/mysql/bin/mysqld_safe --skip-grant-tables &
  3. login as root user

    /opt/mysql/bin/mysql -u root -p

At this point, you should be able to change passwords. In my case, I needed to rebuild the initial database schema and user tables. I removed the mysql database and re-ran the install_db --user=mysql command. Following that, I was good to go.

How to obtain the Oracle Version info?

To obtain the release information for an Oracle Server, simply log in to the Oracle server in question with enough permissions to query the sys.v_$version view. For example:

SELECT * FROM sys.v_$version;

This will yeild output like the following:

SQL> SELECT * FROM sys.v_$version;

Oracle9i Enterprise Edition Release - 64bit Production
PL/SQL Release - Production
CORE Production
TNS FOR Solaris: Version - Production
NLSRTL Version - Production


MySQL IF() usage

This article discusses the usage of the MySQL IF() function to display the status of a BOOLEAN or TINYINT(1) column. While working on a tool to track a migration, I needed a means to show the migration status of a collection of tasks. If all the tasks had been migrated, then I needed to summarize that collection as being "migrated". Where as, if any one task was incomplete, all tasks in that collection needed to be summarized as being "not migrated".

This particular project was to make changes to collections of templates that were grouped by a server. To do this, I used the MySQL IF() function to check the number of templates in the collection was equal to the summation of the boolean flag associated with each template. When a template was migrated, it's BOOLEAN flag was set to 1.

The IF() function usage is as follows:

IF(expr1, expr2, expr3)

This means that IF expr1 is true, then expr2 is returned. Meanwhile, if expr1 is false, expr3 is returned. To accomplish my original task, I had to use the SUM() function to add up all the "migrated" BOOLEAN flags and compare that number with the total # of templates. If the two numbers were equal, then I wanted to display "migrated". If they didn't equal each other, that meant that either none or some of the templates were migrated, but NOT all.

The following is the code used to perform this nifty calculation:

SELECT DISTINCT(a.server_id), 
IF(SUM(b.migrated_flag) = COUNT(b.migrated_flag), 'migrated', 'not migrated')
FROM servers a, templates b
WHERE a.template_id = b.template_id
GROUP BY a.server_id