Shashikant shah

Friday 1 March 2013

Install Piwik Web Analytics in RHEL-5.5



                                          PIWIK Configuration

 Piwik for generating website analytics. The reports generated by Piwik are similar to the ones generated by Google Analytics. Piwik is an Open-Source (GPL) tool that you can download and host on your own servers which means you are in full control over your data. In addition to that, Piwik's functionality can be extended by plugins.
1.Install Packages :-

# yum install php-pdo php-gd php-xml php-devel php-pear mysql-devel httpd-devel 
      mysql* httpd*

2.Download piwik (laset.zip).
# uzip -x latest.zip
# mv piwik /var/www/html
3.Give to Premission :- 
# chown -R apache:apache /var/www/html/piwik
# cd /var/www/html
# chmod 777 ./piwik/tmp
#chmod 777 ./piwik/config
# pecl install pdo
# pecl install pdo_mysql
4.Add some line :-
#vim /etc/php.ini
; Dynamic Extensions

extension=pdo.so

extension=pdo_mysql.so
extension=pdo_mysql.so
; Resource Limits

memory_limit = 512M



5.Go to apache configuration :-

# cd /etc/httpd/conf/
# vim httpd.conf

<VirtualHost *:80>
ServerAdmin root@shashi.example.com
DocumentRoot /var/www/html/piwik
ServerName shashi.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

# /etc/init.d/httpd restart

# chkconfig httpd on

6.Create a DataBase :-

# /etc/init.d/mysqld start
# chkconfig mysqld on
mysqladmin -u root password 'shashi'

mysql -u root -p shashi

mysql>create database piwik;
mysql>create user piwik@localhost identified by 'shashi';
mysql>grant all privileges on piwik.* to piwik;
mysql>flush privileges;
mysql>\q



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