- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業(yè)務(wù)經(jīng)營(yíng)許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯(lián)網(wǎng)協(xié)會(huì )理事單位
- 安全聯(lián)盟認證網(wǎng)站身份V標記
- 域名注冊服務(wù)機構許可:滇D3-20230001
- 代理域名注冊服務(wù)機構:新網(wǎng)數碼
Centos 7.4 安裝Zabbix 3.4
[root@juny-18 ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
關(guān)閉防火墻
[root@juny-18 ~]# systemctl stop firewalld.service #關(guān)閉防火墻
[root@juny-18 ~]# systemctl disable firewalld.service #開(kāi)機不啟動(dòng)防火墻
關(guān)閉selinux
[root@juny-18 ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config #在/etc/selinux/config 把SELNUX=enforcing換成SELINUX=disabled
[root@juny-18 ~]# grep SELINUX=disabled /etc/selinux/config #過(guò)濾剛剛換的disabled
SELINUX=disabled
[root@juny-18 ~]# setenforce 0 #清空selinux的配置
setenforce: SELinux is disabled
[root@juny-18 ~]#
MariaDB數據庫管理系統是MySQL的一個(gè)分支,主要由開(kāi)源社區在維護,采用GPL授權許可。
開(kāi)發(fā)這個(gè)分支的原因是:甲骨文公司收購了MySQL后,有將MySQL閉源的潛在風(fēng)險,因此社區采用分支的方式來(lái)避開(kāi)這個(gè)風(fēng)險。
MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能輕松成為MySQL的代替品。
安裝mariadb
[root@juny-18 ~]# yum install mariadb-server mariadb –y
已加載插件:fastestmirror, langpacks
base
中間省略安裝過(guò)程
已安裝:
mariadb.x86_64 1:5.5.56-2.el7 mariadb-server.x86_64 1:5.5.56-2.el7
作為依賴(lài)被安裝:
perl-DBD-MySQL.x86_64 0:4.023-5.el7
作為依賴(lài)被升級:
mariadb-libs.x86_64 1:5.5.56-2.el7
完畢!
mariadb數據庫的相關(guān)命令是:
[root@juny-18 ~]# systemctl start mariadb #啟動(dòng)MariaDB
[root@juny-18 ~]# systemctl stop mariadb #停止MariaDB
[root@juny-18 ~]# systemctl restart mariadb #重啟MariaDB
[root@juny-18 ~]# systemctl enable mariadb #設置開(kāi)機啟動(dòng)
安裝zabbix3.4
[root@juny-18 ~]# rpm -ivh //repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
獲取//repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
準備中... ################################# [100%]
正在升級/安裝...
1:zabbix-release-3.4-1.el7.centos ################################# [100%]
[root@juny-18 ~]# yum install zabbix-server-mysql zabbix-web-mysql -y
獲取//repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
準備中... ################################# [100%]
正在升級/安裝...
1:zabbix-release-3.4-1.el7.centos ################################# [100%]
[root@juny-18 ~]# yum install zabbix-server-mysql zabbix-web-mysql -y
已加載插件:fastestmirror, langpacks
zabbix | 2.9 kB 00:00:00
zabbix-non-supported | 951 B 00:00:00
zabbix/x86_64/primary_db | 18 kB 00:00:00
zabbix-non-supported/x86_64/primary | 1.6 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.neusoft.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
zabbix-non-supported 4/4
安裝省略中間過(guò)程
已安裝:
zabbix-server-mysql.x86_64 0:3.4.1-1.el7 zabbix-web-mysql.noarch 0:3.4.1-1.el7
作為依賴(lài)被安裝:
OpenIPMI-libs.x86_64 0:2.0.19-15.el7 OpenIPMI-modalias.x86_64 0:2.0.19-15.el7 fping.x86_64 0:3.10-4.el7
httpd.x86_64 0:2.4.6-67.el7.centos.2 httpd-tools.x86_64 0:2.4.6-67.el7.centos.2 iksemel.x86_64 0:1.4-6.el7
libzip.x86_64 0:0.10.1-8.el7 mailcap.noarch 0:2.1.41-2.el7 php.x86_64 0:5.4.16-42.el7
php-bcmath.x86_64 0:5.4.16-42.el7 php-cli.x86_64 0:5.4.16-42.el7 php-common.x86_64 0:5.4.16-42.el7
php-gd.x86_64 0:5.4.16-42.el7 php-ldap.x86_64 0:5.4.16-42.el7 php-mbstring.x86_64 0:5.4.16-42.el7
php-mysql.x86_64 0:5.4.16-42.el7 php-pdo.x86_64 0:5.4.16-42.el7 php-xml.x86_64 0:5.4.16-42.el7
t1lib.x86_64 0:5.1.2-14.el7 unixODBC.x86_64 0:2.3.1-11.el7 zabbix-web.noarch 0:3.4.1-1.el7
完畢!
[root@juny-18 ~]#
創(chuàng )建數據庫
[root@juny-18 ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 2
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]>
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 zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.08 sec)
MariaDB [(none)]> exit
Bye
[root@juny-18 ~]#
導入數據庫
[root@juny-18 ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4.1/create.sql.gz |mysql -uzabbix -pzabbix zabbix
配置數據庫用戶(hù)及密碼
[root@juny-18 ~]# grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf
38:LogFile=/var/log/zabbix/zabbix_server.log
49:LogFileSize=0
72:PidFile=/var/run/zabbix/zabbix_server.pid
82:SocketDir=/var/run/zabbix
101:DBName=zabbix
117:DBUser=zabbix
316:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
434:Timeout=4
476:AlertScriptsPath=/usr/lib/zabbix/alertscripts
486:ExternalScripts=/usr/lib/zabbix/externalscripts
522:LogSlowQueries=3000
[root@juny-18 ~]# vim /etc/zabbix/zabbix_server.conf #修改配置文件
啟動(dòng)zabbix server并設置開(kāi)機啟動(dòng)
[root@juny-18 ~]# systemctl start zabbix-server
[root@juny-18 ~]# systemctl enable zabbix-server
編輯Zabbix前端PHP配置,更改時(shí)區
[root@juny-18 ~]# vim /etc/httpd/conf.d/zabbix.conf
修改為亞洲上海
保存并退出
SELinux配置
[root@juny-18 ~]# setsebool -P httpd_can_connect_zabbix on
setsebool: SELinux is disabled.
[root@juny-18 ~]# setsebool -P httpd_can_cetwork_connect_db on
setsebool: SELinux is disabled.
啟動(dòng)httpd并設置開(kāi)機啟動(dòng)
[root@juny-18 ~]# systemctl start httpd #啟動(dòng)httpd服務(wù)
[root@juny-18 ~]# systemctl enable httpd #設置開(kāi)機啟動(dòng)httpd服務(wù)
瀏覽器訪(fǎng)問(wèn),并進(jìn)行安裝
//192.168.1.18/zabbix/
點(diǎn)擊next step
點(diǎn)擊 next step
輸入數據庫的密碼
點(diǎn)擊next step
點(diǎn)擊 next step
確認信息沒(méi)錯以后
點(diǎn)擊 next step
完成安裝,會(huì )將在/etc/zabbix/web/zabbix.conf.php生成配置文件
Congratulations! You have successfully installed Zabbix frontend.
Configuration file "/etc/zabbix/web/zabbix.conf.php" created.
[root@juny-18 ~]# cat /etc/zabbix/web/zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'Zabbix 監控平臺';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
[root@juny-18 ~]#
點(diǎn)擊finish
登錄最新版Zabbix3.4 默認用戶(hù)Admin 默認密碼zabbix
輸入用戶(hù)名和密碼以后點(diǎn)擊 sign in
到此安裝已經(jīng)結束
五、zabbxi-agent安裝及配置
安裝zabbxi-agent
[root@juny-18 ~]# yum install zabbix-agent –y
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解決依賴(lài)關(guān)系
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> 正在檢查事務(wù)
---> 軟件包 zabbix-agent.x86_64.0.3.4.1-1.el7 將被 安裝
--> 解決依賴(lài)關(guān)系完成
依賴(lài)關(guān)系解決
=====================================================================================================================================================
Package 架構 版本 源 大小
=====================================================================================================================================================
正在安裝:
zabbix-agent x86_64 3.4.1-1.el7 zabbix 353 k
事務(wù)概要
=====================================================================================================================================================
安裝 1 軟件包
總下載量:353 k
安裝大?。?.3 M
Downloading packages:
zabbix-agent-3.4.1-1.el7.x86_64.rpm | 353 kB 00:00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : zabbix-agent-3.4.1-1.el7.x86_64 1/1
驗證中 : zabbix-agent-3.4.1-1.el7.x86_64 1/1
已安裝:
zabbix-agent.x86_64 0:3.4.1-1.el7
完畢!
配置zabbxi-agent
[root@juny-18 ~]# vim /etc/zabbix/zabbix_agentd.conf
修改IP地址server IP地址
輸入IP地址
修改serverActive IP地址
輸入IP地址
啟動(dòng)zabbxi-agent并設置開(kāi)機啟動(dòng)
[root@juny-18 ~]# systemctl restart zabbix-agent.service
[root@juny-18 ~]# systemctl enable zabbix-agent.service
售前咨詢(xún)
售后咨詢(xún)
備案咨詢(xún)
二維碼
TOP