zoukankan      html  css  js  c++  java
  • CentOS 7 下 Zabbix 3.2 安装

    详细讲解CentOS 7 下 Zabbix 3.2 安装的安装过程,希望对你有所帮助。

    实验环境:

    [zabbix@linuxidc ~]$ cat /etc/RedHat-release 
    CentOS Linux release 7.2.1511 (Core) 

    不得不说,官方文档确实强大

    1.官方文档地址:

    https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages

    2.导入源:

    [zabbix@linuxidc ~]$ sudo rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

    3.安装zabbix包

    [zabbix@linuxidc ~]$ sudo yum install zabbix-server-mysql zabbix-web-mysql

    清楚的看一下要安装那些包

    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.我们给本机也安装上客户端

    [zabbix@linuxidc ~]$ sudo yum install zabbix-agent

    5.初始化数据库

    CentOS 7 版本将MySQL数据库软件从默认的程序列表中移除,用mariadb代替了。用mariadb也行。我还是选择了mysql

    (1)安装mysql

    [zabbix@linuxidc ~]$ rpm -ivh mysql-community-release-el7-5.noarch.rpm
    #安装带有当前可用的mysql5系列社区版资源的rpm包
    [zabbix@linuxidc ~]$ yum repolist enabled | grep "mysql.*-community.*"
    mysql-connectors-community/x86_64 MySQL Connectors Community                 21
    mysql-tools-community/x86_64      MySQL Tools Community                      33
    mysql56-community/x86_64          MySQL 5.6 Community Server                214
    #查看当前可用的Mysql安装源
    [zabbix@linuxidc ~]$ sudo yum install mysql-community-server
    [zabbix@linuxidc ~]$ sudo systemctl enable mysqld  #设置开机启动
    [zabbix@linuxidc ~]$ systemctl start mysqld            #启动服务
    ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
    Authentication is required to manage system services or units.
    Authenticating as: root
    Password: 
    ==== AUTHENTICATION COMPLETE ===

    进入mysql报错:

    [zabbix@linuxidc ~]$ mysql -uroot -p
    Enter password: 
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    解决办法:

    [zabbix@linuxidc ~]$ sudo mysql_secure_installation

    按照提示一步步来。不解释。

    再次进入mysql:

    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> quit
    Bye

    (2)进入到这个目录

    [zabbix@linuxidc zabbix-server-mysql-3.0.1]$ pwd
    /usr/share/doc/zabbix-server-mysql-3.0.1
    [zabbix@linuxidc zabbix-server-mysql-3.0.1]$ ls
    AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README

    运行命令

    [zabbix@linuxidc zabbix-server-mysql-3.0.1]$ # zcat create.sql.gz | mysql -uroot -p zabbix

    注意加红色部分,易错。

    6.启动zabbix server服务

    修改配置文件:

    [zabbix@linuxidc ~]$ vim /etc/zabbix/zabbix_server.conf
    DBHost=localhost
    DBName=zabbix
    DBUser=zabbix
    DBPassword=zabbix
    实际上我的配置文件修改的是DBHost和DBPassword去掉前面的#号。

    启动zabbix服务,设置开机自启动

    [zabbix@linuxidc ~]$ sudo systemctl start zabbix-server
    [zabbix@linuxidc ~]$ sudo 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.

    7.编辑zabbix前端的PHP配合配置

    [zabbix@linuxidc ~]$ sudo vim /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服务,设置开机自启动

    [zabbix@linuxidc ~]$ sudo systemctl start httpd
    [zabbix@linuxidc ~]$ sudo systemctl enable httpd
    Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

    8.登陆zabbix

    http://IP/zabbix/

    显示的界面

    点击next会出现检查状态:

    点击next配置mysql:

    点击下一步。此步出现错误,发现无法连接数据库,最后发现zabbix这个数据库中,没有任何数据,检查时加红色的那部分出问题。

    next到最后

    默认用户名/密码:Admin/zabbix

    进入主页面:下面进行,将语言改为中文。

    [zabbix@linuxidc zabbix-server-mysql-3.0.1]$ sudo vim /usr/share/zabbix/include/locales.inc.php 

    找到第55行,将false改为true

    点击zabbix右上角小人,进行修改:

    还是遇到了中文乱码问题,直接google。

    Win+R打开运行,输入fonts,回车进入Windows字体目录,找到微软雅黑-常规字体,复制出来将文件名修改为msyh.ttf,然后上传到/usr/share/zabbix/fonts

    CentOS 7 下 Zabbix 3.2 安装

    上传成功后,编辑

    sudo vim /usr/share/zabbix/include/defines.inc.php

    将'graphfont' 修改为msyh。

    CentOS 7 下 Zabbix 3.2 安装

    修改完成后,点击刷新,即可完成。

    CentOS 7 下 Zabbix 3.2 安装
  • 相关阅读:
    Linux kernel device mapper
    草莓网
    openwrt系统源码地址
    ubuntu 安装eclipse for c++
    ubuntu下安装eclipse IDE for C/C++ developers
    Makefile 中:= ?= += =的区别
    core dump
    rtp
    skbuff
    A Neural Algorithm of Artistic Style
  • 原文地址:https://www.cnblogs.com/fungitive/p/9136241.html
Copyright © 2011-2022 走看看