RedHat 7.1 下安装 Zabbix监控程序详解(适合linux初级用户)

RedHat 7.1 安装 Zabbix 监控程序详解(适合对linux初级用户)2017-05-02

RedHat 7.1 安装 Zabbix 监控程序详解(适合对linux初级用户)2017-05-02

安步骤:

装步骤:

1.zabbix需要安装LAMP架构

1.zabbix需要安装LAMP架构

2.安装zabbix服务

2.安装zabbix服务

3.初始化zabbix系统

3.初始化zabbix系统

 

 

1.安环境:VMware虚拟

1.装环境:VMware虚拟

1
2
3
4
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.1 (Maipo)
[root@localhost ~]# uname -a
Linux 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
1
2
3
4
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.1 (Maipo)
[root@localhost ~]# uname -a
Linux 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架构============================

=================================好吧,下面开始安装LAMP架构============================

1.为有利于得安装使用,首先配置YUM服务,RedHat
默认YUM已设置,下面我们一直配置YUM本地源与网络源即可。

1.为方便得安装使用,首先配置YUM服务,RedHat
默认YUM已安装,下面我们一直配置YUM本地自与网络源即可。

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

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

2.查看yum是否安装;(以下标示已安装)

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

[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本地自及网络源;

3.配置yum本地源与网络源;

[root@localhost yum.repos.d]# mkdir  repobak   #新建一个备份文件夹

[root@localhost yum.repos.d]# mkdir  repobak   #新建一个备份文件夹

[root@localhost yum.repos.d]#mv *  repobak    #讲yum.repos.d
文件夹内文件备份到repobak内

[root@localhost yum.repos.d]#mv *  repobak    #讲yum.repos.d
文件夹内文件备份到repobak内

[root@localhost yum.repos.d]#vi zabbix.repo     #新建一个zabbix.repo
YUM源文件,添加如下:

[root@localhost yum.repos.d]#vi zabbix.repo     #新建一个zabbix.repo
YUM源文件,添加如下:

=================================zabbix.repo文件===================================

=================================zabbix.repo文件===================================

[zabbix]
name=Zabbix Official Repository – $basearch                            
    #只是援引变量$basearh为系统平台项目(x86_64&i386)
baseurl=http://repo.zabbix.com/zabbix/3.2/rhel/7/$basearch/        
 #网络源地址 (镜像站)
enabled=1                                                              
                #启用为1 禁用为0
gpgcheck=1                                                              
              #校验为1 禁止校验为0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591      #
这个根据网版本自动生成,可概括。

[zabbix]
name=Zabbix Official Repository – $basearch                            
    #而援引变量$basearh为系统平台项目(x86_64&i386)
baseurl=http://repo.zabbix.com/zabbix/3.2/rhel/7/$basearch/        
 #网源地址 (镜像站)
enabled=1                                                              
                #启用为1 禁用为0
gpgcheck=1                                                              
              #校验为1 禁止校验为0
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

[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====================================

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

4.清除YUM缓存文件

4.清除YUM缓存文件

[root@localhost ~]# yum clean all                                    
      #清除yum缓存

[root@localhost ~]# yum clean all                                    
      #清除yum缓存

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 

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缓存文件

5.创建YUM缓存文件

 

 

[root@localhost ~]# yum makecache                                  
 #生成yum缓存

[root@localhost ~]# yum makecache                                  
 #生成yum缓存

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 

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获取到的文件列表

6.[root@localhost ~]# yum  list  可以查看YUM获取到的文本列表

7.关闭firewall:(vi/etc/selinux/)

7.关闭firewall:(vi/etc/selinux/)

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

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

[root@localhost ~]#systemctl disable firewalld.service              
    #禁止firewall开机启动

[root@localhost ~]#systemctl disable firewalld.service              
    #取缔firewall开机启动

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

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

[root@localhost ~]# sestatus                                        
              #查看selinux状态

[root@localhost ~]# sestatus                                        
              #查看selinux状态

 

 

=======================================截止YUM环境已经准备完毕=======================

=======================================截止YUM环境既准备了=======================

一.开端安装LAMP架构

一.开端安装LAMP架构

1.安装Apache

1.安装Apache

[root@localhost ~]#yum install httpd                                
          #冲提示,输入Y安装即可成功安装

[root@localhost ~]#yum install httpd                                
          #根据提示,输入Y安装即可成功安装

[root@localhost ~]#systemctl start httpd.service                    
     #启动apache

[root@localhost ~]#systemctl start httpd.service                    
     #启动apache

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

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

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

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

[root@localhost ~]#systemctl enable httpd.service                    
  #装apache开机启动

[root@localhost ~]#systemctl enable httpd.service                    
  #安装apache开机启动

 

 

2.安装MariaDB

2.安装MariaDB

RHEL 7.0蒙受,已经运用MariaDB替代了MySQL数据库

RHEL 7.0遭遇,已经以MariaDB替代了MySQL数据库

2.1安装MariaDB

2.1安装MariaDB

[root@localhost ~]#yum install mariadb mariadb-server              
 #刺探是否要设置,输入Y即可自行装,直到安到位

[root@localhost ~]#yum install mariadb mariadb-server              
 #问询是否要安装,输入Y即可自动安装,直到安好

[root@localhost ~]#systemctl start mariadb.service                  
   #启动MariaDB

[root@localhost ~]#systemctl start mariadb.service                  
   #启动MariaDB

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

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

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

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

[root@localhost ~]#systemctl enable mariadb.service                
 #设置开机启动

[root@localhost ~]#systemctl enable mariadb.service                
 #安开机启动

3.安装PHP

3.安装PHP

[root@localhost ~]#yum install php                                  
       #根据提示输入Y直到安好 

[root@localhost ~]#yum install php                                  
       #基于提示输入Y直到安完成 

4.安装PHP组件,使PHP支持 MariaDB

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  

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

                                                                       
                                         
#此处选择上述安装包进行安装,根据提示输入Y回车

                                                                       
                                         
#这里选择上述安装包进行设置,根据提示输入Y回车

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

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

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

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

 

 

5.重新启航服务

5.重复开动服务

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

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

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

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

 

 

6.登录http://localhost  测试httpd服务是否正规。

6.登录http://localhost  测试httpd服务是否正常。

=========================LAMP架构已搭建了==========================================

=========================LAMP架构已搭建完毕==========================================

二.zabbix服务的设置和配备

二.zabbix服务之安与部署

1装存储库配置文件

1安装存储库配置文件

[root@localhost ~]#rpm -ivh
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86\_64/zabbix-release-3.2-1.el7.noarch.rpm

[root@localhost ~]#rpm -ivh
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86\_64/zabbix-release-3.2-1.el7.noarch.rpm

2.安装zabbix程序

2.安装zabbix程序

[root@localhost ~]#yum install zabbix-server-mysql zabbix-web-mysql
zabbix-get zabbix-agent 安装zabbix,提示点”y”即可成功安装。

[root@localhost ~]#yum install zabbix-server-mysql zabbix-web-mysql
zabbix-get zabbix-agent 安装zabbix,提示点”y”即可完成安装。

[root@localhost ~]#rpm -ql zabbix-server-mysql  验证安装文件

[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

/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数据库

3.初始化mariadb数据库

[root@localhost ~]#mysql -u root 

[root@localhost ~]#mysql -u root 

图片 1

图片 2

 

 

4..导入zabbix初始模式以及多少

4..导入zabbix初始模式和数据

[root@localhost ~]#zcat
/usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz | mysql -uroot
zabbix 

[root@localhost ~]#zcat
/usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz | mysql -uroot
zabbix 

[root@localhost ~]#mysql -u root  验证数据是否导入成功

[root@localhost ~]#mysql -u root  验证数据是否导入成功

MariaDB [zabbix]>use zabbix;

MariaDB [zabbix]>use zabbix;

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

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

5.布置zabbix配置文件,修改数据库密码吗zabbix

5.配置zabbix配置文件,修改数据库密码为zabbix

[root@localhost ~]#vi /etc/zabbix/zabbix_server.conf

[root@localhost ~]#vi /etc/zabbix/zabbix_server.conf

DBPassword=zabbix

DBPassword=zabbix

 

 

6.安排Http配置文件,修改时区吗亚洲上海

6.布局Http配置文件,修改时区也亚洲上海

# vi /etc/httpd/conf.d/zabbix.conf

# vi /etc/httpd/conf.d/zabbix.conf

php_value date.timezone Asia/Shanghai

php_value date.timezone Asia/Shanghai

 

 

7.开行zabbix-server,并安装开机自启

7.起动zabbix-server,并安装开机自启

#systemctl start zabbix-server

#systemctl start zabbix-server

#systemctl enable zabbix-server

#systemctl enable zabbix-server

注意:

注意:

①如果zabbixserver无法启动,则用装trousers支持包。

①如果zabbixserver无法启动,则需安装trousers支持包。

#yum install trousers

#yum install trousers

②如果报pid错误

②如果报pid错误

亟待开软连接/var/run > /run

内需做软连接/var/run > /run

#ln -s /var/run /run

#ln -s /var/run /run

 

 

8.启动http,并设置开机自启

8.开行http,并安装开机自启

#systemctl start httpd

#systemctl start httpd

#systemctl enable httpd

#systemctl enable httpd

 

 

9.起动zabbix-agent,并安装开机自启

9.启动zabbix-agent,并设置开机自启

#systemctl start zabbix-agent

#systemctl start zabbix-agent

#systemctl enable zabbix-agent

#systemctl enable zabbix-agent

 

 

10使用IE登陆zabbix图形界面进行设置。

10应用IE登陆zabbix图形界面进行安装。

地址:http://192.168.1.\*/zabbix/(zabbix服务器IP)

地址:http://192.168.1.\*/zabbix/(zabbix服务器IP)

账户:admin   密码:zabbix

账户:admin   密码:zabbix

 

 

11.
zabbix图形界面的配置。图形界面配置网上有不少,可以自行查询,此处省略。。。。。。。。。。

11.
zabbix图形界面的安排。图形界面配置网上发多,可以自行查询,此处省略。。。。。。。。。。

 

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图