Piwik(http://piwik.org/)是开源的web统计分析应用,它的功能和Google Analytics类似。它可以提供网站的实用统计报告,比如网页浏览人数,访问最多的页面,搜索引擎关键词等等。
Ubuntu 16.04安装使用Piwik:
1.安装LAMP
参考:http://www.linuxdiyf.com/linux/21530.html
需要安装的PHP模块:
$ sudo apt-get install php-mysql php-curl php-gd php-intl php-pear php-imagick php-imap php-mcrypt php-memcache php-pspell php-recode php-snmp php-tidy php-xmlrpc php-xsl php-mbstring
2.下载Piwik
下载最新版的Piwik:
$ cd /var/www/html/
$ sudo wget http://builds.piwik.org/latest.zip
$ sudo unzip latest.zip
更改目录权限:
$ sudo chown -R www-data:www-data /var/www/html/piwik
$ sudo chmod -R 0755 /var/www/html/piwik/tmp
3.为Piwik创建一个数据库
$ sudo mysql -u root -p
MariaDB [(none)]> CREATE DATABASE piwikdb;
MariaDB [(none)]> CREATE USER piwik@localhost IDENTIFIED BY 'test1234';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON piwikdb.* TO piwik@localhost;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit
上面的SQL语句创建了一个piwikdb数据库和piwik用户(密码test1234)。
4.完成安装
使用浏览器访问:http://your_server_IP/piwik

设置数据库连接:


创建一个管理员用户:

设置要统计的网站:

设置跟踪代码:

完成安装:
