[[email protected] src]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[[email protected] src]# pwd
/usr/local/src
配置zabbix的yum源
[[email protected] src]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
安装zabbix程序包,安装mysql、zabbxi-agent
[[email protected] src]# yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb-server
这个时候有可能会报报错:“zabbix-web-3.4.15-1.el7.noarch: [Errno 256] No more mirrors to try”
解决办法:更换yum源,具体步骤如下:
[[email protected] src]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo -P /etc/yum.repos.d/
[[email protected] src]# yum clean all
[[email protected] src]# yum makecache
启动mariadb并设置开机启动,创建数据库实例,授权
[[email protected] src]# systemctl start mariadb
[[email protected] src]# systemctl enable mariadb
登陆mysql
[[email protected] src]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; #创建数据库实例
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected]‘%‘ identified by ‘zabbix‘; #授权所有主机访问数据库实例zabbix,用户名/密码:zabbix/Zabbix
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by ‘zabbix‘; #授权localhost主机名访问数据库实例zabbix,用户名/密码:zabbix/Zabbix
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by ‘zabbix‘; #授权localhost.localdomain主机访问数据库实例zabbix,用户名/密码:zabbix/Zabbix
导入初始模式和数据
进入create.sql.gz所在目录:
[[email protected] src]# cd /usr/share/doc/zabbix-server-mysql-3.4.15/
导入初始模式:
[[email protected] zabbix-server-mysql-3.4.15]# zcat create.sql.gz |mysql -uroot zabbix
启动zabbix-server服务
配置zabbix-server的配置文件zabbix_server.conf:
[[email protected] zabbix-server-mysql-3.4.15]# grep -n "^DB" /etc/zabbix/zabbix_server.conf
91:DBHost=localhost
98:DBName=zabbix
113:DBUser=zabbix
122:DBPassword=zabbix
启动zabbix-server服务:
[[email protected] zabbix-server-mysql-3.4.15]# systemctl start zabbix-server
[[email protected] zabbix-server-mysql-3.4.15]# systemctl enable zabbix-server
编辑Apache的配置文件,消注释设置正确的时区
[[email protected] zabbix-server-mysql-3.4.15]# grep -n "date.timezone" /etc/httpd/conf.d/zabbix.conf
20: php_value date.timezone Asia/Shanghai
启动httpd服务 ,设置开机启动httpd服务
[[email protected] zabbix-server-mysql-3.4.15]# systemctl start httpd
[[email protected] zabbix-server-mysql-3.4.15]# systemctl enable httpd
启动zabbix-agent并设置开机自启动
[[email protected] zabbix-server-mysql-3.4.15]# systemctl start zabbix-agent
[[email protected] zabbix-server-mysql-3.4.15]# systemctl enable zabbix-agent
Zabbix Web网页安装
在浏览器输入地址http://服务器ip/zabbix/setup.php,出现欢迎界面,点击下一步
出现必要条件检测界面,正常都是OK,点击下一步
配置DB连接,与zabbix_server.conf文件中主机、数据库名称、用户名、密码保持一致,点击下一步
zabbix服务器详细信息,点击下一步
安装前汇总,检查信息无误,点击下一步安装
安装成功会出现提示成功的界面。
然后点击“Finish“按钮。结束安装。
zabbix网页登录
在浏览器输入http://zabbix服务器ip/zabbix/index.php,输入管理员用户名Admin(区分大小写),默认密码zabbix,点击登入即可。
接下来就是开启各种监控配置研究了!!!
原文地址:https://www.cnblogs.com/renyongbin/p/10208270.html