Hello Guys,
Welcome back on my blog recently i am pretty busy with setting up the Nagios for the as i have describe in my previous post so can't able to update a new post. but after a wrapped up with that I started working on a brad new stuff. hope you will also like as its really very cool.As i have mention in title. its an open source web analytical tool same as google analytical tool.but its slightly different. as you are having it of your own. so Lets started implementing it.
Piwik is an open-source and free alternative to Google Analytics tool. It tracks and displays reports about the location of user visits, Where they came from (i.e website, directly, or something else), the visitors browser, screen size, operating system details, what the visitors did on your website, the time of visits and more.
Prerequisites
[root@server ~]# yum install mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring wget unzip -y
Start/Restart MySQL and Apache services now:
[root@server ~]# /etc/init.d/mysqld start
[root@server ~]# /etc/init.d/httpd start
[root@server ~]# chkconfig mysqld on
[root@server ~]# chkconfig httpd on
Create MySQL Root user password:
[root@server ~]# /usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Create MySQL Database and user for Piwik:
[root@server ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.69 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database piwikdb;
Query OK, 1 row affected (0.02 sec)
mysql> GRANT ALL PRIVILEGES ON piwikdb.* TO 'piwikuser' IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
Download Piwik
Download and extract Piwik software using the following commands:
[root@server ~]# wget http://builds.piwik.org/latest.zip
[root@server ~]# unzip latest.zip
Move the extracted Piwik folder to your apache root document folder:
[root@server ~]# mv piwik/ /var/www/html/piwik
Set the write permissions for the following directories:
[root@server ~]# chmod a+w /var/www/html/piwik/tmp/
[root@server ~]# chmod a+w /var/www/html/piwik/config/
Open the Apache default port 80 through your firewall/router:
[root@server html]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Restart the iptables to save the changes:
[root@server html]# /etc/init.d/iptables restart
Disable SELinux and reboot your system:
[root@server ~]# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
Save and Reboot your computer.
and then open in your browser..http://<your server's ipaddress>/pwik.
and then bla bla a simple stpes of basic installation... and you are done...try it out..
for a testing it out I have added a sample site..192.168.100.5
created a simple index.html page
[root@server ~]#vim /var/www/html/index.html
<html>
</header>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setCookieDomain", "*.192.168.100.5"]);
_paq.push(["setDomains", ["*.192.168.100.5"]]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//192.168.100.5/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 2]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//192.168.100.5/piwik/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</header>
<body>
<h1><hii/h1>
</body>
</html>
This is what i have done to get the dash data on dash board..try it out...
bye gyus...
Welcome back on my blog recently i am pretty busy with setting up the Nagios for the as i have describe in my previous post so can't able to update a new post. but after a wrapped up with that I started working on a brad new stuff. hope you will also like as its really very cool.As i have mention in title. its an open source web analytical tool same as google analytical tool.but its slightly different. as you are having it of your own. so Lets started implementing it.
Piwik is an open-source and free alternative to Google Analytics tool. It tracks and displays reports about the location of user visits, Where they came from (i.e website, directly, or something else), the visitors browser, screen size, operating system details, what the visitors did on your website, the time of visits and more.
Prerequisites
[root@server ~]# yum install mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring wget unzip -y
Start/Restart MySQL and Apache services now:
[root@server ~]# /etc/init.d/mysqld start
[root@server ~]# /etc/init.d/httpd start
[root@server ~]# chkconfig mysqld on
[root@server ~]# chkconfig httpd on
Create MySQL Root user password:
[root@server ~]# /usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Create MySQL Database and user for Piwik:
[root@server ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.69 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database piwikdb;
Query OK, 1 row affected (0.02 sec)
mysql> GRANT ALL PRIVILEGES ON piwikdb.* TO 'piwikuser' IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
Download Piwik
Download and extract Piwik software using the following commands:
[root@server ~]# wget http://builds.piwik.org/latest.zip
[root@server ~]# unzip latest.zip
Move the extracted Piwik folder to your apache root document folder:
[root@server ~]# mv piwik/ /var/www/html/piwik
Set the write permissions for the following directories:
[root@server ~]# chmod a+w /var/www/html/piwik/tmp/
[root@server ~]# chmod a+w /var/www/html/piwik/config/
Open the Apache default port 80 through your firewall/router:
[root@server html]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Restart the iptables to save the changes:
[root@server html]# /etc/init.d/iptables restart
Disable SELinux and reboot your system:
[root@server ~]# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
Save and Reboot your computer.
and then open in your browser..http://<your server's ipaddress>/pwik.
and then bla bla a simple stpes of basic installation... and you are done...try it out..
for a testing it out I have added a sample site..192.168.100.5
created a simple index.html page
[root@server ~]#vim /var/www/html/index.html
<html>
</header>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setCookieDomain", "*.192.168.100.5"]);
_paq.push(["setDomains", ["*.192.168.100.5"]]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//192.168.100.5/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 2]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//192.168.100.5/piwik/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</header>
<body>
<h1><hii/h1>
</body>
</html>
This is what i have done to get the dash data on dash board..try it out...
bye gyus...
No comments:
Post a Comment