zabbix_server 3.0 安装

                                                                     Zabbix3.0安装

环境:

Nginx 稍微偏高点就行

PHP5.5以上

Mysql5.5及以上

Zabbix3.0及以上

 

1、  安装包下载

Nginxhttp://nginx.org/download/

PHP http://php.net/downloads.php

Mysqlhttp://dev.mysql.com/downloads

Zabbixhttp://www.zabbix.com/download.php

 

2、  nginx安装

tar –zxf  nginx-1.9.6.tar.gz

cd nginx-1.9.6.tar.gz

./configure  --prefix=/usr/local/nginx;make;make install

Vim nginx.conf

server {

                listen  80;

                server_name ceshi.com;

                #access_log /data/logs/nginx/test.ttlsa.com.access.log main;

                index index.php index.html index.html;

                root /data/www/html;

                #limit_conn   one  1;

 

        location /

        {

        try_files $uri $uri/ /index.php?$args;

        }

 

        location ~ .*\.(php)?$

        {

        expires -1s;

        try_files $uri =404;

        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        include fastcgi_params;

        fastcgi_param PATH_INFO $fastcgi_path_info;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_pass 127.0.0.1:9000;

 

        }

   }

 

3、  mysql安装 

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/data -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR

=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql && make &&  make install

Group  mysql

Useradd –g mysql mysql –s  /sbin/nologin

cp -fv /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

        cp -fv /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

        chmod +x /etc/init.d/mysqld

        chkconfig --add mysqld

        chkconfig --level 3 mysqld on

 

        #Initialized mysql

        /usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/mysql/data --basedir=/usr/local/mysql --defaults-file=/etc/my.cnf

 

        chown -R mysql:mysql /data/log/mysql

        chown -R mysql:mysql /data/mysql/

        chown -R mysql:mysql /usr/local/mysql

 

4、  PHP安装

      Tar –zxf php-5.6.13.tar.gz

       ./configure \

       --prefix=/usr/local/php\

       --with-mysql=/usr/local/mysql/ \

       --with-mysqli=mysqlnd \

       --with-pdo-mysql=mysqlnd \

       --with-iconv-dir=/usr/local/libiconv \

       --with-freetype-dir \

       --with-jpeg-dir \

       --with-png-dir \

       --with-zlib \

       --with-libxml-dir=/usr \

       --with-gettext \

       --enable-xml \

       --disable-rpath \

       --enable-bcmath \

       --enable-shmop \

       --enable-sysvsem \

       --enable-inline-optimization \

       --with-curl \

       --enable-mbregex \

       --enable-fpm \

       --enable-mbstring \

       --with-mcrypt \

       --with-gd \

       --enable-gd-native-ttf \

       --with-openssl \

       --with-mhash \

       --enable-pcntl \

       --enable-sockets \

       --with-xmlrpc \

       --enable-soap \

       --enable-short-tags \

       --enable-static \

       --with-xsl \

       --with-fpm-user=nginx \

       --with-fpm-group=nginx \

       --enable-ftp \

       --enable-opcache=no

       Make;make install

 

cp /usr/local/php/etc/php-fpm.conf.default  php-fpm.conf

cp /data/tools/php-5.6.13/php.ini-development 

vim  /usr/local/php/lib/php.ini  这条命令看版本,可能有的版本不一致,有的是在/usr/local/php/etc 下面

max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 16M

 

5、  zabbix安装

tar –zxf  zabbix-3.0.0alpha2.tar.gz

cd zabbix-3.0.0alpha2.tar.gz

./configure --prefix=/usr/local/zabbix  --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

 

Cp /data/tools/zabbix-3.0.0alpha2/frontends/php/*  /data/www/html/zabbix/

Groupadd zabbix

Useradd –g zabbix zabbix –s  /sbin/nologin

Mysqladmin –h –h 127.0.0.1 –uroot –p  password root

Mysql –h 127.0.0.1 –uroot –proot

create database zabbix character set utf8 collate utf8_bin;

grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

flush privileges;

 

mysql –h 127.0.0.1 –uzabbix –pzabbix zabbix </data/tools/zabbix-3.0.0alpha2/database/mysql/schema.sql

mysql –h 127.0.0.1 –uzabbix –pzabbix zabbix<</data/tools/zabbix-3.0.0alpha2/database/mysql/images.sql

mysql –h 127.0.0.1 –uzabbix –pzabbix< zabbix<</data/tools/zabbix-3.0.0alpha2/database/mysql/ data.sql

msyql导入zabbix的数据的顺序不能乱

 

vim /usr/local/zabbix/etc/zabbix_server.conf

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

ListenIP=127.0.0.1

AlertScriptsPath=/usr/local/zabbix/bin

 

6、  启动服务

/etc/init.d/nginx start

/etc/init.d/mysqld

/usr/local/php/sbin/php-fpm

/usr/local/zabbix/sbin/ zabbix_server

/usr/local/zabbix/sbin/zabbix_agentd

 

7、  校验

http://serverip/zabbix

账号:Admin密码:zabbix

数据库的信息:zabbix  zabbix  zabbixmysqlIP  zabbix_server-Port

至此安装成功

 

8、  添加汉化以及修改时区

Vim /data/www/html/zabbix/include/locales.inc.php

'zh_CN' => ['name' => _('Chinese (zh_CN)'),     'display' => false],

改为'zh_CN' => ['name' => _('Chinese (zh_CN)'),     'display' => true],

 

Vim /usr/local/php/lib/php.ini  (这个地方就是跟前面PHP安装的时候对应,不同的版本放在不同的目录,如果位置没有放置正确,可能修改就不会生效)

date.timezone = PRC

 

9、  PHP是否安装成功测试

nginx的工程下编写一个以PHP格式结尾的文件,内容输入如下

vim   /data/www/html/info.php   or   /data/www/html/zabbix/phpinfo.php

<?php

Phpinfo();

?>

 

http://serverIP/file.php

若是能打开PHP的主页,则说明安装成功,同时修改PHP.ini的配置是否生效,刷新这个页面也能看到是否修改成功

 

 


你可能感兴趣的:(zabbix_server 3.0 安装)