放在最前面:鑒於網上爬蟲猖獗,博客被盜時有發生,這裡需要來個鏈接,大家請認準來自博客園的Scoter:http://www.cnblogs.com/scoter2008 1、安裝環境:VMware虛擬機 2、為方便你參考,發一下官方文檔: 3、安裝zabbix需要epel源,因為需要一款名叫fpin ...
放在最前面:鑒於網上爬蟲猖獗,博客被盜時有發生,這裡需要來個鏈接,大家請認準來自博客園的Scoter:http://www.cnblogs.com/scoter2008
1、安裝環境:VMware虛擬機
[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
2、為方便你參考,發一下官方文檔:
https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages
3、安裝zabbix需要epel源,因為需要一款名叫fping的軟體(這款軟體你下載源碼編譯安裝貌似行不通!),然後其他的yum源將mysql全部識別為mariadb了,所以想yum安裝mysql的小伙伴請安裝mysql社區版官方源,或者你編譯安裝吧
wget https://mirrors.tuna.tsinghua.edu.cn/epel//epel-release-latest-7.noarch.rpm yum安裝 yum install -y epel-release-latest-7.noarch.rpm rpm安裝 rpm -ivh epel-release-latest-7.noarch.rpm
4、下載zabbix安裝包rpm格式,根據這個網址選擇需要安裝包下載
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-agent-3.2.1-1.el7.x86_64.rpm http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-get-3.2.1-1.el7.x86_64.rpm http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-proxy-mysql-3.2.1-1.el7.x86_64.rpm http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-sender-3.2.1-1.el7.x86_64.rpm http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-server-mysql-3.2.1-1.el7.x86_64.rpm http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-web-3.2.1-1.el7.noarch.rpm http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-web-mysql-3.2.1-1.el7.noarch.rpm
5、查看zabbix需要的安裝包
yum install zabbix-* Dependencies Resolved =================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================== Installing: zabbix-agent x86_64 3.2.1-1.el7 /zabbix-agent-3.2.1-1.el7.x86_64 1.1 M zabbix-get x86_64 3.2.1-1.el7 /zabbix-get-3.2.1-1.el7.x86_64 862 k zabbix-proxy-mysql x86_64 3.2.1-1.el7 /zabbix-proxy-mysql-3.2.1-1.el7.x86_64 2.2 M zabbix-release noarch 3.2-1.el7 /zabbix-release-3.2-1.el7.noarch 21 k zabbix-sender x86_64 3.2.1-1.el7 /zabbix-sender-3.2.1-1.el7.x86_64 885 k zabbix-server-mysql x86_64 3.2.1-1.el7 /zabbix-server-mysql-3.2.1-1.el7.x86_64 3.4 M zabbix-web noarch 3.2.1-1.el7 /zabbix-web-3.2.1-1.el7.noarch 32 M zabbix-web-mysql noarch 3.2.1-1.el7 /zabbix-web-mysql-3.2.1-1.el7.noarch 0.0 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.4 updates 2.7 M httpd-tools x86_64 2.4.6-40.el7.centos.4 updates 83 k iksemel x86_64 1.4-6.el7 epel 50 k libXpm x86_64 3.5.11-3.el7 base 54 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_2.1 updates 747 k php x86_64 5.4.16-36.3.el7_2 updates 1.4 M php-bcmath x86_64 5.4.16-36.3.el7_2 updates 56 k php-cli x86_64 5.4.16-36.3.el7_2 updates 2.7 M php-common x86_64 5.4.16-36.3.el7_2 updates 563 k php-gd x86_64 5.4.16-36.3.el7_2 updates 126 k php-ldap x86_64 5.4.16-36.3.el7_2 updates 51 k php-mbstring x86_64 5.4.16-36.3.el7_2 updates 504 k php-mysql x86_64 5.4.16-36.3.el7_2 updates 100 k php-pdo x86_64 5.4.16-36.3.el7_2 updates 97 k php-xml x86_64 5.4.16-36.3.el7_2 updates 124 k t1lib x86_64 5.1.2-14.el7 base 166 k unixODBC x86_64 2.3.1-11.el7 base 413 k Transaction Summary =================================================================================================================================== Install 8 Packages (+25 Dependent packages) Total size: 52 M Total download size: 12 M Installed size: 81 M
6、安裝這些包
7、yum安裝mysql
安裝mysql社區版官方源 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm 查看可以安裝的mysql版本 yum repolist enabled|grep mysql mysql-connectors-community/x86_64 MySQL Connectors Community 24 mysql-tools-community/x86_64 MySQL Tools Community 38 mysql56-community/x86_64 MySQL 5.6 Community Server 289 安裝 yum install -y mysql-community-server
8、啟動mysql
systemctl enable mysqld systemctl start mysqld 嘗試進入mysql mysql -uroot -p 密碼為空
9、創建zabbix資料庫並授權
mysql -uroot -p mysql>create database zabbix character set utf8 collate utf8_bin; mysql>grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql>flush privileges; mysql>quit;
10、導入zabbix資料庫
zcat /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz |mysql -uzabbix -pzabbix -b zabbix
11、修改zabbix配置,主要是zabbix資料庫用戶名和密碼的設定
配置預設資料庫用戶名 DBUser=zabbix 如果你創建zabbix資料庫的時候不一樣,請更改 配置預設的資料庫密碼沒有設定,改成你設定的密碼 DBPassword=zabbix 其他可以預設
12、啟動zabbix服務,並設置開機自啟
systemctl start zabbix-server systemctl enable zabbix-server
13、編輯zabbix前端的php配置,更改下時區
vim /etc/httpd/conf.d/zabbix.conf 去掉時區前的#號,改一下位置 php_value date.timezone Asia/Shanghai 其他預設
14、啟動apache服務,並設置開機自啟
systemctl start httpd systemctl enable httpd
15、登錄zabbix
http://10.0.0.12/zabbix
16、zabbix基本配置,這裡直接上圖了
zabbix資料庫的密碼是你設定的,我這裡是zabbix
這裡的Name可以空著不填,其他預設
這是彙總的信息
看到這張圖,說明已經安裝成功了
登錄你的zabbix吧,用戶名預設為Admin,密碼預設為zabbix
17、zabbix簡單配置
17.1 修改界面為中文
17.2 解決圖形顯示中文亂碼,在儀錶板的常用的圖形欄目里隨意添加一個圖形,我這裡添加的是cpu負載,進入圖形界面會看到亂碼
17.2.1 Win+R打開運行,輸入fonts,回車進入Windows字體目錄,找到微軟雅黑-常規字體,複製出來將文件名修改為msyh.ttf,然後上傳到/usr/share/zabbix/fonts
17.2.2 上傳成功以後,修改defines.inc.php的第45行,將graphfont改為msyh
vim /usr/share/zabbix/include/defines.inc.php
17.2.3 保存後,刷新界面,文字就出來了
未完待續...