Centos7 Zabbix3.2安裝

實驗環境:php

阿里雲
[zabbix@miyan ~]$ cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 

不得不說,官方文檔確實強大html

1.官方文檔地址:前端

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

2.導入源:mysql

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

3.安裝zabbix包web

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

清楚的看一下要安裝那些包sql

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@miyan ~]$ sudo yum install zabbix-agent

5.初始化數據庫apache

CentOS 7 版本將MySQL數據庫軟件從默認的程序列表中移除,用mariadb代替了。用mariadb也行。我仍是選擇了mysqlvim

(1)安裝mysqlcentos

[zabbix@miyan ~]$ rpm -ivh mysql-community-release-el7-5.noarch.rpm
#安裝帶有當前可用的mysql5系列社區版資源的rpm包
[zabbix@miyan ~]$ 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@miyan ~]$ sudo yum install mysql-community-server
[zabbix@miyan ~]$ sudo systemctl enable mysqld  #設置開機啓動
[zabbix@miyan ~]$ 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@miyan ~]$ mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

解決辦法:

[zabbix@miyan ~]$ 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@miyan zabbix-server-mysql-3.0.1]$ pwd
/usr/share/doc/zabbix-server-mysql-3.0.1
[zabbix@miyan zabbix-server-mysql-3.0.1]$ ls
AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README

運行命令

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

注意加紅色部分,易錯。

6.啓動zabbix server服務

修改配置文件:

[zabbix@miyan ~]$ vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
實際上個人配置文件修改的是DBHost和DBPassword去掉前面的#號。

啓動zabbix服務,設置開機自啓動

[zabbix@miyan ~]$ sudo systemctl start zabbix-server
[zabbix@miyan ~]$ 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@miyan ~]$ 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@miyan ~]$ sudo systemctl start httpd
[zabbix@miyan ~]$ 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@miyan zabbix-server-mysql-3.0.1]$ sudo vim /usr/share/zabbix/include/locales.inc.php 

找到第55行,將false改成true

點擊zabbix右上角小人,進行修改:

仍是遇到了中文亂碼問題,直接google。

 

參考這位大神的。

http://www.cnblogs.com/enjoycode/p/zabbix_3_installation_on_centos_7.html

Win+R打開運行,輸入fonts,回車進入Windows字體目錄,找到微軟雅黑-常規字體,複製出來將文件名修改成msyh.ttf,而後上傳到/usr/share/zabbix/fonts

上傳成功後,編輯

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

將'graphfont' 修改成msyh。

 

 

修改完成後,點擊刷新,便可完成。

相關文章
相關標籤/搜索