Zabbix 3.0 只支持CentOS 7.0以上版本,因此先在虚拟机中安装好CentOS 7.0 x64,并设置好IP,容许虚拟机联网。php
一、关闭防火墙mysql
设置关闭防火墙
#systemctl stop firewalld.servicelinux
设置永久关闭防火墙
#systemctl disable firewalld.serviceweb
二、关闭SELinuxsql
查看SELinux状态
#getenforce数据库
修改SELinux状态
#vi /etc/sysconfig/selinux/
SELinux=disabled安全
快速修改
#sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
#grep SELINUX=disabled /etc/selinux/configide
不关机关闭SELinux
#setenforce 0测试
三、安装MySQL
从最新版本的linux系统开始,默认的是 Mariadb而不是mysql!ui
使用系统自带的repos安装很简单:
#yum install -y mariadb mariadb-server
启动mariadb
#systemctl start mariadb
以前的服务管理命令还能够用
#service mariadb start
设置开机自启动
#systemctl enable mariadb
安全初始化,设置root密码等
#mysql_secure_installation
测试登陆
#mysql -uroot –p<password>
复制代码
四、安装Zabbix
安装 zabbix 官方源
#rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
安装 server和web端,基于mysql数据库
#yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
五、初始化 zabbix DB
#mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql>flush privileges;
mysql> quit;
导入数据
#cd /usr/share/doc/zabbix-server-mysql
#zcat create.sql.gz | mysql -uroot zabbix
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix(快捷)
六、修改 Zabbix Server 配置,并启动 Zabbix Server 服务
#vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBPassword=zabbix
快捷操做命令:
#sed -i "s/# DBHost/DBHost/g" zabbix_server.conf
#sed -i "s/# DBPassword=/DBPassword=zabbix/g" zabbix_server.conf
启动zabbix-server服务
#systemctl start zabbix-server
#systemctl start zabbix-agent
开机自启动zabbix-server服务
#systemctl enable zabbix-server
#systemctl enable zabbix-agent
七、启动 zabbix 管理界面
编辑PHP配置
#php_value date.timezone Asia/Shanghai
快捷修改命令
#sed -i "s/# php_value date.timezone Europe\/Riga/php_value date.timezone Asia\/Shanghai/g" /etc/httpd/conf.d/zabbix.conf
启动Apache服务
#systemctl start httpd
开机启动Apache服务
#systemctl enable httpd
八、SELinux配置
#setsebool -P httpd_can_connect_zabbix on
#setsebool -P httpd_can_network_connect_db on
九、登录 Zabbix 管理页面http://localhost/zabbix/,显示Zabbix安装向导。