1.安装数据库,并将数据库设置为开机自启动,执行安全初始化

  # yum install -y mariadb mariadb-server
  # systemctl enable mariadb
  # systemctl restart mariadb
  # mysql_secure_installation

2.添加Zabbix源
  # rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

3.安装Zabbix服务器,前端,代理
  # yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent httpd

4.创建一个名为zabbix的数据库,并将其所有权限授权给zabbix用户
  # mysql -uroot -p
  MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
  MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'password';
  MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'127.0.0.1' identified by 'password';
  MariaDB [(none)]> flush privileges;
  MariaDB [(none)]> quit

5.导入数据
  # zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

6.为Zabbix服务器配置数据库,编辑/etc/zabbix/zabbix_server.conf文件
  DBPassword=password

7.为Zabbix前端配置PHP,编辑/etc/httpd/conf.d/zabbix.conf文件,修改对应的时区
  php_value date.timezone Asia/Shanghai

8.配置防火墙
  # firewall-cmd --permanent --zone=public --add-port=10051/tcp
  # firewall-cmd --permanent --zone-public --add-service=http
  # firewall-cmd --reload

9.配置selinux
  # setsebool -P httpd_can_connect_zabbix on
  # setsebool -P httpd_can_network_connect_db on
  # setsebool -P httpd_can_network_connect on
  # setsebool -P zabbix_can_network on
  # ausearch -c 'zabbix_server' --raw | audit2allow -M my-zabbixserver
  # semodule -i my-zabbixserver.pp
  # semanage fcontext -a -t httpd_sys_content_t "/usr/share/zabbix(/.*)?"
  # restorecon -RFvv /usr/share/zabbix

10.启动Zabbix
  # systemctl enable zabbix-server
  # systemctl enable zabbix-agent
  # systemctl restart zabbix-server
  # systemctl restart zabbix-agent

11.配置完成,启动Zabbix web管理界面,根据配置向导完成最后的安装配置

posted on 2018-05-26 12:10  卢伸乐  阅读(151)  评论(0编辑  收藏  举报