系统环境:Centos 6.6最小化安装
php,mysql,nginx
一,环境安装
①.php环境安装,使用epel源安装php
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
yum install geoip geoip-devel pecl-geoip-php mysql-server mysql mysql-libs httpd-devel libpng-devel libgd-devel libjpeg-devel gcc curl-devel zlib=-devel libxml2-devel gd-2 apr-util-devel
②.安装 mysql
yum --enablerepo=remi install mysql mysql-server -y
mysql配置文件
vi /etc/my.cnf
default-table-type = InnoDB
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 256K
thread_cache_size = 16
innodb_buffer_pool_size = 2048M
innodb_log_file_size = 512M
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 2
sync_binlog = 0
innodb_flush_method = O_DIRECT
transaction-isolation = READ-COMMITTED
启动mysql:
service mysqld start
执行如下命令
mysql > create database piwik_db;
mysql >grant all privileges on piwik_db.* to piwik@'%' identified by '123456' ;
mysql >flush privileges;
③.安装 nginx
wget http://ncu.dl.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz && tar zxf pcre-8.37.tar.gz
wget http://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz && tar zxf zlib-1.2.8.tar.gz
wget http://www.openssl.org/source/openssl-1.0.2d.tar.gz && tar zxf openssl-1.0.2d.tar.gz
wget http://tengine.taobao.org/download/tengine-2.1.0.tar.gz && tar zxf tengine-2.1.0.tar.gz && cd tengine-2.1.0
./configure --with-http_ssl_module --with-pcre=../pcre-8.37 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-1.0.2d
make && make install
nginx配置
server {
listen 81;
root /www/web/piwik;
index index.html index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
二.安装piwik
http://builds.piwik.org/ 下载最新安装包
解压后放到 /www/web目录下
然后再web上进行安装