实验环境:
阿里云 [zabbix@miyan~]$cat/etc/redhat-release CentOSLinuxrelease7.2.1511(Core)
不得不说,官方文档确实强大
1.官方文档地址:
https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages
2.导入源:
http://repo.zabbix.com/zabbix/ #########zabbix软件源 下载网站
[zabbix@miyan~]$sudorpm-ivhhttp://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
3.安装zabbix包
[zabbix@miyan~]$sudoyuminstallzabbix-server-MysqLzabbix-web-MysqL
清楚的看一下要安装那些包
PackageArchVersionRepositorySize=============================================================================================================================================Installing: zabbix-server-MysqLx86_643.0.1-1.el7zabbix1.7M zabbix-web-MysqLnoarch3.0.1-1.el7zabbix3.5k Installingfordependencies: OpenIPMI-libsx86_642.0.19-11.el7base501k OpenIPMI-modaliasx86_642.0.19-11.el7base15k dejavu-fonts-commonnoarch2.33-6.el7base64k dejavu-sans-fontsnoarch2.33-6.el7base1.4M fpingx86_643.10-4.el7epel46k httpdx86_642.4.6-40.el7.centosbase2.7M httpd-toolsx86_642.4.6-40.el7.centosbase82k iksemelx86_641.4-6.el7epel50k libtool-ltdlx86_642.4.2-21.el7_2updates49k libzipx86_640.10.1-8.el7base48k mailcapnoarch2.1.41-2.el7base31k net-snmp-libsx86_641:5.7.2-24.el7base747k PHPx86_645.4.16-36.el7_1base1.4M PHP-bcmathx86_645.4.16-36.el7_1base56k PHP-clix86_645.4.16-36.el7_1base2.7M PHP-commonx86_645.4.16-36.el7_1base563k PHP-gdx86_645.4.16-36.el7_1base126k PHP-ldapx86_645.4.16-36.el7_1base51k PHP-mbstringx86_645.4.16-36.el7_1base503k PHP-MysqLx86_645.4.16-36.el7_1base99k PHP-pdox86_645.4.16-36.el7_1base97k PHP-xmlx86_645.4.16-36.el7_1base124k t1libx86_645.1.2-14.el7base166k unixODBCx86_642.3.1-11.el7base413k zabbix-webnoarch3.0.1-1.el7zabbix3.3M TransactionSummary=============================================================================================================================================Install2Packages(+25Dependentpackages) Totaldownloadsize:17M
4.我们给本机也安装上客户端
[zabbix@miyan~]$sudoyuminstallzabbix-agent
5.初始化数据库
CentOS 7 版本将MysqL数据库软件从默认的程序列表中移除,用mariadb代替了。用mariadb也行。我还是选择了MysqL
(1)安装MysqL
http://repo.MysqL.com/########MysqL软件源加载网站
[zabbix@miyan~]$wgethttp://repo.MysqL.com/MysqL-community-release-el7-5.noarch.rpm#下载MysqLYUM源
[zabbix@miyan~]$rpm-ivhMysqL-community-release-el7-5.noarch.rpm#安装带有当前可用的MysqL5系列社区版资源的rpm包[zabbix@miyan~]$yumrepolistenabled|grep"MysqL.*-community.*"MysqL-connectors-community/x86_64MysqLConnectorsCommunity21MysqL-tools-community/x86_64MysqLToolsCommunity33MysqL56-community/x86_64MysqL5.6CommunityServer214#查看当前可用的MysqL安装源 [zabbix@miyan~]$sudoyuminstall-yMysqL-community-server [zabbix@miyan~]$sudosystemctlenableMysqLd#设置开机启动 [zabbix@miyan~]$systemctlstartMysqLd#启动服务====AUTHENTICATINGFORorg.freedesktop.systemd1.manage-units===Authenticationisrequiredtomanagesystemservicesorunits. Authenticatingas:root Password: ====AUTHENTICATIONCOMPLETE===
[zabbix@miyan~]$MysqL-uroot-p Enterpassword: ERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:YES)
解决办法:
[zabbix@miyan~]$sudoMysqL_secure_installation
按照提示一步步来。不解释。
再次进入MysqL:
MysqL>createdatabasezabbixcharactersetutf8collateutf8_bin; QueryOK,1rowaffected(0.00sec) MysqL>grantallprivilegesonzabbix.*tozabbix@localhostidentifiedby'zabbix' ->; QueryOK,0rowsaffected(0.00sec) MysqL>quit Bye
[zabbix@miyanzabbix-server-MysqL-3.0.1]$pwd/usr/share/doc/zabbix-server-MysqL-3.0.1[zabbix@miyanzabbix-server-MysqL-3.0.1]$lsAUTHORSChangeLogCOPYINGcreate.sql.gzNEWSREADME
运行命令
[zabbix@miyanzabbix-server-MysqL-3.0.1]$#zcatcreate.sql.gz|MysqL-uroot-pzabbix
注意加红色部分,易错。
6.启动zabbix server服务
[zabbix@miyan~]$vim/etc/zabbix/zabbix_server.conf
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix 实际上我的配置文件修改的是DBHost和DBPassword去掉前面的#号。
启动zabbix服务,设置开机自启动
[zabbix@miyan~]$sudosystemctlstartzabbix-server
[zabbix@miyan~]$sudosystemctlenablezabbix-server Createdsymlinkfrom/etc/systemd/system/multi-user.target.wants/zabbix-server.serviceto/usr/lib/systemd/system/zabbix-server.service.
7.编辑zabbix前端的PHP配合配置
[zabbix@miyan~]$sudovim/etc/httpd/conf.d/zabbix.conf
PHP_valuemax_execution_time300PHP_valuememory_limit128M PHP_valuepost_max_size16M PHP_valueupload_max_filesize2M PHP_valuemax_input_time300PHP_valuealways_populate_raw_post_data-1PHP_valuedate.timezoneAsia/Shanghai
启动apache服务,设置开机自启动
[zabbix@miyan~]$sudosystemctlstarthttpd [zabbix@miyan~]$sudosystemctlenablehttpd Createdsymlinkfrom/etc/systemd/system/multi-user.target.wants/httpd.serviceto/usr/lib/systemd/system/httpd.service.
8.登陆zabbix
http://IP/zabbix/
显示的界面
点击next会出现检查状态:
点击next配置MysqL:
点击下一步。此步出现错误,发现无法连接数据库,最后发现zabbix这个数据库中,没有任何数据,检查时加红色的那部分出问题。
next到最后
4039B22E722949" src="http://note.youdao.com/yws/res/331/6CAD579662364A64BA4039B22E722949">
默认用户名/密码:Admin/zabbix
301C4E2E97E44F5A064102621FE324F" src="http://note.youdao.com/yws/res/341/D301C4E2E97E44F5A064102621FE324F">
[zabbix@miyanzabbix-server-MysqL-3.0.1]$sudovim/usr/share/zabbix/include/locales.inc.PHP
找到第55行,将false改为true
点击zabbix右上角小人,进行修改:
还是遇到了中文乱码问题,直接google。
参考这位大神的。
http:
Win+R打开运行,输入fonts,回车进入Windows字体目录,找到微软雅黑-常规字体,复制出来将文件名修改为msyh.ttf,然后上传到/usr/share/zabbix/fonts
上传成功后,编辑
sudovim/usr/share/zabbix/include/defines.inc.PHP
将'graphfont' 修改为msyh。
修改完成后,点击刷新,即可完成。
原文链接:https://www.f2er.com/centos/376680.html