zabbix4.2 系列(一):安装

1,环境

zabbix-server

centos7.6   192.168.18.154

mysql

mysql这里使用单机运行,系统使用centos7.4   192.168.18.143

mysql版本5.7.21

两台均关闭selinux,firewalld,未使用iptables

2,安装lnmp环境

zabbix-server端依赖于lamp环境,这里使用nginx,同时,使用php7

MYSQL
mysql5.7安装过程参见我另外一篇文章 https:
//www.cnblogs.com/shiji888/p/10953166.html
创建zabbix数据库
# mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix123';
mysql> quit;
因zabbix-server和mysql在两台不同的机器上,mysql机器不安装zabbix-server端,sql导入脚本需后续在拷贝导入
NGINX
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum -y nginx
PHP
php这里使用rpm安装(注意区分yum源)
安装epel源
rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
安装php7源
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
查询php7版本
 yum search php7
安装所需要的php模块
yum -y install php70w php70w-cli php70w-common php70w-devel php70w-embedded php70w-fpm php70w-gd php70w-mbstring php70w-mysqlnd php70w-opcache php70w-pdo php70w-xml php70w-ldap php70w-bcmath
#注意解决依赖

 3,安装zabbix

rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
yum clean all
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get 

 导入mysql数据

 

拷贝此压缩包至mysql服务器上

导入数据

zcat   create.sql.gz | mysql -uzabbix -p zabbix

(如果按照本人之前博客安装的mysql5.7,innodb_page_size 参数优化为 8K,此sql脚本无法导入,此参数初始化数据库后无法修改,需重新编译)

如缺少依赖 

yum provides */libodbc.so.2
yum provides */libOpenIPMIposix.so.0
yum provides */libOpenIPMI.so.0

会显示你需要安装哪个软件包

4,配置zabbix-server

vim  /etc/zabbix/zabbix_server.conf

修改

DBHost=192.168.18.143

DBPassword=zabbix123

nginx配置
mv /etc/nginx/conf.d/default.conf  /etc/nginx/conf.d/default.conf.bak
vim /etc/nginx/conf.d/zabbix.conf

server
{
  listen 80;
    server_name zabbix.payweipan.com;
    index index.php index.html index.html info.php;
    root /usr/share/zabbix/;
    access_log /tmp/zabbix_access.log main;
    error_log /tmp/zabbix_error.log;
  location ~ \.php(.*)$ {
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /usr/share/zabbix/$fastcgi_script_name;
  }
}

   
systemctl start zabbix-server nginx php-fpm
systemctl enable zabbix-server nginx php-fpm

 浏览器访问http://zabbix.shiji.com

next

这边报错了,按要求修改php.ini文件后重启php-fpm

时区设置 date.timezone = "PRC";

 无报错后下一步填写数据库连接

next

最后登录,默认账号密码 Admin,zabbix(区分大小写)

 

posted @ 2019-06-27 09:06  再过半世纪  阅读(537)  评论(0编辑  收藏  举报