虽然zabbix已经玩了好多遍了,但每次重新部署时,还得到处找,今天抽空整理下文档,以后就可以直接复制粘贴了,哈哈
环境说明
环境:
centos 7.4
zabbix 3.4.11
mysql 5.6
php 5.4
nginx 12.2
zabbix 3.4环境要求:
参考:zabbix requirements
- MySQL 5.0.3 - 5.7.x
- PHP 5.4.0 or later
安装yum源
1 2 3 4 5 6 7
| [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~]
|
安装依赖包
部署PHP
如果能使用webtatic源的话,可以安装高版本的PHP。这里用不了webtatic的yum源。-_-!!!
1 2 3 4
| [root@localhost ~] [root@localhost ~]
|
1 2 3 4 5 6 7 8 9 10 11 12
| [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~]
|
部署Mysql 5.6
这里也操作了mysql迁移DATA目录
1 2 3 4 5
| [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~]
|
迁移mysql data目录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| [root@localhost ~] mysql> use mysql mysql> update user set password=password('123456') where user='root'; mysql> SELECT Host,User,password_expired FROM user; mysql> update user set host='192.168.%.%',password_expired='N' where host='127.0.0.1'; mysql> grant all privileges on *.* to 'root'@'localhost' identified by '123456' with grant option; mysql> grant all privileges on *.* to 'root'@'192.168.%.%' identified by '123456' with grant option; mysql> flush privileges; mysql> commit; mysql> show global variables like "%datadir%"; +---------------+-----------------+ | Variable_name | Value | +---------------+-----------------+ | datadir | /var/lib/mysql/ | +---------------+-----------------+ 1 row in set (0.00 sec) mysql> quit [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [mysqld] datadir=/data/mysql_data socket=/data/mysql_data/mysql.sock symbolic-links=0 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [client] socket=/data/mysql_data/mysql.sock [root@localhost ~]
|
部署zabbix
1 2 3 4 5
| [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost zabbix-3.4.11] [root@localhost zabbix-3.4.11]
|
初始化数据库
1 2 3 4 5 6 7
| [root@localhost ~] mysql> create database zabbix default charset utf8; mysql> grant all privileges on zabbix.* to zbxuser@localhost identified by 'zbxpass'; mysql> grant all privileges on zabbix.* to zbxuser@'192.168.%.%' identified by 'zbxpass'; mysql> flush privileges; mysql> commit; mysql> quit
|
1 2 3 4
| [root@localhost ~] [root@localhost zabbix-3.4.11] [root@localhost zabbix-3.4.11] [root@localhost zabbix-3.4.11]
|
配置zabbix
1 2 3 4 5 6 7
| [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~]
|
1 2 3 4
| [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~]
|
1 2 3 4 5 6 7 8 9 10 11 12 13
| [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost ~]
|
部署Nginx
1 2 3 4 5 6
| [root@localhost ~] [root@localhost ~] [root@localhost ~] [root@localhost zabbix-3.4.11] [root@localhost ~] [root@localhost ~]
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| [root@localhost ~] server { listen 80; server_name 192.168.1.202; root /usr/share/nginx/html; access_log /var/log/nginx/zabbix_access.log main; error_log /var/log/nginx/zabbix_error.log warn; location /zabbix { index index.php; try_files $uri $uri/ /index.php?$args; } location ~ ^(.+.php)(.*)$ { fastcgi_buffer_size 128k; fastcgi_buffers 32 32k; fastcgi_split_path_info ^(.+.php)(.*)$; include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param PATH_INFO $fastcgi_path_info; } } [root@localhost ~] [root@localhost ~] [root@localhost ~]
|
效果图
如果点”next step”没有反应,需要检查下/var/lib/php/session
权限,如果没有这个目录就新建一个并授权777
附件:
epel-release-latest-7.noarch
mysql80-community-release-el7-1.noarch
webtatic-release
zabbix-3.4.11.tar.gz
本文出自”Jack Wang Blog”:http://www.yfshare.vip/2018/06/30/部署Zabbix-3-4/