1. 程式人生 > >Zabbix 3.4.10 服務端的安裝與設定

Zabbix 3.4.10 服務端的安裝與設定

 

實驗驗目的:  Zabbix 3.x 服務端的安裝

實驗主機:  m01  (centos 7.4)  IP 10.0.0.61/172.16.1.61

1) 配置yum源, 並用wget命令把相關的軟體包下載到本地, 然後再進行安裝, 如下所示

#配置yum 源解決依賴的問題
[[email protected] /]#  rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
...

安裝wget losf 命令
[
[email protected]
/]# yum -y install wget lsof ... #使用wget命令將上述的軟體包下載到一個目錄,然後使用yum本地安裝即可 [[email protected] /]# mkdir zabbix-pkg [[email protected] /]# wget https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-server-mysql-3.4.10-1.el7.x86_64.rpm https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-web-3.4.10-1.el7.noarch.rpm https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-get-3.4.10-1.el7.x86_64.rpm https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-agent-3.4.10-1.el7.x86_64.rpm https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-web-mysql-3.4.10-1.el7.noarch.rpm -P zabbix-pkg/
... #使用yum本地安裝 [[email protected] /]# yum -y localinstall zabbix-pkg/* ...

 

2) 安裝LAMP平臺 MariaDB至m01 主機上

#安裝LAMP平臺
[r[email protected] /]# yum -y install httpd mariadb-server php php-mysql
....

#設定資料庫
[[email protected] /]# systemctl start mariadb
[[email protected] /]# lsof -i :3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 1861 mysql 13u IPv4 25413 0t0 TCP *:mysql (LISTEN) [[email protected] /]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by '123456'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> quit Bye [[email protected] /]# mysql -u zabbix -p123456 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> quit Bye [[email protected] /]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix Enter password: [[email protected] /]# !mysql mysql -u zabbix -p123456 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 5 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | test | | zabbix | +--------------------+ 3 rows in set (0.00 sec) MariaDB [(none)]> use zabbix; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [zabbix]> show tables; +----------------------------+ | Tables_in_zabbix | +----------------------------+ | acknowledges | | actions | | alerts | | application_discovery | | application_prototype | ......

 

3)編輯zabbix server 配置檔案, DBPassword 設定為123456

#編輯 zabbix server 配置檔案
[[email protected] /]# vim /etc/zabbix/zabbix_server.conf
119 ### Option: DBPassword
120 #       Database password. Ignored for SQLite.
121 #       Comment this line if no password is used.
122 #
123 # Mandatory: no
124 # Default:
125 # DBPassword=
126 DBPassword=123456

 

4) 修改為亞洲/上海時區

#修改WEB時區為亞洲/上海
[[email protected] /]#sed -i -e '/# php_value/s/#//;s/Europe\/Riga/Asia\/Shanghai/' /etc/httpd/conf.d/zabbix.conf

 

5) 設定zabbix服務開機啟動 ,設定字符集, 以及登入賬號

#並設定zabbix服務開機啟動,
[[email protected] /]# systemctl start httpd zabbix-server zabbix-agent
[[email protected] /]# systemctl enable httpd zabbix-server zabbix-agent mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[[email protected] /]# systemctl is-active httpd zabbix-server zabbix-agent mariadb
active
active
active
active

#解決中文字型亂碼問題
[[email protected] /]# yum -y install wqy-microhei-fonts
...
[[email protected] /]# cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf 
cp: overwrite ‘/usr/share/fonts/dejavu/DejaVuSans.ttf’? y
...

#web 登陸賬號密碼
使用者: Admin
密碼: zabbix

 6) 

在web頁面中,設定後, 顯示如下介面表示zabbix服務端安裝成功

10.0.0.61/zabbix

 

 

 

 

 

 

 

 

 

 

 

 

 

將m01 新增到zabbix 監控中, 讓zabbix服務端先監控自己