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

[[email protected] src]# wget ftp://ftp.mrunix.net/pub/webalizer/webalizer-2.20-01-src.tgz

2. Installing packages

[[email protected] src]# yum -y install gcc gcc-c++ gd-devel

3. Compile GeoIP

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

[[email protected] src]# make && make install

Move GeoIP library

[[email protected] src]# cp /usr/local/lib/libGeoIP* /lib

4. Tarball package webalizer

[[email protected] src]# tar zxvf webalizer-2.20-01-src.tgz

3. Download GeoIP Database

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

5. Compile webalizer

[[email protected] src]# cd webalizer-2.20-01

[[email protected] webalizer-2.20-01]# ./configure --prefix=/usr/local/webalizer --sysconfdir=/usr/local/etc/webalizer --enable-geoip

[[email protected] webalizer-2.20-01]# make

[[email protected] webalizer-2.20-01]# make install

6. Create directory for configuration webalizer

[[email protected] webalizer-2.20-01]# mkdir /usr/local/etc/webalizer

7. Use default configuration and copying to your configuration

[[email protected] 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

[[email protected] webalizer-2.20-01]# mkdir /var/www/example.com/webalizer

9. Edit this file

[[email protected] 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

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

11. Using this syntax for using crontab.

[[email protected] 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

[[email protected] 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: