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

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

PHP安装

源码安装

rpm -ivh php55w-common-5.5.-.w6.x86_64.rpm;

rpm -ivh php55w-cli-5.5.-.w6.x86_64.rpm;

rpm -ivh php55w-5.5.-.w6.x86_64.rpm;

rpm -ivh t1lib-5.1.-.el6_2..x86_64.rpm;

rpm -ivh php55w-gd-5.5.-.w6.x86_64.rpm;

rpm -ivh php55w-pdo-5.5.-.w6.x86_64.rpm;

rpm -ivh php55w-mysql-5.5.-.w6.x86_64.rpm;

rpm -ivh php55w-bcmath-5.5.-.w6.x86_64.rpm;

rpm -ivh php55w-mbstring-5.5.-.w6.x86_64.rpm;

rpm -ivh php55w-xml-5.5.-.w6.x86_64.rpm;

rpm -ivh php55w-ldap-5.5.-.w6.x86_64.rpm;

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

没有安装httpd-mmn = 20051115

[root@monitor-server zabbix_file]# rpm -ivh php55w-5.5.-.w6.x86_64.rpm
warning: php55w-5.5.-.w6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
error: Failed dependencies:
httpd-mmn = is needed by php55w-5.5.-.w6.x86_64
httpd is needed by php55w-5.5.-.w6.x86_64
[root@monitor-server zabbix_file]#

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

[root@monitor-server zabbix_file]# rpm -ivh httpd-2.2.-.el6.centos..x86_64.rpm
error: Failed dependencies:
apr-util-ldap is needed by httpd-2.2.-.el6.centos..x86_64
httpd-tools = 2.2.-.el6.centos. is needed by httpd-2.2.-.el6.centos..x86_64
libapr-.so.()(64bit) is needed by httpd-2.2.-.el6.centos..x86_64
libaprutil-.so.()(64bit) is needed by httpd-2.2.-.el6.centos..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 解决办法: .下载所需软件包: 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
.编译安装: yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
具体步骤如下: a:解决apr not found问题>>>>>> [root@xt test]# tar -zxf apr-1.4..tar.gz
[root@xt test]# cd apr-1.4.
[root@xt apr-1.4.]# ./configure --prefix=/usr/local/apr
[root@xt apr-1.4.]# make && make install b:解决APR-util not found问题>>>> [root@xt test]# tar -zxf apr-util-1.3..tar.gz
[root@xt test]# cd apr-util-1.3.
[root@xt apr-util-1.3.]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr--config
[root@xt apr-util-1.3.]# make && make install c:解决pcre问题>>>>>>>>> [root@xt test]#unzip -o pcre-8.10.zip
[root@xt test]#cd pcre-8.10
[root@xt pcre-8.10]#./configure --prefix=/usr/local/pcre
[root@xt pcre-8.10]#make && make install
.最后编译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参数:

[root@mid01 zabbix_file]# sed -i "s@;date.timezone =@date.timezone = Asia/Shanghai@g" /etc/php.ini
[root@mid01 zabbix_file]# sed -i "s@max_execution_time = 30@max_execution_time = 300@g" /etc/php.ini
[root@mid01 zabbix_file]# sed -i "s@post_max_size = 8M@post_max_size = 32M@g" /etc/php.ini
[root@mid01 zabbix_file]# sed -i "s@max_input_time = 60@max_input_time = 300@g" /etc/php.ini
[root@mid01 zabbix_file]# sed -i "s@memory_limit = 128M@memory_limit = 128M@g" /etc/php.ini
[root@mid01 zabbix_file]# sed -i "s@;mbstring.func_overload = 0@ambstring.func_overload = 2@g" /etc/php.ini
[root@mid01 zabbix_file]# sed -i "s@;always_populate_raw_post_data =@always_populate_raw_post_data = -1@g" /etc/php.ini

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

[root@mid01 zabbix_file]# rpm -qa| grep mysql
mysql-5.1.-.el6.x86_64
mysql-server-5.1.-.el6.x86_64
php55w-mysql-5.5.-.w6.x86_64
qt-mysql-4.6.-.el6_4.x86_64
mysql-libs-5.1.-.el6.x86_64
强制卸载:
[root@mid01 zabbix_file]# rpm -e --nodeps mysql-5.1.-.el6.x86_64
[root@mid01 zabbix_file]# rpm -e --nodeps mysql-server-5.1.-.el6.x86_64
warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave
[root@mid01 zabbix_file]# rpm -e --nodeps mysql-libs-5.1.-.el6.x86_64

 下载mysql5.5tar包并解压:

[root@mid01 zabbix_file]# tar -xvf MySQL-5.5.-.el6.x86_64.rpm-bundle.tar
MySQL-shared-5.5.-.el6.x86_64.rpm
tar: MySQL-shared-5.5.-.el6.x86_64.rpm: time stamp -- :: is 15825714.217439403 s in the future
MySQL-test-5.5.-.el6.x86_64.rpm
tar: MySQL-test-5.5.-.el6.x86_64.rpm: time stamp -- :: is 15825717.725779682 s in the future
MySQL-server-5.5.-.el6.x86_64.rpm
tar: MySQL-server-5.5.-.el6.x86_64.rpm: time stamp -- :: is 15825702.522847995 s in the future
MySQL-embedded-5.5.-.el6.x86_64.rpm
tar: MySQL-embedded-5.5.-.el6.x86_64.rpm: time stamp -- :: is 15825680.34405559 s in the future
MySQL-client-5.5.-.el6.x86_64.rpm
tar: MySQL-client-5.5.-.el6.x86_64.rpm: time stamp -- :: is 15825671.899264437 s in the future
MySQL-devel-5.5.-.el6.x86_64.rpm
tar: MySQL-devel-5.5.-.el6.x86_64.rpm: time stamp -- :: is 15825676.822329417 s in the future
MySQL-shared-compat-5.5.-.el6.x86_64.rpm
tar: MySQL-shared-compat-5.5.-.el6.x86_64.rpm: time stamp -- :: is 15825711.705837133 s in the future
[root@mid01 zabbix_file]# ls
MySQL-5.5.-.el6.x86_64.rpm-bundle.tar MySQL-test-5.5.-.el6.x86_64.rpm php55w-mysql-5.5.-.w6.x86_64.rpm
MySQL-client-5.5.-.el6.x86_64.rpm php55w-5.5.-.w6.x86_64.rpm php55w-pdo-5.5.-.w6.x86_64.rpm
MySQL-devel-5.5.-.el6.x86_64.rpm php55w-bcmath-5.5.-.w6.x86_64.rpm php55w-xml-5.5.-.w6.x86_64.rpm
MySQL-embedded-5.5.-.el6.x86_64.rpm php55w-cli-5.5.-.w6.x86_64.rpm php-ldap-5.5.-.mga4.x86_64.rpm
MySQL-server-5.5.-.el6.x86_64.rpm php55w-common-5.5.-.w6.x86_64.rpm t1lib-5.1.-.el6_2..x86_64.rpm
MySQL-shared-5.5.-.el6.x86_64.rpm php55w-gd-5.5.-.w6.x86_64.rpm
MySQL-shared-compat-5.5.-.el6.x86_64.rpm php55w-mbstring-5.5.-.w6.x86_64.rpm

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

[root@mid01 zabbix_file]# rpm -ivh MySQL-server-5.5.-.el6.x86_64.rpm
warning: MySQL-server-5.5.-.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [%]
:MySQL-server ########################################### [%]
[root@mid01 zabbix_file]# rpm -ivh MySQL-client-5.5.-.el6.x86_64.rpm
warning: MySQL-client-5.5.-.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [%]
:MySQL-client ########################################### [%]

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

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

查看mysql安装路径:

[root@mid01 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

[root@mid01 mysql]# vim /etc/my.cnf
[root@mid01 mysql]# service mysql restart
Shutting down MySQL. [ OK ]
Starting MySQL... [ OK ]
[root@mid01 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5.-log MySQL Community Server (GPL) Copyright (c) , , 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 (3D000): No database selected
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
rows in set (0.00 sec) mysql> use mysql;
Database changed
mysql> UPDATE user SET password=PASSWORD("zabbix_server") WHERE user='root';
Query OK, rows affected (0.00 sec)
Rows matched: Changed: Warnings: mysql> FLUSH PRIVILEGES;
Query OK, 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++

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

  1. Zabbix源码安装部署

    zabbix源码部署安装 参考文档:https://www.zabbix.com/documentation/4.0/manual/installation/install ​ https://www ...

  2. zabbix源码安装实例

    环境 系统                 Centos7 zabbix版本      Zabbix 3.4.15 (revision 86739) zabbix源码安装 .tar.gz cd zab ...

  3. zabbix源码安装后,设置为服务启动和关闭

    zabbix源码安装,使用service启动与关闭服务 1. zabbix客户端的系统服务脚本 1.1 拷贝启动脚本 zabbix的源码提供了系统服务脚本,在/usr/local/src/zabbix ...

  4. 在ConoHa上Centos7环境下源码安装部署LNMP

    本文记录了从源码,在Centos 7上手动部署LNMP环境的过程,为了方便以后对nginx和mariadb进行升级,这里采用yum的方式进行安装. 1.建立运行网站和数据库的用户和组 groupadd ...

  5. zabbix源码安装 令人窒息的操作

    一.简介 zabbix-server主要分为2部分: zabbix程序 程序根据客户端的监控项,从客户端获取数据并写入到数据库,再根据触发器/动作等配置进行操作. 展示页面 使用php编写,php脚本 ...

  6. zabbix源码安装

    Zabbix通过C/S模式采集数据,通过B/S模式在web端展示和配置. 被监控端:主机通过安装agent方式采集数据,网络设备通过SNMP方式采集数据 Server端:通过收集SNMP和agent发 ...

  7. piwik源码安装部署

    一简单介绍1.piwik介绍Piwik是一个PHP和MySQL的开放源代码的Web统计软件,它给你一些关于你的网站的实用统计报告,比如网页浏览人数,访问最多的页面,搜索引擎关键词等等.Piwik拥有众 ...

  8. Thingsboard源码安装部署

    交流QQ群 如果安装有其他问题,可以到QQ群求助 环境安装 开发环境要求:Jdk 1.8版本Postgresql 9以上Node.jsNpmMaven 3.6以上Git工具Idea开发工具 JDK 下 ...

  9. Zabbix源码安装,使用service命令管理zabbix进程

    1.       前期环境: Zabbix源代码解压包:/root/zabbix-3.0.27 Zabbix安装路径:/usr/local/zabbix-3.0.27 2.       复制启动脚本到 ...

随机推荐

  1. jmeter Thread Groups的顺序执行与并行执行

    本期目标: 理解Thread Groups的顺序执行与并行执行 控制因子:Run Thread Groups consecutively(i.e.one at time) 预期结论: 1.勾选 Run ...

  2. Eureka 系列(06)消息广播(下):TaskDispacher 之 Acceptor - Worker 模式

    Eureka 系列(06)消息广播(下):TaskDispacher 之 Acceptor - Worker 模式 [TOC] Spring Cloud 系列目录 - Eureka 篇 Eureka ...

  3. FrameWork内核解析之WindowManagerService(一)中篇

    阿里P7Android高级架构进阶视频免费学习请点击:https://space.bilibili.com/474380680 1.WMS概述 WMS是系统的其他服务,无论对于应用开发还是Framew ...

  4. Oracle查询最近执行过的SQL语句

    oracle 查询最近执行过的 SQL语句 select sql_text,last_load_time from v$sql order by last_load_time desc; SELECT ...

  5. [轉]关于CR0.WP

    关于CR0.WP 我们知道CR0的WP位可以关闭内核写保护.他和页表的R/W位有关.Intel手册中的描述绕来绕去似乎一直没有说到重点. When the processor is in superv ...

  6. Codeforces New Year and Arbitrary Arrangement

    New Year and Arbitrary Arrangement time limit per test2 seconds You are given three integers k, pa a ...

  7. Asp.net Controller中View 和Action方法认证Authorize 及对AuthorizeAttribute扩展

    Asp.net Controller中View和Action方法认证Authorize 在建立Web 站点安全性时 1.登录后才可访问系统文件 ——限制 Forms认证 <authenticat ...

  8. Aspose.Words转换为PDF的时候字体丢失的问题解决

    系统中明明有字体的,Word中显示也正常,就是转换为PDF以后不正常,字体丢失,被替换成了等线字体 好一番研究,终于找到原因 ,原因是Windows\Fonts下的文件,有些只是虚拟的路径,真正的字体 ...

  9. Android 5.1 预制输入法

    Android修改默认输入法为讯飞方法如下: 首先将讯飞输入法apk预制到系统app中: 在firefly-rk3288_android5.1_git_20180126/out/target/prod ...

  10. 如何在mysql数据库中开启使用tab键补全功能

    声明:数据库tab键补全的是表名,列名,数据库名,不是数据库中的命令,变量等 永久支持tab键补全[root@localhost ~]# vim /etc/my.cnf添加以下两行:[mysql]au ...