环境准备:
系统:centos7 数据库:mysql zabbix数据库名:zabbix zabbix数据库用户名:zabuser zabbix数据库密码:zabpass
系统初始化
系统安装完成先进行初始化,参考: http://blog.51cto.com/ganmu/2350697
安装数据库
yum install -y mariadb-server
mysql中创建连接用户
mysql create database zabbix character set utf8; grant all on zabbix.* to 'zabuser'@'172.16.%.%' identified by 'zabpass'; grant all on zabbix.* to 'zabuser'@'HOST-NAME' identified by 'zabpass'; grant all on zabbix.* to 'zabuser'@'localhost' identified by 'zabpass'; flush privileges;
安装zabbix源
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
安装Zabbix server,Web前端,agent
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
导入初始架构和数据,系统将提示您输入新创建的密码。
zcat /usr/share/doc/zabbix-server-mysql-4.0.4/create.sql.gz |mysql -uzbxuser -p zabbix -h 172.16.232.8
为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabuser DBPassword=zabpass
为Zabbix前端配置PHP
编辑配置文件 /etc/httpd/conf.d/zabbix.conf
# php_value date.timezone Europe/Riga
修改为:
php_value date.timezone Asia/Shanghai
启动Zabbix server和agent进程
启动Zabbix server和agent进程,并为它们设置开机自启:
systemctl restart zabbix-server zabbix-agent httpd systemctl enable zabbix-server zabbix-agent httpd
现在您的Zabbix server已经安装完成并开始运行
配置Zabbix前端
连接到新安装的Zabbix前端: http://server_ip_or_name/zabbix