Shashikant shah

Friday 1 March 2013

How to install and configure webalizer in multiple domain on RHEL 5.5


Installing through source code

1.First we need to download the webalizer source code first
#wget ftp://ftp.mrunix.net/pub/webalizer/webalizer-2.20-01-src.tgz

1.Then we need to uncompress it
# tar zxvf webalizer-2.20-01-src.tgz

3.Makesure you have gcc compiler and Gd library installed, you can installed it using yum
# yum install gcc gcc-c++ gd-devel

4.Then we go to webalizer-2.20-01 directory , compile and install it
# cd webalizer-2.20-01
#./configure
# make
# make install

5.It is installed and you can checked the version now
# webalizer --version
Webalizer V2.20-01 (Linux 2.6.18-92.1.1.el5.028stab057.2 i686)

6.Installing with YUM

1.Just run the yum install command
# yum -y install webalizer

Now we make a website using httpd.conf and add a log entry in this configuration.
# vi /etc/httpd/conf/httpd.conf

go in the end of this file and edit the data-

<VirtualHost 192.168.0.10>
ServerName nuts.com
ServerAdmin root@nuts.com
DocumentRoot "/var/www/html/nuts.com"
CustomLog "/var/www/html/nuts.com/logs/access_log" common
DirectoryIndex index.html shashi.html
</VirtualHost>
After this save this file .

Then we make a log directory into DocumentRoot.

# mkdir /var/www/html/nuts.com/logs

# mkdir /var/www/html/nuts.com/history

# touch /var/www/html/nuts.com/logs/access_log

# touch var/www/html/nuts.com/history/webalizer.hist

# chmod 644 access_log

# chmod 644 webalizer.hist


How to configure it

1.Create a central directory for the webalizer configuration files
# mkdir /etc/webalizer

2.Create two webalizer configuration files,
#cp /usr/local/etc/webalizer.conf.sample etc/webalizer/a.example.conf

Modify LogFile, OutputDir and HostName of the webalizer config files.
vim /etc/webalizer/a.example.com.conf
and changes the content

LogFile /var/www/html/nuts.com/logs/access_log
OutputDir /var/www/usage
HostName praetorian-id.org # it depend on your web hostname
HistoryName /var/www/html/nuts.com/history/webalizer.hist

After this save this file.

4.To process all the virtual sites, run the following command:
# for i in /etc/webalizer/*.conf; do webalizer -c $i; done

1 comment: