一.环境准备
- OS:CentOS 7.2 64bit
- Zabbix版本:3.0.12
- MySQL版本:5.6
hostname ip 主机用途
zabbix-server 10.0.0.44 服务端 zabbix-agent 10.0.0.45 代理端
1.关闭防火墙
2.关闭selinux
3.服务端安装zabbix-server
# 下载zabbix的rpm仓库包
rpm -vhi http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
# 下载zabbix-server和zabbix-web-mysql
[root@zabbix-server ~]# yum install -y zabbix-server-mysql zabbix-web-mysql
# 安装并且启动mysql5.6及初始化数据库信息
[root@zabbix-server ~]# rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm
[root@zabbix-server ~]# yum install -y mysql-community-server
[root@zabbix-server ~]# systemctl start mysqld
[root@zabbix-server ~]# /sbin/chkconfig mysqld on #开机启动
[root@zabbix-server ~]# mysql_secure_installation #初始化数据库信息
# 创建zabbix数据库,创建zabbix账号
[root@zabiix-server ~]# mysql -uroot -p ... mysql> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)
# 导入默认的zabbix数据库信息
[root@zabix-server zabbix-server-mysql-3.0.12]# zcat /usr/share/doc/zabbix-server-mysql-3.0.12/create.sql.gz | mysql zabbix -uzabbix -pzabbix
# 修改zabbix_server.conf的配置文件
[root@zabbix-server ~]# grep ^DB /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix
# 修改配置文件/etc/httpd/conf.d/zabbix.conf,时区改成 Asia/Shanghai
php_value date.timezone Asia/Shanghai
# 启动apache/zabbix-server服务并设置为开机启动
[root@zabbix-server ~]# systemctl start httpd [root@zabbix-server ~]# systemctl enable httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [root@zabbix-server ~]# netstat -an |grep 80 tcp6 0 0 :::80 :::* LISTEN [root@zabbix-server ~]# systemctl start zabbix-server [root@zabbix-server ~]# systemctl enable zabbix-server Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
# 访问网站,例如:http://本机IP/zabbix,如下图所示:
必须全部是绿色的ok,然后根据提示操作。
操作完成,提示页面的设置的配置文件在 /etc/zabbix/web/zabbix.conf.php
[root@zabbix-server ~]# more /etc/zabbix/web/zabbix.conf.php <?php // Zabbix GUI configuration file. global $DB; $DB['TYPE'] = 'MYSQL'; $DB['SERVER'] = 'localhost'; $DB['PORT'] = '0'; $DB['DATABASE'] = 'zabbix'; $DB['USER'] = 'zabbix'; $DB['PASSWORD'] = 'zabbix'; // Schema name. Used for IBM DB2 and PostgreSQL. $DB['SCHEMA'] = ''; $ZBX_SERVER = 'localhost'; $ZBX_SERVER_PORT = '10051'; $ZBX_SERVER_NAME = 'zabbix3.0'; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
# 使用Admin 密码:yourpassword 登陆