centos7安裝zabbix3.4

1,裝機後修改系統設置php

  • 修改主機名: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,安裝MariaDBhtml

  1. yum install mariadb-server mariadb前端

  2. mariadb數據庫的相關命令是:java

    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/downloadmysql

  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,導入數據linux

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

5,配置zabbix的數據庫設置sql

  vim /etc/zabbix/zabbix_server.conf  主要配置數據庫的用戶名,庫名,密碼,端口等,其它設置也能夠安裝狀況配置數據庫

6,啓動zabbix 並設置開機啓動vim

 

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

再刷新下網頁, 發現亂碼解決了

相關文章
相關標籤/搜索