• centos7安装zabbix4.2


    附zabbixdocker镜像地址

    https://hub.docker.com/u/zabbix/

    zabbix官方文档

    https://www.zabbix.com/cn/download

    1、关闭防火墙和selinux

    # systemctl stop firewalld

    # vi /etc/selinux/config

    SELINUX=permissive

    # setenforce 0

    [root@localhost ~]# systemctl is-active firewalld
    active
    [root@localhost ~]# 
    [root@localhost ~]# systemctl stop firewalld
    [root@localhost ~]# 
    [root@localhost ~]# getenforce 
    Enforcing
    [root@localhost ~]# setenforce 0
    [root@localhost ~]# 
    [root@localhost ~]# vi /etc/selinux/config 
    
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=permissive
    # SELINUXTYPE= can take one of three two values:
    #     targeted - Targeted processes are protected,
    #     minimum - Modification of targeted policy. Only selected processes are protected.
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted

    2、添加zabbix存储库

    # rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm

    [root@localhost ~]# rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
    Retrieving https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
    warning: /var/tmp/rpm-tmp.fHl7KV: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:zabbix-release-4.2-1.el7         ################################# [100%]
    [root@localhost ~]# ls /etc/yum.repos.d/
    mylocal.repo  zabbix.repo

    3、安装zabbix-server-mysql和zabbix-web-mysql

    # yum install -y zabbix-server-mysql zabbix-web-mysql

    要在 MySQL支持下安装Zabbix服务器

    要在 MySQL支持下安装Zabbix前端

    Installed:
      zabbix-server-mysql.x86_64 0:3.0.26-1.el7                                      zabbix-web-mysql.noarch 0:3.0.26-1.el7                                     
    
    Dependency Installed:
      OpenIPMI-libs.x86_64 0:2.0.23-2.el7              OpenIPMI-modalias.x86_64 0:2.0.23-2.el7                dejavu-fonts-common.noarch 0:2.33-6.el7           
      dejavu-sans-fonts.noarch 0:2.33-6.el7            fontpackages-filesystem.noarch 0:1.44-8.el7            fping.x86_64 0:3.10-4.el7                         
      httpd.x86_64 0:2.4.6-88.el7.centos               httpd-tools.x86_64 0:2.4.6-88.el7.centos               iksemel.x86_64 0:1.4-2.el7.centos                 
      libX11.x86_64 0:1.6.5-2.el7                      libX11-common.noarch 0:1.6.5-2.el7                     libXau.x86_64 0:1.0.8-2.1.el7                     
      libXpm.x86_64 0:3.5.12-1.el7                     libjpeg-turbo.x86_64 0:1.2.90-6.el7                    libtool-ltdl.x86_64 0:2.4.2-22.el7_3              
      libxcb.x86_64 0:1.13-1.el7                       libxslt.x86_64 0:1.1.28-5.el7                          libzip.x86_64 0:0.10.1-8.el7                      
      mailcap.noarch 0:2.1.41-2.el7                    net-snmp-libs.x86_64 1:5.7.2-37.el7                    php.x86_64 0:5.4.16-46.el7                        
      php-bcmath.x86_64 0:5.4.16-46.el7                php-cli.x86_64 0:5.4.16-46.el7                         php-common.x86_64 0:5.4.16-46.el7                 
      php-gd.x86_64 0:5.4.16-46.el7                    php-ldap.x86_64 0:5.4.16-46.el7                        php-mbstring.x86_64 0:5.4.16-46.el7               
      php-mysql.x86_64 0:5.4.16-46.el7                 php-pdo.x86_64 0:5.4.16-46.el7                         php-xml.x86_64 0:5.4.16-46.el7                    
      t1lib.x86_64 0:5.1.2-14.el7                      unixODBC.x86_64 0:2.3.1-11.el7                         zabbix-web.noarch 0:3.0.26-1.el7                  
    
    Complete!

     要使用MySQL支持安装Zabbix代理

    # yum install zabbix-proxy-mysql -y

    [root@localhost ~]# yum install zabbix-proxy-mysql -y
    Installed:
      zabbix-proxy-mysql.x86_64 0:4.2.0-1.el7
    
    Complete!

     对服务器进行自身监控

     安装zabbix-agent客户端

    # yum install zabbix-agent -y

    设置开机自启动

    # systemctl start zabbix-agent

    # chkconfig zabbix-agent on

    Installed:
      zabbix-agent.x86_64 0:4.2.0-1.el7
    
    Complete!
    [root@localhost ~]#
    [root@localhost ~]# chkconfig zabbix-agent on
    Note: Forwarding request to 'systemctl enable zabbix-agent.service'.
    Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
    [root@localhost ~]#

    4、安装并且启动mysql5.6及初始化数据库信息

    # rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm

    [root@localhost ~]# rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm
    Retrieving http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:mysql-community-release-el6-5    ################################# [100%]
    [root@localhost ~]# cd /etc/yum.repos.d/
    [root@localhost yum.repos.d]#
    [root@localhost yum.repos.d]# ls
    mylocal.repo  mysql-community.repo  mysql-community-source.repo  zabbix.repo
    [root@localhost yum.repos.d]#

    # yum install -y mysql-community-server

    Installed:
      mysql-community-libs.x86_64 0:5.6.43-2.el6                                   mysql-community-server.x86_64 0:5.6.43-2.el6                                  
    
    Dependency Installed:
      mysql-community-client.x86_64 0:5.6.43-2.el6        mysql-community-common.x86_64 0:5.6.43-2.el6        perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7       
      perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7         perl-DBI.x86_64 0:1.627-4.el7                       perl-IO-Compress.noarch 0:2.061-2.el7              
      perl-Net-Daemon.noarch 0:0.48-5.el7                 perl-PlRPC.noarch 0:0.2020-14.el7                  
    
    Replaced:
      mariadb-libs.x86_64 1:5.5.60-1.el7_5                                                                                                                       
    
    Complete!

    启动mysqld服务

    # systemctl start mysqld

    设置开机自启动

    # chkconfig mysqld on

    [root@localhost ~]# systemctl start mysqld
    [root@localhost ~]# 
    [root@localhost ~]# systemctl status mysqld
    ● mysqld.service - SYSV: MySQL database server.
       Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
       Active: active (running) since Wed 2019-04-03 01:21:03 CST; 12s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 68300 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)
     Main PID: 68584 (mysqld)
       CGroup: /system.slice/mysqld.service
               ├─68380 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedi...
               └─68584 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld....
    
    Apr 03 01:21:02 localhost.localdomain mysqld[68300]: Note: new default config file not created.
    Apr 03 01:21:02 localhost.localdomain mysqld[68300]: Please make sure your config file is current
    Apr 03 01:21:02 localhost.localdomain mysqld[68300]: WARNING: Default config file /etc/my.cnf exists on the system
    Apr 03 01:21:02 localhost.localdomain mysqld[68300]: This file will be read by default by the MySQL server
    Apr 03 01:21:02 localhost.localdomain mysqld[68300]: If you do not want to use this, either remove it, or use the
    Apr 03 01:21:02 localhost.localdomain mysqld[68300]: --defaults-file argument to mysqld_safe when starting the server
    Apr 03 01:21:02 localhost.localdomain mysqld[68300]: [  OK  ]
    Apr 03 01:21:03 localhost.localdomain mysqld[68300]: Starting mysqld:  [  OK  ]
    Apr 03 01:21:03 localhost.localdomain systemd[1]: mysqld.service: Supervising process 68584 which is not our child. We'll most likely not notice w...t exits.
    Apr 03 01:21:03 localhost.localdomain systemd[1]: Started SYSV: MySQL database server..
    Hint: Some lines were ellipsized, use -l to show in full.
    [root@localhost ~]# 
    [root@localhost ~]# chkconfig mysqld on
    [root@localhost ~]# 

    初始化数据库信息

    # mysql_secure_installation

    [root@localhost ~]# mysql_secure_installation
    
    
    
    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
    
    In order to log into MySQL to secure it, we'll need the current
    password for the root user.  If you've just installed MySQL, and
    you haven't set the root password yet, the password will be blank,
    so you should just press enter here.
    
    Enter current password for root (enter for none):    //回车
    OK, successfully used password, moving on...
    
    Setting the root password ensures that nobody can log into the MySQL
    root user without the proper authorisation.
    
    Set root password? [Y/n] y
    New password:
    Re-enter new password:
    Password updated successfully!
    Reloading privilege tables..
     ... Success!
    
    
    By default, a MySQL installation has an anonymous user, allowing anyone
    to log into MySQL without having to have a user account created for
    them.  This is intended only for testing, and to make the installation
    go a bit smoother.  You should remove them before moving into a
    production environment.
    
    Remove anonymous users? [Y/n] y
     ... Success!
    
    Normally, root should only be allowed to connect from 'localhost'.  This
    ensures that someone cannot guess at the root password from the network.
    
    Disallow root login remotely? [Y/n] n
     ... skipping.
    
    By default, MySQL comes with a database named 'test' that anyone can
    access.  This is also intended only for testing, and should be removed
    before moving into a production environment.
    
    Remove test database and access to it? [Y/n] y
     - Dropping test database...
    ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
     ... Failed!  Not critical, keep moving...
     - Removing privileges on test database...
     ... Success!
    
    Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.
    
    Reload privilege tables now? [Y/n] y
     ... Success!
    
    
    
    
    All done!  If you've completed all of the above steps, your MySQL
    installation should now be secure.
    
    Thanks for using MySQL!
    
    
    Cleaning up...

    5、创建zabbix数据库,创建zabbix账号

    # mysql -uroot -p

    创建一个zabbix库并设置为utf8的字符编码格式

    mysql> create database zabbix character set utf8 collate utf8_bin;

    创建账户并且授权设置密码

    给来自loclhost的用户zabbxi分配可对数据库zabbix所有表进行所有操作的权限,并且设定密码为zabbix

    mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';

    刷新

    mysql> flush privileges;

    [root@localhost ~]# mysql -uroot -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 10
    Server version: 5.6.43 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    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.00 sec)
    
    mysql> exit
    Bye

    6、导入默认的zabbix数据库信息

    # zcat /usr/share/doc/zabbix-server-mysql-4.2.0/create.sql.gz | mysql zabbix -uzabbix -pzabbix

    [root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-4.2.0/
    [root@localhost zabbix-server-mysql-4.2.0]#
    [root@localhost zabbix-server-mysql-4.2.0]# ls
    AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README
    [root@localhost zabbix-server-mysql-4.2.0]#
    [root@localhost zabbix-server-mysql-4.2.0]# zcat /usr/share/doc/zabbix-server-mysql-4.2.0/create.sql.gz | mysql zabbix -uzabbix -pzabbix
    Warning: Using a password on the command line interface can be insecure.
    [root@localhost zabbix-server-mysql-4.2.0]#

    7、修改zabbix_server.conf的配置文件

    # grep ^DB /etc/zabbix/zabbix_server.conf

    [root@localhost ~]# grep ^DB /etc/zabbix/zabbix_server.conf
    DBHost=localhost
    DBName=zabbix
    DBUser=zabbix
    DBPassword=zabbix

    # vi /etc/php.ini

    在最后一行添加一下内容

    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

    8、修改系统时间

    安装ntp服务

    # yum install ntpdate -y

    调整为亚洲上海时区

    # ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 

    同步时间服务器

    # ntpdate us.pool.ntp.org

    [root@localhost ~]# yum install ntpdate -y
    ……………………
    ……………………
    Installed:
      ntpdate.x86_64 0:4.2.6p5-28.el7.centos                                        
    
    Complete!
    [root@localhost ~]# ntpdate us.pool.ntp.org
     4 Apr 10:00:11 ntpdate[11904]: step time server 4.53.160.75 offset -32351.195618 sec
    [root@localhost ~]# date 
    Thu Apr  4 10:00:26 CST 2019
    [root@localhost ~]# 
    [root@localhost ~]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    [root@localhost ~]#
    [root@localhost ~]# ntpdate us.pool.ntp.org
     4 Apr 14:40:12 ntpdate[2807]: step time server 72.30.35.89 offset -32392.501158 sec
    [root@localhost ~]#
    [root@localhost ~]# date
    Thu Apr  4 14:40:32 CST 2019
    [root@localhost ~]#

    9、修改配置文件/etc/httpd/conf.d/zabbix.conf,时区改成 Asia/Shanghai

    # vi /etc/httpd/conf.d/zabbix.conf

    [root@localhost ~]# vi /etc/httpd/conf.d/zabbix.conf
    #
    # Zabbix monitoring system php web frontend
    #
    
    Alias /zabbix /usr/share/zabbix
    
    <Directory "/usr/share/zabbix">
        Options FollowSymLinks
        AllowOverride None
        Require all granted
    
        <IfModule mod_php5.c>
            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 max_input_vars 10000
            php_value always_populate_raw_post_data -1
            php_value date.timezone Asia/Shanghai
        </IfModule>
    </Directory>
    
    <Directory "/usr/share/zabbix/conf">
        Require all denied
    </Directory>
    
    <Directory "/usr/share/zabbix/app">
        Require all denied
    </Directory>
    
    <Directory "/usr/share/zabbix/include">
        Require all denied
    </Directory>
    
    <Directory "/usr/share/zabbix/local">
        Require all denied
    </Directory>

    10、启动apache/zabbix-server服务并设置为开机启动

    启动apache

    # systemctl start httpd

    # systemctl enable httpd

    [root@localhost ~]# systemctl start httpd
    [root@localhost ~]# systemctl status httpd
    ● httpd.service - The Apache HTTP Server
       Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
       Active: active (running) since Wed 2019-04-03 01:41:59 CST; 19s ago
         Docs: man:httpd(8)
               man:apachectl(8)
     Main PID: 68678 (httpd)
       Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
       CGroup: /system.slice/httpd.service
               ├─68678 /usr/sbin/httpd -DFOREGROUND
               ├─68679 /usr/sbin/httpd -DFOREGROUND
               ├─68680 /usr/sbin/httpd -DFOREGROUND
               ├─68681 /usr/sbin/httpd -DFOREGROUND
               ├─68682 /usr/sbin/httpd -DFOREGROUND
               └─68683 /usr/sbin/httpd -DFOREGROUND
    
    Apr 03 01:41:59 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
    Apr 03 01:41:59 localhost.localdomain httpd[68678]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using l... message
    Apr 03 01:41:59 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
    Hint: Some lines were ellipsized, use -l to show in full.
    [root@localhost ~]# systemctl enable httpd
    Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
    [root@localhost ~]# 

    启动zabbix-server服务并设置为开机启动

    # systemctl start zabbix-server

    # systemctl enable zabbix-server

    [root@localhost ~]# systemctl start zabbix-server
    [root@localhost ~]# 
    [root@localhost ~]# 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.
    [root@localhost ~]# 

      查看zabbix-server日志

    # tailf  /var/log/zabbix/zabbix_server.log

    [root@localhost ~]# tailf  /var/log/zabbix/zabbix_server.log
      4618:20190404:164956.559 server #28 started [icmp pinger #1]
      4620:20190404:164956.560 server #30 started [preprocessing manager #1]
      4622:20190404:164956.560 server #32 started [preprocessing worker #2]
      4625:20190404:164956.561 server #35 started [lld worker #1]
      4624:20190404:164956.561 server #34 started [lld manager #1]
      4626:20190404:164956.561 server #36 started [lld worker #2]
      4623:20190404:164956.562 server #33 started [preprocessing worker #3]
      4619:20190404:164956.562 server #29 started [alert manager #1]
      4621:20190404:164956.562 server #31 started [preprocessing worker #1]
      4610:20190404:164958.602 enabling Zabbix agent checks on host "Zabbix server": host became available

    zabbix-server的web目录

    # ls /usr/share/zabbix

    [root@localhost ~]# ls /usr/share/zabbix
    actionconf.php                 audio               discoveryconf.php            image.php        map.import.php     slides.php
    adm.gui.php                    auditacts.php       disc_prototypes.php          images           map.php            srv_status.php
    adm.housekeeper.php            auditlogs.php       favicon.ico                  img              overview.php       styles
    adm.iconmapping.php            browserwarning.php  fonts                        imgstore.php     profile.php        sysmap.php
    adm.images.php                 chart2.php          graphs.php                   include          queue.php          sysmaps.php
    adm.macros.php                 chart3.php          history.php                  index_http.php   report2.php        templates.php
    adm.other.php                  chart4.php          host_discovery.php           index.php        report4.php        toptriggers.php
    adm.regexps.php                chart5.php          hostgroups.php               items.php        robots.txt         tr_events.php
    adm.triggerdisplayoptions.php  chart6.php          hostinventoriesoverview.php  js               screenconf.php     trigger_prototypes.php
    adm.triggerseverities.php      chart7.php          hostinventories.php          jsLoader.php     screenedit.php     triggers.php
    adm.valuemapping.php           chart.php           host_prototypes.php          jsrpc.php        screen.import.php  usergrps.php
    adm.workingtime.php            charts.php          host_screen.php              latest.php       screens.php        users.php
    api_jsonrpc.php                conf                hosts.php                    local            services.php       zabbix.php
    app                            conf.import.php     httpconf.php                 locale           setup.php
    applications.php               correlation.php     httpdetails.php              maintenance.php  slideconf.php

    10、访问网站,例如:http://本机IP/zabbix,如下图所示:

    PHP版本

    password是我们设置的数据库密码zabbix

    输入名字

     查看zabbix基础信息

    finish

    Zabbix·server的默认账号Admin 密码zabbix,如图所示:

    基础界面如下

    根据提示可以看到上面图形界面的操作都写到一个配置文件中

    # more /etc/zabbix/web/zabbix.conf.php

    [root@localhost ~]# 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 = 'zabbix4.2';
    
    $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
    [root@localhost ~]#

    移除或改名web目录下面的setup.php文件

    # mv setup.php setup.php.bak

    [root@localhost ~]# cd /usr/share/zabbix
    [root@localhost zabbix]#
    [root@localhost zabbix]# ls
    actionconf.php                 audio               discoveryconf.php            image.php        map.import.php     slides.php
    adm.gui.php                    auditacts.php       disc_prototypes.php          images           map.php            srv_status.php
    adm.housekeeper.php            auditlogs.php       favicon.ico                  img              overview.php       styles
    adm.iconmapping.php            browserwarning.php  fonts                        imgstore.php     profile.php        sysmap.php
    adm.images.php                 chart2.php          graphs.php                   include          queue.php          sysmaps.php
    adm.macros.php                 chart3.php          history.php                  index_http.php   report2.php        templates.php
    adm.other.php                  chart4.php          host_discovery.php           index.php        report4.php        toptriggers.php
    adm.regexps.php                chart5.php          hostgroups.php               items.php        robots.txt         tr_events.php
    adm.triggerdisplayoptions.php  chart6.php          hostinventoriesoverview.php  js               screenconf.php     trigger_prototypes.php
    adm.triggerseverities.php      chart7.php          hostinventories.php          jsLoader.php     screenedit.php     triggers.php
    adm.valuemapping.php           chart.php           host_prototypes.php          jsrpc.php        screen.import.php  usergrps.php
    adm.workingtime.php            charts.php          host_screen.php              latest.php       screens.php        users.php
    api_jsonrpc.php                conf                hosts.php                    local            services.php       zabbix.php
    app                            conf.import.php     httpconf.php                 locale           setup.php
    applications.php               correlation.php     httpdetails.php              maintenance.php  slideconf.php
    [root@localhost zabbix]#
    [root@localhost zabbix]# mv setup.php setup.php.bak
    [root@localhost zabbix]#

     设置新的密码,界面的主题、语言和登陆后显示的默认界面等

    解决中文乱码无法显示的问题

    Windows字体目录地址

    C:WindowsFonts

    复制到zabbix服务器中

    查找Zabbix所使用的语言包

    # find / -name *font* -print | grep zabbix

    # ll `find / -name *font* -print | grep zabbix`

    [root@localhost ~]# find / -name *font* -print | grep zabbix
    /etc/alternatives/zabbix-web-font
    /var/lib/alternatives/zabbix-web-font
    /usr/share/zabbix/fonts
    /usr/share/zabbix/fonts/graphfont.ttf
    [root@localhost ~]#
    [root@localhost ~]# ll `find / -name *font* -print | grep zabbix`
    lrwxrwxrwx. 1 root root 38 Apr  4 14:43 /etc/alternatives/zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf
    lrwxrwxrwx. 1 root root 33 Apr  4 14:43 /usr/share/zabbix/fonts/graphfont.ttf -> /etc/alternatives/zabbix-web-font
    -rw-r--r--. 1 root root 86 Apr  4 14:43 /var/lib/alternatives/zabbix-web-font
    
    /usr/share/zabbix/fonts:
    total 0
    lrwxrwxrwx. 1 root root 33 Apr  4 14:43 graphfont.ttf -> /etc/alternatives/zabbix-web-font
    [root@localhost ~]#

    备份本身语言包

    # mv /usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/fonts/dejavu/DejaVuSans.ttf.bak

    替换成Windows的语言包

    # mv simkai.ttf /usr/share/fonts/dejavu/DejaVuSans.ttf

    [root@localhost ~]# mv /usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/fonts/dejavu/DejaVuSans.ttf.bak
    [root@localhost ~]#
    [root@localhost ~]# ls
    anaconda-ks.cfg  simkai.ttf
    [root@localhost ~]#
    [root@localhost ~]# mv simkai.ttf /usr/share/fonts/dejavu/DejaVuSans.ttf
    [root@localhost ~]#

    刷新页面已经恢复

    参考博客:

    https://www.cnblogs.com/Sungeek/p/9069999.html

    http://www.cnblogs.com/xiewenming/p/7732144.html

    zabbix4.2学习请参考这位博主
    https://www.cnblogs.com/AutoSmart/p/10505090.html

  • 相关阅读:
    深入理解并发编程 -- 多线程(一)
    使用Mybatis实现动态SQL(二)
    Java设计模式
    使用Mybatis实现动态SQL(一)
    Java
    Java安全(权限)框架
    List-LinkedList、set集合基础增强底层源码分析
    hadoop3.1.0 window win7 基础环境搭建
    springmvc传递有特殊字符的路径参数
    jhipster(springboot+datatable+jpa)后台分页,总结
  • 原文地址:https://www.cnblogs.com/djlsunshine/p/10644150.html
Copyright © 2020-2023  润新知