zabbix--源码安装部署zabbix3.2

zabbix运行在lamp环境或者lnmp环境都是可以的,如果是新系统推荐使用lamp或者lnmp一键安装包,

或者可以向下面这种方式:

PHP安装

源码安装

rpm -ivh php55w-common-5.5.38-1.w6.x86_64.rpm;

rpm -ivh php55w-cli-5.5.38-1.w6.x86_64.rpm;

rpm -ivh php55w-5.5.38-1.w6.x86_64.rpm;

rpm -ivh t1lib-5.1.2-6.el6_2.1.x86_64.rpm;

rpm -ivh php55w-gd-5.5.38-1.w6.x86_64.rpm;

rpm -ivh php55w-pdo-5.5.38-1.w6.x86_64.rpm;

rpm -ivh php55w-mysql-5.5.38-1.w6.x86_64.rpm;

rpm -ivh php55w-bcmath-5.5.38-1.w6.x86_64.rpm;

rpm -ivh php55w-mbstring-5.5.38-1.w6.x86_64.rpm;

rpm -ivh php55w-xml-5.5.38-1.w6.x86_64.rpm;

rpm -ivh php55w-ldap-5.5.30-1.w6.x86_64.rpm;

PS:遇到的问题,安装第三个php rpm包时,提示:

没有安装httpd-mmn = 20051115

[[email protected] zabbix_file]# rpm -ivh php55w-5.5.38-1.w6.x86_64.rpm
warning: php55w-5.5.38-1.w6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
error: Failed dependencies:
    httpd-mmn = 20051115 is needed by php55w-5.5.38-1.w6.x86_64
    httpd is needed by php55w-5.5.38-1.w6.x86_64
[[email protected]-server zabbix_file]# 

这里需要安装httpd服务,但安装httpd时,提示:

[[email protected] zabbix_file]# rpm -ivh httpd-2.2.15-60.el6.centos.4.x86_64.rpm
error: Failed dependencies:
    apr-util-ldap is needed by httpd-2.2.15-60.el6.centos.4.x86_64
    httpd-tools = 2.2.15-60.el6.centos.4 is needed by httpd-2.2.15-60.el6.centos.4.x86_64
    libapr-1.so.0()(64bit) is needed by httpd-2.2.15-60.el6.centos.4.x86_64
    libaprutil-1.so.0()(64bit) is needed by httpd-2.2.15-60.el6.centos.4.x86_64

因为机器不能访问外网,我只上传了个iso镜像上去做本地yum源,也许改用源码的方式安装httpd会靠谱些,但编译时提示:

configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to " -g -O2 -pthread"
  setting CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no
configure: error: APR-util not found.  Please read the documentation.

还是绕不过上面的那个坎,apr-util

我参考了这篇博客:http://www.linuxidc.com/Linux/2012-06/62289.htm

今日编译apache时出错:

#./configure --prefix……检查编辑环境时出现:

checking for APR... no
configure: error: APR not found .  Please read the documentation

解决办法:

1.下载所需软件包:

wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
2.编译安装:

yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
具体步骤如下:

  a:解决apr not found问题>>>>>>

[[email protected] test]# tar -zxf apr-1.4.5.tar.gz
[[email protected] test]# cd  apr-1.4.5
[[email protected] apr-1.4.5]# ./configure --prefix=/usr/local/apr
[[email protected] apr-1.4.5]# make && make install  

  b:解决APR-util not found问题>>>>

[[email protected] test]# tar -zxf apr-util-1.3.12.tar.gz
[[email protected] test]# cd apr-util-1.3.12
[[email protected] apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config
[[email protected] apr-util-1.3.12]# make && make install 

  c:解决pcre问题>>>>>>>>>

[[email protected] test]#unzip -o pcre-8.10.zip
[[email protected] test]#cd pcre-8.10
[[email protected] pcre-8.10]#./configure --prefix=/usr/local/pcre
[[email protected] pcre-8.10]#make && make install
4.最后编译Apache时加上:

--with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util/
 --with-pcre=/usr/local/pcre

成功编译完成~

不过安装apr和apr-util之前又遇到个坑:

编译apr时出现这个报错:configure: error: no acceptable C compiler found in $PATH

原因是系统没安装gcc软件套件,还好这个本地yum有(终于起作用了,好感动),直接yum install gcc就行。

安装pcre时又遇到坑:这次提示g++    在make pcre的时候出现libtool: line 990: g++: command not found错误  解决方法:yum -y install gcc+ gcc-c++,都装了。

继续make pcre又报错:.libs/pcrecpp.o: could not read symbols: Bad value     解决方法:./configure --disable-shared --with-pic   编译时多加个参数

好了,继续源码安装apache

./configure  --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre

make && make install

嗯,安装完php,继续!

PS:发现一件尴尬的事情,apr相关的包,在本地yum源里有。。

配置PHP参数:

[[email protected] zabbix_file]# sed -i "[email protected];date.timezone [email protected] = Asia/[email protected]" /etc/php.ini
[[email protected] zabbix_file]# sed -i "[email protected]_execution_time = [email protected]_execution_time = [email protected]" /etc/php.ini
[[email protected] zabbix_file]# sed -i "[email protected]_max_size = [email protected]_max_size = [email protected]" /etc/php.ini
[[email protected] zabbix_file]# sed -i "[email protected]_input_time = [email protected]_input_time = [email protected]" /etc/php.ini
[[email protected] zabbix_file]# sed -i "[email protected]_limit = [email protected]_limit = [email protected]" /etc/php.ini
[[email protected] zabbix_file]# sed -i "[email protected];mbstring.func_overload = [email protected]_overload = [email protected]" /etc/php.ini
[[email protected] zabbix_file]# sed -i "[email protected];always_populate_raw_post_data [email protected]_populate_raw_post_data = [email protected]" /etc/php.ini

接着安装mysql,要查看是否已安装mysql,如果版本不符合,则需要卸载,重装:

[[email protected] zabbix_file]# rpm -qa| grep mysql
mysql-5.1.71-1.el6.x86_64
mysql-server-5.1.71-1.el6.x86_64
php55w-mysql-5.5.38-1.w6.x86_64
qt-mysql-4.6.2-26.el6_4.x86_64
mysql-libs-5.1.71-1.el6.x86_64
强制卸载:
[[email protected] zabbix_file]# rpm -e --nodeps mysql-5.1.71-1.el6.x86_64
[[email protected] zabbix_file]# rpm -e --nodeps mysql-server-5.1.71-1.el6.x86_64
warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave
[[email protected] zabbix_file]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

 下载mysql5.5tar包并解压:

[[email protected] zabbix_file]# tar -xvf MySQL-5.5.56-1.el6.x86_64.rpm-bundle.tar
MySQL-shared-5.5.56-1.el6.x86_64.rpm
tar: MySQL-shared-5.5.56-1.el6.x86_64.rpm: time stamp 2017-04-28 02:06:41 is 15825714.217439403 s in the future
MySQL-test-5.5.56-1.el6.x86_64.rpm
tar: MySQL-test-5.5.56-1.el6.x86_64.rpm: time stamp 2017-04-28 02:06:45 is 15825717.725779682 s in the future
MySQL-server-5.5.56-1.el6.x86_64.rpm
tar: MySQL-server-5.5.56-1.el6.x86_64.rpm: time stamp 2017-04-28 02:06:31 is 15825702.522847995 s in the future
MySQL-embedded-5.5.56-1.el6.x86_64.rpm
tar: MySQL-embedded-5.5.56-1.el6.x86_64.rpm: time stamp 2017-04-28 02:06:10 is 15825680.34405559 s in the future
MySQL-client-5.5.56-1.el6.x86_64.rpm
tar: MySQL-client-5.5.56-1.el6.x86_64.rpm: time stamp 2017-04-28 02:06:02 is 15825671.899264437 s in the future
MySQL-devel-5.5.56-1.el6.x86_64.rpm
tar: MySQL-devel-5.5.56-1.el6.x86_64.rpm: time stamp 2017-04-28 02:06:07 is 15825676.822329417 s in the future
MySQL-shared-compat-5.5.56-1.el6.x86_64.rpm
tar: MySQL-shared-compat-5.5.56-1.el6.x86_64.rpm: time stamp 2017-04-28 02:06:42 is 15825711.705837133 s in the future
[[email protected] zabbix_file]# ls
MySQL-5.5.56-1.el6.x86_64.rpm-bundle.tar     MySQL-test-5.5.56-1.el6.x86_64.rpm      php55w-mysql-5.5.38-1.w6.x86_64.rpm
MySQL-client-5.5.56-1.el6.x86_64.rpm         php55w-5.5.38-1.w6.x86_64.rpm           php55w-pdo-5.5.38-1.w6.x86_64.rpm
MySQL-devel-5.5.56-1.el6.x86_64.rpm          php55w-bcmath-5.5.38-1.w6.x86_64.rpm    php55w-xml-5.5.38-1.w6.x86_64.rpm
MySQL-embedded-5.5.56-1.el6.x86_64.rpm       php55w-cli-5.5.38-1.w6.x86_64.rpm       php-ldap-5.5.29-1.mga4.x86_64.rpm
MySQL-server-5.5.56-1.el6.x86_64.rpm         php55w-common-5.5.38-1.w6.x86_64.rpm    t1lib-5.1.2-6.el6_2.1.x86_64.rpm
MySQL-shared-5.5.56-1.el6.x86_64.rpm         php55w-gd-5.5.38-1.w6.x86_64.rpm
MySQL-shared-compat-5.5.56-1.el6.x86_64.rpm  php55w-mbstring-5.5.38-1.w6.x86_64.rpm

共八个rpm包,暂时只需要用到server和client:

[[email protected] zabbix_file]# rpm -ivh MySQL-server-5.5.56-1.el6.x86_64.rpm
warning: MySQL-server-5.5.56-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
[[email protected] zabbix_file]# rpm -ivh MySQL-client-5.5.56-1.el6.x86_64.rpm
warning: MySQL-client-5.5.56-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]

不过我把所有mysql rpm包都装了顺序是:

rpm -ivh mysql-community-common-5.7.11-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.11-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.11-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.11-1.el6.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.11-1.el6.x86_64.rpm
rpm -ivh mysql-community-embedded-5.7.11-1.el6.x86_64.rpm
rpm -ivh mysql-community-embedded-devel-5.7.11-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.11-1.el6.x86_64.rpm
rpm -ivh mysql-community-test-5.7.11-1.el6.x86_64.rpm

查看mysql安装路径:

[[email protected] zabbix_file]# find / -name mysql -print
/etc/rc.d/init.d/mysql
/etc/logrotate.d/mysql
/usr/lib64/perl5/DBD/mysql
/usr/lib64/perl5/auto/DBD/mysql
/usr/lib64/mysql
/usr/share/mysql
/usr/bin/mysql
/var/lib/mysql
/var/lib/mysql/mysql

data默认目录:/var/lib/mysql
mysql默认安装目录:/usr/share/mysql

PS:在mysql5.5 的安装目录里会有多个cnf配置文件,根据需要复制一个到/etc/my.cnf。mysql5.5之后的就默认只有一个配置文件了/etc/my.cnf(linux版本)

设置账号、密码、字符编码:

刚刚安装的mysql不输入密码也可以进入mysql交互界面,重置root有多种方法,这里介绍其中一种:

在my.cnf的[mysqld]下面加一行:skip-grant-tables

然后重启mysql,再进入交互界面重置密码,最后再删了skip-grant-tables

[[email protected] mysql]# vim /etc/my.cnf
[[email protected] mysql]# service mysql restart
Shutting down MySQL.                                       [  OK  ]
Starting MySQL...                                          [  OK  ]
[[email protected] mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.56-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> UPDATE user SET password=PASSWORD("zabbix_server") WHERE user=‘root‘;
ERROR 1046 (3D000): No database selected
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql> use mysql;
Database changed
mysql> UPDATE user SET password=PASSWORD("zabbix_server") WHERE user=‘root‘;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

如果安装lnmp没问题,接下来就是安装zabbix装。https://www.zabbix.com/documentation/2.4/manual/installation/install

这个是官网上面的教程选择“4 Installation from sources”这个选项,意思就是源文件安装。

1.先解压源文件:$tar -zxvf zabbix-2.4.7.tar.gz

2.在/database/mysql文件夹下找到schema.sql、images.sql、data.sql这三个文件

3.创建mysql账号

mysql -u root -p

mysql> create user ‘zabbix‘@‘localhost‘ identified by ‘zabbix‘;

mysql> create database zabbix;

mysql> grant all privileges on zabbix.* to ‘zabbix‘@‘localhost‘;

mysql> flush privileges;

mysql> exit;

4.导入初始化数据

mysql -u zabbix -p zabbix < schema.sql

mysql -u zabbix -p zabbix < images.sql

mysql -u zabbix -p zabbix < data.sql

这样Zabbix的初始数据就导入了。

5.然后:groupadd zabbix

useradd -g zabbix zabbix

6.Configure the sources

./configure --prefix=/usr/local --enable-server --enable-agent --with-mysql

--enable-ipv6 --with-libcurl --with-libxml2 --with-net-snmp

configure后面的 --prefix=/usr/local最好是加上,加上之后后面一步的make install就能安装到这

个/usr/local/文件夹下了。

最后的 --with-net-snmp加了会报错,不加之后就好了。(当然,net-snmp这个最好安装一下,目前还

不知道不加这个有没有什么问题,暂时没有发现影响)

PS:我用lnmp一键安装包部署的环境,mysql不在默认路径下,我需要把--with-mysql 改成:--with-mysql=/usr/local/mysql/bin/mysql_config 可以通过find / -name mysql_config搜到具体路径

在编译的过程中,会需要说某某rpm包找不到,这时可以通过yum安装。

yum -y install gcc+ gcc-c++

原文地址:https://www.cnblogs.com/laonicc/p/7290110.html

时间: 2024-11-12 18:14:56

zabbix--源码安装部署zabbix3.2的相关文章

CentOS6.8源码安装部署Zabbix3.4.5

本文档主要介绍CentOS6.8在lamp环境下安装以及部署Zabbix3.4.5(注:本文部署环境为 php-5.6.23 + mysql-5.6.24 + httpd-2.2.15 + CentOS6.8) 基本流程: 1.准备编译环境 2.yum源配置并且安装php和Apche的所需包 3.mysql服务的启动和创建zabbix账号 4.下载zabbix3.4.5安装包以及安装 5.zabbix客户端安装 步骤一:准备编译环境 系统版本说明 [[email protected] tools

zabbix源码安装流程及报错解决方法

zabbix源码安装流程及报错解决方法 一. zabbix的介绍 1) zabbix是什么 zabbix是一款基于web页面的.开源的.企业级的,支持分布式部署的监控软件. 2)2.zabbix的作用 监控windows和Linux主机上的软硬件状态. 监控各网络设备,如路由器.交换机.防火墙.f5.打印机等. 支持邮件短信微信等平台发送告警通知. 通过web页面及图形展示监控数据. 3)zabbix的特性 由zabbix server和agent程序协同工作,还支持分布式监控,这时需要安装za

zabbix源码安装,自定义监控205的用户数,有触发器但没有邮件报警

zabbix源码安装,自定义监控205的用户数,有触发器但没有邮件报警 监控端配置:(192.168.4.5) 1基础环境:(实验环境可以关闭防火墙,但生产环境不能关闭,否则不安全,要设置相应规则) [[email protected]桌面]# /etc/init.d/iptables stop [[email protected]桌面]# setenforce 0 2搭建lamp平台,(它运行在lamp平台上) [[email protected]桌面]# yum -y install htt

Zabbix源码安装与yum安装

一.源码安装方式 LAMP环境准备: #groupadd zabbix#useradd -g zabbix zabbix #mkdir /opt/zabbix 1.安装依赖包: #yum install httpd php php-gd php-xml php-mysql libxml2-devel.x86_64 net-snmp-devel.x86_64 curl-devel 2.解压zabbix源码包到指定路径: #tar zvxf zabbix-3.2.3.tar.gz -C /usr/l

nginx的源码安装部署

Nginx安装:源码安装 添加普通用户账号来运行nginx:useradd nginx -M -r -s /sbin/nologin 安装依赖包yum install -y gcc pcre-devel openssl-devel 解压并安装Nginx:wget http://nginx.org/download/nginx-1.10.3.tar.gztar xvf nginx-1.10.3.tar.gz cd nginx-1.10.3./configure --user=nginx \--gr

zabbix源码安装

Zabbix通过C/S模式采集数据,通过B/S模式在web端展示和配置. 被监控端:主机通过安装agent方式采集数据,网络设备通过SNMP方式采集数据 Server端:通过收集SNMP和agent发送的数据,写入MySQL数据库,再通过php+apache在web前端展示. Zabbix运行条件: Server: Zabbix Server需运行在LAMP或LNMP环境下,对硬件要求低 Agent: 目前已有的agent基本支持市面常见的Linux.HPUX.Solaris.Sun.windo

zabbix 源码安装

环境: OS:Centos 6.5 安装步骤: 1,官网下载源码安装包zabbix-2.4.5.tar.gz. 2,添加用户和组 shell>groupadd zabbix shell>useradd zabbix -g zabbix 3,创建zabbix数据库,并授权账户. 4,安装yum依赖包 yum -y groupinstall "Development tools" yum -y install php-mbstring php-bcmath yum -y ins

piwik源码安装部署

一简单介绍1.piwik介绍Piwik是一个PHP和MySQL的开放源代码的Web统计软件,它给你一些关于你的网站的实用统计报告,比如网页浏览人数,访问最多的页面,搜索引擎关键词等等.Piwik拥有众多不同功能的插件,你可以添加新的功能或是移除你不需要的功能,Piwik同样可以安装在你的服务器上面,数据就保存在你自己的服务器上面.你可以非常容易的插入统计图表到你的博客或是网站亦或是后台的控制面板中.安装完成后,你只需将一小段代码放到将要统计的网页中即可.2.piwik概况Piwik支持插件,你可

puppet源码安装部署

一.安装环境 系统环境 CentOS release 6.8 (Final) 2.6.32-642.1.1.el6.x86_64 编译环境 gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) 二.源码编译Puppet 步骤1 Ruby的安装 wget https://codeload.github.com/ruby/ruby/zip/ruby_1_8_7 unzip ruby-ruby_1_8_7.zip cd ruby-ruby_1_8_7