centos7安装zabbix3.4

1,装机后修改系统设置

  • 修改主机名:vim /etc/hostname ,修改为zabbix_test.com
  • 关闭防火墙:
    [root@localhost ~]# systemctl stop firewalld.service
    [root@localhost ~]# systemctl disable firewalld.service
    Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
    Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service
  • 关闭selinux : vim /etc/selinux/config,修改为:SELINUX=disabled
  • 修改/etc/hosts文件
  • yum源使用阿里云的yum源:http://mirrors.aliyun.com/repo/找到对应的系统版本,替换/etc/yum.repos.d/CentOS-Base.repo,yun makecache。http://mirrors.aliyun.com/help/centos(阿里云);http://mirrors.163.com/.help/centos.html(163源)
  • 重启系统

2,安装MariaDB

  1. yum install mariadb-server mariadb

  2. mariadb数据库的相关命令是:

    systemctl start mariadb  #启动MariaDB
    systemctl stop mariadb  #停止MariaDB
    systemctl restart mariadb  #重启MariaDB
    systemctl enable mariadb  #设置开机启动
  3. 默认安装的root密码是空白,以下命令更改密码
    [root@zabbix_test ~]# mysqladmin -u root password "password"   #更改密码为password

     

  4. 登录数据库,mysql -uroot -p
  5. 创建zabbix数据库 zabbix数据库的密码为zabbix
  create database zabbix character set utf8 collate utf8_bin;
  grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

3,  安装zabbix3.4 https://www.zabbix.com/download

  1. rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
  2. yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent 
  3. yum install zabbix-get zabbix-sender zabbix-java-gateway (选择安装)

4,导入数据

  zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

5,配置zabbix的数据库设置

  vim /etc/zabbix/zabbix_server.conf  主要配置数据库的用户名,库名,密码,端口等,其它设置也可以安装情况配置

6,启动zabbix 并设置开机启动

 

systemctl enable zabbix-server
systemctl start zabbix-server
systemctl enable zabbix-agent
systemctl start zabbix-agent

 

7, 编辑Zabbix前端PHP配置,主要是更改时区

  vim /etc/httpd/conf.d/zabbix.conf

  修改此行:php_value date.timezone Asia/Shanghai

8,启动httpd并设置开机启动

  systemctl start httpd

  systemctl enable httpd

9,浏览器访问并配置

http://IP/zabbix/

 

这里的Name待安装完成后显示在页面的右上角

使用Admin/zabbix初始管理员密码登录

 

 10 ,修改为中文界面

在Adminstration-->Users下面找到对应的用户,点进去,找到Language,选择Chinese(zh_CN),更新后,刷新页面即可切换为中文界面。

11,中文显示乱码问题

一种原因是数据库创建的时候需要设置为支持utf8

第二种情况如下:

原因是zabbix前端默认的字体对中文的支持不好,需要替换下

在自己的windows电脑上,打开C:\Windows\Fonts,里面全是字体文件,找到想要的,我这里选择是常规楷体。

将此字体文件C:\Windows\Fonts\simkai.ttf 上传到zabbix服务器的zabbix的fonts路径下,我这里路径为:/usr/share/zabbix/fonts。

如下图,graphfont.ttf是原来默认的字体文件

在切换到路径/usr/share/zabbix/include下,修改defines.inc.php 文件

文件里的 ZBX_GRAPH_FONT_NAME',           'graphfont'   就是指默认的字体文件是graphfont 对应/usr/share/zabbix/fonts里的graphfont.ttf文件

使用命令 sed -i 's/graphfont/simkai/g' defines.inc.php 全部替换为simkai文件

重新加载下配置文件:systemctl reload httpd.service

再刷新下网页, 发现乱码解决了

 

 

 

 

 


 

posted @ 2018-02-28 19:58  露似真珠月似弓  阅读(2908)  评论(0编辑  收藏  举报