RedHat 7.1 下安裝 Zabbix監控程式詳解(適合linux初級使用者),redhatzabbix

來源:互聯網
上載者:User

RedHat 7.1 下安裝 Zabbix監控程式詳解(適合linux初級使用者),redhatzabbix

RedHat 7.1 安裝 Zabbix 監控程式詳解(適合對linux初級使用者)2017-05-02

安裝步驟:

1.zabbix需要安裝LAMP架構

2.安裝zabbix服務

3.初始化zabbix系統

 

1.安裝環境:VMware虛擬

1234 [root@localhost ~]# cat /etc/redhat-releaseRed Hat Enterprise Linux Server release 7.1 (Maipo)[root@localhost ~]# uname -aLinux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Thu Jan 29 18:37:38 EST 2015 x86_64 x86_64 x86_64 GNU/Linux

=================================好吧,下面開始安裝LAMP架構============================

1.為了方便擷取安裝應用,首先配置YUM服務,RedHat 預設YUM已安裝,下面我們直接配置YUM本地源和網路源即可。

   [root@localhost ~]# mount /dev/cdrom /mnt/cdrom
     mount: /dev/sr0 is write-protected, mounting read-only 

2.查看yum是否安裝;(以下標示已安裝) 

[root@localhost ~]# rpm -qa |grep yum*
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-125.el7.noarch
yum-rhn-plugin-2.0.1-5.el7.noarch
keyutils-libs-1.5.8-3.el7.x86_64
python-pyudev-0.15-6.el7.noarch

3.配置yum本地源和網路源;

[root@localhost yum.repos.d]# mkdir  repobak  建立一個備份檔案夾

[root@localhost yum.repos.d]#mv *  repobak    講yum.repos.d 檔案夾內檔案備份到repobak內

[root@localhost yum.repos.d]#vi zabbix.repo    建立一個zabbix.repo YUM源檔案,添加如下:

==============zabbix.repo檔案=======================

[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/3.2/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
[waiwang]
name=waiwang
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
enabled=1
gpgcheck=0
[extras]
name=extras
baseurl=http://mirrors.163.com/centos/7/extras/x86_64/
enabled=1
gpgcheck=0

=================END===========================

4.清除YUM快取檔案

[root@localhost ~]# yum clean all
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: extras waiwang zabbix zabbix-non-supported
Cleaning up everything

5.建立YUM快取檔案

[root@localhost ~]# yum makecache
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
extras | 3.4 kB 00:00
waiwang | 3.6 kB 00:00
zabbix | 951 B 00:00
zabbix-non-supported | 951 B 00:00
(1/8): extras/prestodelta | 99 kB 00:00
(2/8): extras/primary_db | 151 kB 00:00
(3/8): waiwang/group_gz | 155 kB 00:00
(4/8): extras/other_db | 640 kB 00:01
(5/8): extras/filelists_db | 770 kB 00:02
(6/8): waiwang/filelists_db | 6.6 MB 00:02
(7/8): waiwang/other_db | 2.4 MB 00:00
(8/8): waiwang/primary_db | 5.6 MB 00:03
(1/6): zabbix/x86_64/primary | 13 kB 00:00
(2/6): zabbix/x86_64/filelists | 43 kB 00:00
(3/6): zabbix/x86_64/other | 7.7 kB 00:00
(4/6): zabbix-non-supported/x86_64/filelists | 660 B 00:00
(5/6): zabbix-non-supported/x86_64/primary | 1.6 kB 00:00
(6/6): zabbix-non-supported/x86_64/other | 1.5 kB 00:00
zabbix 92/92
zabbix 92/92
zabbix 92/92
zabbix-non-supported 4/4
zabbix-non-supported 4/4
zabbix-non-supported 4/4
Metadata Cache Created

6.[root@localhost ~]# yum  list  可以查看YUM擷取到的檔案清單

7.關閉firewall:(vi/etc/selinux/)

[root@localhost ~]#systemctl stop firewalld.service #停止firewall

[root@localhost ~]#systemctl disable firewalld.service #禁止firewall開機啟動

[root@localhost ~]# vi /etc/selinux/config  將selinux=enforcing  改為 selinux=disabled 即可。

[root@localhost ~]# sestatus 查看selinux狀態

 

=======================================截止YUM環境已經準備完畢=======================

一.開始安裝LAMP架構

1.安裝Apache

[root@localhost ~]#yum install httpd #根據提示,輸入Y安裝即可成功安裝

[root@localhost ~]#systemctl start httpd.service #啟動apache

[root@localhost ~]#systemctl stop httpd.service #停止apache

[root@localhost ~]#systemctl restart httpd.service #重啟apache

[root@localhost ~]#systemctl enable httpd.service #設定apache開機啟動

2.安裝MariaDB

RHEL 7.0中,已經使用MariaDB替代了MySQL資料庫

2.1安裝MariaDB

[root@localhost ~]#yum install mariadb mariadb-server #詢問是否要安裝,輸入Y即可自動安裝,直到安裝完成

[root@localhost ~]#systemctl start mariadb.service #啟動MariaDB

[root@localhost ~]#systemctl stop mariadb.service #停止MariaDB

[root@localhost ~]#systemctl restart mariadb.service #重啟MariaDB

[root@localhost ~]#systemctl enable mariadb.service #設定開機啟動

3.安裝PHP

[root@localhost ~]#yum install php #根據提示輸入Y直到安裝完成

4.安裝PHP組件,使PHP支援 MariaDB

[root@localhost ~]#yum install php-mysql php-gd libjpeg*  php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash

#這裡選擇以上安裝包進行安裝,根據提示輸入Y斷行符號

[root@localhost ~]#systemctl restart mariadb.service #重啟MariaDB

[root@localhost ~]#systemctl restart httpd.service #重啟apache

5.重新啟動服務

[root@localhost ~]#systemctl restart mariadb.service #重啟MariaDB

[root@localhost ~]#systemctl restart httpd.service #重啟apache

6.登入http://localhost  測試httpd服務是否正常。

=========================LAMP架構已經搭建完畢==========================================

二.zabbix服務的安裝和配置

1安裝存放庫設定檔[root@localhost ~]#rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm2.安裝zabbix程式[root@localhost ~]#yum install zabbix-server-mysql zabbix-web-mysql zabbix-get zabbix-agent 安裝zabbix,提示點"y"即可完成安裝。[root@localhost ~]#rpm -ql zabbix-server-mysql  驗證安裝檔案

/etc/logrotate.d/zabbix-server
/etc/zabbix/zabbix_server.conf
/usr/lib/systemd/system/zabbix-server.service
/usr/lib/tmpfiles.d/zabbix-server.conf
/usr/lib/zabbix/alertscripts
/usr/lib/zabbix/externalscripts
/usr/sbin/zabbix_server_mysql
/usr/share/doc/zabbix-server-mysql-3.2.5
/usr/share/doc/zabbix-server-mysql-3.2.5/AUTHORS
/usr/share/doc/zabbix-server-mysql-3.2.5/COPYING
/usr/share/doc/zabbix-server-mysql-3.2.5/ChangeLog
/usr/share/doc/zabbix-server-mysql-3.2.5/NEWS
/usr/share/doc/zabbix-server-mysql-3.2.5/README
/usr/share/doc/zabbix-server-mysql-3.2.5/create.sql.gz
/usr/share/man/man8/zabbix_server.8.gz
/var/log/zabbix
/var/run/zabbix

3.初始化mariadb資料庫[root@localhost ~]#mysql -u root 

 

4..匯入zabbix初始模式和資料

[root@localhost ~]#zcat /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz | mysql -uroot zabbix [root@localhost ~]#mysql -u root  驗證資料是否匯入成功

MariaDB [zabbix]>use zabbix;

Database changed
MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix |
+----------------------------+
| acknowledges |
| actions |
| alerts |
| application_discovery |
| application_prototype |
| application_template |
| applications |
| auditlog |

5.配置zabbix設定檔,修改資料庫密碼為zabbix

[root@localhost ~]#vi /etc/zabbix/zabbix_server.confDBPassword=zabbix 6.配置Http設定檔,修改時區為亞洲上海# vi /etc/httpd/conf.d/zabbix.confphp_value date.timezone Asia/Shanghai 7.啟動zabbix-server,並設定開機自啟#systemctl start zabbix-server#systemctl enable zabbix-server注意:①如果zabbixserver無法啟動,則需要安裝trousers支援包。#yum install trousers②如果報pid錯誤需要做軟串連/var/run > /run#ln -s /var/run /run 8.啟動http,並設定開機自啟#systemctl start httpd#systemctl enable httpd 9.啟動zabbix-agent,並設定開機自啟#systemctl start zabbix-agent#systemctl enable zabbix-agent 10使用IE登陸zabbix圖形介面進行設定。地址:http://192.168.1.*/zabbix/(zabbix伺服器IP)賬戶:admin   密碼:zabbix 11. zabbix圖形介面的配置。圖形介面配置網上有很多,可以自行查詢,此處省略。。。。。。。。。。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.