How To Install Webalizer On CentOS

by admin on November 23, 2010

The Webalizer is a fast, free web server log file analysis program. It produces highly detailed, easily configurable usage reports in HTML format, for viewing with a standard web browser, in this article webalizer installed in Centos 5.4.
1. Download Webalizer

[root@lifelinux src]# wget ftp://ftp.mrunix.net/pub/webalizer/webalizer-2.20-01-src.tgz

2. Installing packages

[root@lifelinux src]# yum -y install gcc gcc-c++ gd-devel

3. Compile GeoIP

[root@lifelinux src]# wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
[root@lifelinux src]# tar zxvf GeoIP.tar.gz
[root@lifelinux src]# ./configure

[root@lifelinux src]# make && make install

Move GeoIP library

[root@lifelinux src]# cp /usr/local/lib/libGeoIP* /lib

4. Tarball package webalizer

[root@lifelinux src]# tar zxvf webalizer-2.20-01-src.tgz

3. Download GeoIP Database

[root@lifelinux src]# wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
[root@lifelinux src]# gunzip GeoIP.dat.gz
[root@lifelinux src]# mv ./GeoIP.dat /usr/local/share/GeoIP/GeoIP.dat

5. Compile webalizer

[root@lifelinux src]# cd webalizer-2.20-01

[root@lifelinux webalizer-2.20-01]# ./configure --prefix=/usr/local/webalizer --sysconfdir=/usr/local/etc/webalizer --enable-geoip

[root@lifelinux webalizer-2.20-01]# make

[root@lifelinux webalizer-2.20-01]# make install

6. Create directory for configuration webalizer

[root@lifelinux webalizer-2.20-01]# mkdir /usr/local/etc/webalizer

7. Use default configuration and copying to your configuration

[root@lifelinux webalizer-2.20-01]# cp /usr/local/etc/webalizer/webalizer.conf.sample  /usr/local/etc/webalizer/yourdomain.com.conf

8. Create directory same with your document root

[root@lifelinux webalizer-2.20-01]# mkdir /var/www/example.com/webalizer

9. Edit this file

[root@lifelinux webalizer-2.20-01]# vi /usr/local/etc/webalizer/example.com.conf

And find and changes the content

LogFile /var/log/httpd/access_log

Replace

LogFile /var/log/httpd/example.com-access_log

Find:

OutputDir /var/www/usage/

Replace

OutputDir  /var/www/example.com/webalizer

And find:

HostName       localhost

Replace

HostName       example.com  # it depend on your web hostname

Find

#GeoIP           	yes

#GeoIPDatabase   	/usr/local/share/GeoIP/GeoIP.dat

Replace

GeoIP           	yes

GeoIPDatabase   	/usr/local/share/GeoIP/GeoIP.dat

10. Test your configuration with this syntax

[root@lifelinux webalizer-2.20-01]# for i in /usr/local/etc/webalizer/*.conf; do webalizer -c $i; done

11. Using this syntax for using crontab.

[root@lifelinux webalizer-2.20-01]# vi /root/dowebalizer

Add Code:

#!/usr/bin/perl

use strict;

my @files = </usr/local/etc/webalizer/*.conf>;

foreach my $file (@files) {

chomp($file);

system("/usr/local/bin/webalizer -c $file");

}

12. Using crontab for automatically updated

[root@lifelinux webalizer-2.20-01]# crontab -e

Add Code:

1 * * * * /root/dowebalizer >>/dev/null 2>&1

Related Posts:

{ 1 comment… read it below or add one }

Paul October 11, 2013 at 8:04 am

I have tested for “for i in /usr/local/etc/webalizer/*.conf; do webalizer -c $i; done” has error like “-bash: webalizer: command not found” .

What should I do?

Thankyou very much

Reply

Previous post:

Next post: