• zabbix3.2.5编译安装部署


     
    LNMP基础环境安装
    下载mysql,为了更加快的部署 采用的二进制安装包
    [root@localhost ~]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
     
    安装需要的依赖包
    [root@localhost ~]# yum -y install perl perl-devel libaio
     
    新建mysql用户
    [root@localhost ~]# useradd -s /sbin/nologin -M mysql
     
    创建目录
    [root@localhost ~]# mkdir -p /data/mysql/data
    [root@localhost ~]# chown -R mysql:mysql /data/mysql/data/
     
    解压和初始化
    [root@localhost ~]# tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
    [root@localhost ~]# mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
    [root@localhost ~]# cd /usr/local/mysql/
    [root@localhost ~]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql/data/
     
    拷贝配置文件
    [root@localhost ~]# cp support-files/my-default.cnf /etc/my.cnf
    [root@localhost ~]# cp support-files/mysql.server /etc/init.d/mysqld
     
    [root@localhost ~]# chmod 755 /etc/init.d/mysqld
    [root@localhost ~]# vim /etc/init.d/mysqld # 找到bashedir 增加下面的路径
    basedir=/usr/local/mysql    
    datadir=/data/mysql/data         
     
    设置开机启动
    [root@localhost ~]# chkconfig --add mysqld
    [root@localhost ~]# chkconfig mysqld on
    [root@localhost ~]# service mysqld start
    [root@localhost ~]# netstat -lnpt
     
    php安装
    #安装依赖包关系
    [root@localhost ~]# yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel libpng libpng-devel freetype freetype-devel gcc-c++ libcurl-devel libjpeg-devel pcre-devel
     
    #下载php安装包
    [root@localhost ~]# wget http://mirrors.sohu.com/php/php-5.6.9.tar.gz
    [root@localhost ~]# tar zxvf php-5.6.9.tar.gz
     
    解压安装
    [root@localhost ~]# cd php-5.6.9
    [root@localhost ~]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath
     
    [root@localhost ~]# make && make install
     
    #拷贝配置文件
    [root@localhost ~]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
    [root@localhost ~]# useradd -s /sbin/nologin -M php-fpm
    [root@localhost ~]# cp /root/php-5.6.9/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
    [root@localhost ~]# chmod +x /etc/init.d/php-fpm
    [root@localhost ~]# chkconfig --add php-fpm
    [root@localhost ~]# service php-fpm start
     
    #拷贝php.ini
    [root@localhost ~]# cp php.ini-production /usr/local/php/etc/php.ini
    [root@localhost ~]# vim /usr/local/php/etc/php.ini #修改以下参数,否则zabbix安装不了
     
    max_execution_time = 300
    memory_limit = 128M
    post_max_size = 16M
    upload_max_filesize = 2M
    max_input_time = 300
    date.timezone = PRC
     
    #重启
    [root@localhost ~]# service php-fpm restart
     
     
    安装nginx
    下载nginx
    [root@localhost ~]# wget http://mirrors.sohu.com/nginx/nginx-1.13.0.tar.gz
    [root@localhost ~]# tar zxvf nginx-1.13.0.tar.gz
    [root@localhost ~]# cd nginx-1.13.0
    [root@localhost ~]# ./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre
     
    [root@localhost ~]# make && make install
    [root@localhost ~]# vim /etc/init.d/nginx
    [root@localhost ~]# chmod 755 /etc/init.d/nginx
    [root@localhost ~]# chkconfig --add nginx
    [root@localhost ~]# chkconfig nginx on
    [root@localhost ~]# service nginx start
    [root@localhost ~]# mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
    [root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
    [root@localhost ~]# /usr/local/nginx/sbin/nginx -t
    [root@localhost ~]# service nginx reload
     
    安装zabbix
    下载 安装包
    [root@localhost ~]# wget https://ncu.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.5/zabbix-3.2.5.tar.gz
     
    增加用户
    [root@localhost ~]# useradd -M -s /sbin/nlogin zabbix
     
    解压
    [root@zabbix ~]# tar zxvf zabbix-3.2.5.tar.gz
    [root@zabbix ~]# cd zabbix-3.2.5
     
    #新建数据并导入数据
    [root@localhost ~]# mysql -uroot
    mysql> create database zabbix character set utf8 collate utf8_general_ci;
    mysql> grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';
     
    [root@localhost ~]# mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
    [root@localhost ~]# mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
    [root@localhost ~]# mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql
     
    安装
     
    [root@localhost ~]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl
    [root@localhost ~]# make install
     
    安装zabbix过程中
    configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
    [root@zabbix zabbix-3.2.5]# yum install net-snmp-devel
     
    配置zabbix_server配置文件,
    [root@localhost ~]# vim /usr/local/zabbix/etc/zabbix_server.conf
    增加一下的配置内容,配置zabbix连接mysql
    DBName=zabbix
    DBUser=root
    DBPassword=zabbix
    DBPort=3306
    [root@localhost ~]# vim /usr/local/zabbix/etc/zabbix_agentd.conf
    Server=127.0.0.1 #默认监控服务器自己,这三行不用改
    ServerActive=127.0.0.1
    Hostname=Zabbix server
    UnsafeUserParameters=1 #允许所有的字符是在用户定义的参数,参数传递,也就是支持自定义脚本
    [root@localhost ~]# /usr/local/zabbix/sbin/zabbix_server #直接启动zabbix_server
    #启动有报错,解决方法如下
    [root@localhost ~]# find / -name libmysqlclient.so.18
    [root@localhost ~]# echo "/usr/local/mysql/lib" >> /etc/ld.so.conf
    [root@localhost ~]# ldconfig
     
    [root@localhost ~]# /usr/local/zabbix/sbin/zabbix_server #修改后重新启动
    [root@localhost ~]# netstat -lnpt #查看端口是否启动
     
    Zabbix默认有部分启动脚本,如果你自己也可以通过脚本的方式来实现,可以使用他的模板来实现
    脚本在源码目录的misc/init.d/下面(使用fedora下面的core即可,也可以使用fedroa core5的脚本均可)
    复制脚本到 init.d目录下
    [root@localhost ~]# cd zabbix-3.2.5/misc/init.d/
    [root@localhost ~]# cp fedora/core/zabbix_server /etc/init.d/
    [root@localhost ~]# cp fedora/core/zabbix_agentd /etc/init.d/
     
    修改脚本配置
    [root@localhost ~]# vim /etc/init.d/zabbix_server
    BASEDIR=/usr/local/zabbix  #找到此行,并修改成zabbix安装的绝对路径
    [root@localhost ~]# vim /etc/init.d/zabbix_agentd
    BASEDIR=/usr/local/zabbix  #找到此行,并修改成zabbix安装的绝对路径
    设置开机启动
    [root@localhost ~]# chkconfig --add zabbix_agentd
    [root@localhost ~]# chkconfig --add zabbix_server
    [root@localhost ~]# chkconfig zabbix_agentd on
    [root@localhost ~]# chkconfig zabbix_server on
     
    [root@localhost ~]# service zabbix_agentd start
    [root@localhost ~]# service zabbix_server restart
     
     
    修改完成后,配置nginx 的虚拟主机,修改完成后拷贝php安装文件到虚拟主机的目录
     
    cp -r /root/zabbix-3.2.5/frontends/php/* /data/zabbix/
    然后在网页上进行安装
    安装可能会出现的问题 always-populate-raw-post-data = -1
    vim /目录/zabbix/include/classes/setup/CFrontendSetup.php
    找到下面代码、关于always-populate-raw-post-data;

    添加 $current = -1;

    public function checkPhpAlwaysPopulateRawPostData() {
    $current = ini_get('always_populate_raw_post_data');
    $current = -1;
    return array(
    'name' => _('PHP always_populate_raw_post_data'),
    'current' => ($current != -1) ? _('on') : _('off'),
    'required' => _('off'),
    'result' => ($current != -1) ? self::CHECK_FATAL : self::CHECK_OK,
    'error' => _('PHP always_populate_raw_post_data must be set to -1.')
    );
    }
     
     
    客户端安装
    [root@dell1 ~]# tar zxvf zabbix-3.2.5.tar.gz
    [root@dell1 ~]# cd zabbix-3.2.5
    [root@dell1 ~]# ./configure --prefix=/usr/local/zabbix --enable-agent
    useradd -M -s /sbin/nlogin zabbix
     
    方法二 rpm直接安装
    rpm -ivh zabbix-agent-3.2.5-1.el6.x86_64.rpm
    vim /etc/zabbix/zabbix_agentd.conf
    修改客户端的配置文件,修改一下信息
    Server=125.88.37.28
    ServerActive=125.88.37.28
    Hostname=hadoop server2
    HostMetadata=linux
    UnsafeUserParameters=1
     
     
    /etc/init.d/zabbix-agent start
    #记得要关闭防火墙 以免不能启动报错。
     
     
    Zabbix 监控 Windows 的 CPU 百分比
  • 相关阅读:
    计算机视觉在生物力学和运动康复中的应用和研究
    摄影测量(计算机视觉)中的三角化方法
    用于机器人导航辅助的6自由度姿态估计的平面辅助视觉惯性里程计
    一文详解固态激光雷达的里程计(loam_livox)
    聊聊这两年学习slam啃过的书
    一种用于三维物体建模的精确、鲁棒的距离图像配准算法
    汇总|实时性语义分割算法(全)
    Crypto练习之CRC32应用
    Lower-SQL至系统沦陷
    Crypto练习之替换密码
  • 原文地址:https://www.cnblogs.com/zyos/p/7233942.html
Copyright © 2020-2023  润新知