首页 > 代码库 > Centos7 Zabbix3.0安装
Centos7 Zabbix3.0安装
1.官方文档地址:
https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages
2.导入源:
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
3.安装zabbix包
yum install zabbix-server-mysql zabbix-web-mysql
清楚的看一下要安装那些包(httpd php基本都依赖安装了)
Package Arch Version Repository Size
=====================================================================================================================
Installing:
zabbix-server-mysql x86_64 3.0.1-1.el7 zabbix 1.7 M
zabbix-web-mysql noarch 3.0.1-1.el7 zabbix 3.5 k
Installing for dependencies:
OpenIPMI-libs x86_64 2.0.19-11.el7 base 501 k
OpenIPMI-modalias x86_64 2.0.19-11.el7 base 15 k
dejavu-fonts-common noarch 2.33-6.el7 base 64 k
dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M
fping x86_64 3.10-4.el7 epel 46 k
httpd x86_64 2.4.6-40.el7.centos base 2.7 M
httpd-tools x86_64 2.4.6-40.el7.centos base 82 k
iksemel x86_64 1.4-6.el7 epel 50 k
libtool-ltdl x86_64 2.4.2-21.el7_2 updates 49 k
libzip x86_64 0.10.1-8.el7 base 48 k
mailcap noarch 2.1.41-2.el7 base 31 k
net-snmp-libs x86_64 1:5.7.2-24.el7 base 747 k
php x86_64 5.4.16-36.el7_1 base 1.4 M
php-bcmath x86_64 5.4.16-36.el7_1 base 56 k
php-cli x86_64 5.4.16-36.el7_1 base 2.7 M
php-common x86_64 5.4.16-36.el7_1 base 563 k
php-gd x86_64 5.4.16-36.el7_1 base 126 k
php-ldap x86_64 5.4.16-36.el7_1 base 51 k
php-mbstring x86_64 5.4.16-36.el7_1 base 503 k
php-mysql x86_64 5.4.16-36.el7_1 base 99 k
php-pdo x86_64 5.4.16-36.el7_1 base 97 k
php-xml x86_64 5.4.16-36.el7_1 base 124 k
t1lib x86_64 5.1.2-14.el7 base 166 k
unixODBC x86_64 2.3.1-11.el7 base 413 k
zabbix-web noarch 3.0.1-1.el7 zabbix 3.3 M
Transaction Summary
=============================================================================================================================================
Install 2 Packages (+25 Dependent packages)
Total download size: 17 M
4.我们给本机也安装上客户端(如果服务端不需要监控略过此步)
yum install zabbix-agent
5.安装mysql数据库
CentOS 7 版本将MySQL数据库软件从默认的程序列表中移除,用mariadb代替了。用mariadb也行。我还是选择了mysql
#导入安装源
rpm -ivh mysql-community-release-el7-5.noarch.rpm
#用 yum 安装 Mysql
yum install mysql-community-server
systemctl enable mysqld #设置开机启动
systemctl start mysqld #启动服务
=================================================
备注:1 mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码
2 grep ‘temporary password‘ /var/log/mysqld.log 找到root默认密码
3 mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误
===================================================
#修改root本地登录密码
mysqladmin -u root -p oldpass password "Admin@123"
#登录mysql
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 ‘Admin@123‘;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
(2)进入到这个目录
cd /usr/share/doc/zabbix-server-mysql-3.0.8
运行命令
zcat create.sql.gz | mysql -uroot -p zabbix
6.启动zabbix server服务
修改配置文件:
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=Admin@123
备注:实际上我的配置文件修改的是DBHost和DBPassword去掉前面的#号。
启动zabbix服务,设置开机自启动
systemctl start zabbix-server
systemctl enable zabbix-server
7.编辑zabbix前端的PHP配合配置
vi /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai
备注:实际上我就是修改了时区
启动apache服务,设置开机自启动
systemctl start httpd
systemctl enable httpd
8.登陆zabbix
http://IP/zabbix/
显示的界面
点击next会出现检查状态:
点击next配置mysql:
点击下一步。此步出现错误,发现无法连接数据库,最后发现zabbix这个数据库中,没有任何数据,检查时加红色的那部分出问题。
next到最后
默认用户名/密码:Admin/zabbix
进入主页面:下面进行,将语言改为中文。
[zabbix@miyan zabbix-server-mysql-.]$ vim /usr/share/zabbix/include/locales.inc.php
找到第55行,将false改为true
点击zabbix右上角小人,进行修改:
Centos7 Zabbix3.0安装