温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

zabbix 3.2 编译安装

发布时间:2020-07-11 17:14:07 来源:网络 阅读:334 作者:Mr_chen 栏目:MySQL数据库

安装平台 centos 6.8 2.6.32-642.el6.x86_64

关闭防火墙和selinux

软件版本 apr-1.5.2 apr-util-1.5.4 pcre-8.39 httpd-2.4.23 php-7.0.11 percona-5.6.26 zabbix-3.2.1

安装依赖关系 yum install -y gcc libtool libtool-ltdl libtool-ltdl-devel  lynx  gcc-c++  make zlib zlib-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers recode-devel php-mbstring php-bcmath lib curl-devel  php-mysql  tree autoconf  httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml  php-ldap  php-xmlrpc  mysql-connector-odbc  libdbi-dbd-mysql net-snmp net-snmp-devel

LAMP环境编译安装

mysql 

安装平台:centos 6.8 2.6.32-642.el6.x86_64

Percina版本: Percona-Server-5.6.26-74.0-r32f8dfd-el6-x86_64-bundle.tar 

获取地址:https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.33-79.0/binary/redhat/6/x86_64/Percona-Server-5.6.33-79.0-r2084bdb-el6-x86_64-bundle.tar

 

安装 epel-release-6-8.noarch.rpm    libaio-0.3.107-10.el6.x86_64.rpm

安装依赖关系 yum  install -y gcc gcc-c++  make cmake automake  autoconf libxml2 libxml2-devel zlib zlib-devel ncurses ncurses-devel 

然后yum jemalloc           //tokuDB内存分配需要jemalloc支持

Percona-Server-5.6.26-74.0-r32f8dfd-el6-x86_64-bundle.tar 解压后的安装顺序是:

     tar xvf Percona-Server-5.6.26-74.0-r32f8dfd-el6-x86_64-bundle.tar

     rpm -ivh Percona-Server-shared-56-5.6.26-rel74.0.el6.x86_64.rpm

     rpm -ivh Percona-Server-devel-56-5.6.26-rel74.0.el6.x86_64.rpm

     rpm -ivh Percona-Server-client-56-5.6.26-rel74.0.el6.x86_64.rpm

     rpm -ivh Percona-Server-server-56-5.6.26-rel74.0.el6.x86_64.rpm

     rpm -ivh Percona-Server-tokudb-56-5.6.26-rel74.0.el6.x86_64.rpm


修改系统参数

echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag

 echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled

 echo never > /sys/kernel/mm/transparent_hugepage/enabled

 echo never > /sys/kernel/mm/transparent_hugepage/defrag

建议写到 /etc/rc.local 中,重启后也可生效

启动服务:/etc/init.d/mysql start

修改mysql配置文件 vim /etc/my.cnf

添加 default-storage-engine=TokuDB

重启服务:/etc/init.d/mysql restart

输入:ps_tokudb_admin --enable -uroot -p      密码默认没有设置为空

进入mysql,验证:

zabbix 3.2 编译安装



apache

httpd依赖于apr, apr-util pcre-devel apr全称为apache portable runtime,能实现httpd跨平台运行 httpd-2.4 依賴于1.4+及以上版本的apr。

apache MPM event is not supported on this platform. 是因为apr和apr-util的版本较低,需要升级到1.5.0以上,所以重新选择apr-1.5.2和apr-util-1.5.4的tar包进行再编译。

pcre(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库

tar xf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure && make && make install

vim /etc/ld.so.conf.d/local.conf     # 编辑库文件

/usr/local/lib                       # 添加该行

:wq                                  # 保存退出

ldconfig -v

tar xf apr-1.5.2.tar.gz

cd apr-1.5.2

./configure --prefix=/usr/local/apr

make && make install

//当出现rm: cannot remove `libtoolT': No such file or directory错误时修改configure文件,RM='$RM' ==> RM='$RM -f'在29605行左右。

 

tar xf apr-util-1.5.4.tar.gz

cd apr-util-1.5.4

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

make && make install

tar xf pcre-8.39.tar.gz

cd pcre-8.39

./configure --prefix=/usr/local/pcre

make && make install

tar xf httpd-2.4.23.tar.gz

cd httpd-2.4.23

./configure  --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util  --with-pcre=/usr/local/pcre   --enable-nonportable-atomics=yes --with-crypto --enable-mods-shared=few --enable-so --enable-macro --enable-data --enable-http  --with-libxml2 --enable-request --enable-include --enable-deflate --enable-logio --enable-expires --enable-usertrack --enable-ssl --enable-info --enable-cgid --enable-rewrite --enable-negotiation --enable-sed --enable-vhost-alias --enable-ratelimit --enable-allowmethods --enable-authn-db --enable-dbd --enable-charset-lite  --enable-cache --enable-cache-disk --enable-cache-socache --enable-authnz-ldap --enable-ldap --enable-dav --enable-dav-fs --enable-dav-lock --with-ldap --enable-authnz-ldap  --with-included-apr --enable-deflate

make && make install


cd /usr/local/apache/bin

ln -s /usr/local/apache/bin/apachectl /etc/init.d/httpd

vim /usr/local/apache/conf/httpd/conf

 servername 127.0.0.1:80

/etc/init.d/httpd start

httpd -l

zabbix 3.2 编译安装

//提示错误:Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.时,将apr 和apr-util的解压目录cp 到 ./srclib/ 目录下, 再进行编译。

cp -rf /root/apr-1.5.2  ./httpd-2.4.23/srclib/apr

cp -rf /root/apr-util-1.5.4  ./httpd-2.4.23/srclib/apr-util

php

tar xf php-7.0.11.tar.gz

cd php-7.0.11

./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/lib/libconv --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath --enable-zip --enable-pcntl --enable-exif --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-opcache --enable-session --enable-mbregex --with-fpm-user=vagrant  --with-fpm-group=nogroup --enable-wddx --with-mcrypt --enable-gd-native-ttf --enable-gd-jis-conv --with-openssl --with-zlib=/usr --with-recode=/usr --with-xmlrpc --enable-inline-optimization --disable-debug --disable-rpath  --with-apxs2=/usr/local/apache/bin/apxs

make

make test

make install

vim /usr/local/apache/conf/httpd.conf

找到

<IfModule dir_module>

    DirectoryIndex  index.html

</IfModule>

修改成

<IfModule dir_module>

    DirectoryIndex index.php index.html

</IfModule>

 

找到

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

在后面加一行

AddType application/x-httpd-php .php

 

[root@localhost bin]# /usr/local/apache/bin/apachectl -t   

Syntax OK

测试ok,在pkill httpd

最后重启apache.

[root@localhost bin]# /usr/local/apache/bin/apachectl start

[root@localhost htdocs]#mv index.html  index.php

[root@localhost htdocs]# cat index.php      #修改成如下内容

<?php

phpinfo();

?>

至此,LAMP环境编译安装完成。

zabbix

groupadd -g 201 zabbix

useradd -g zabbix -u 201 -s /sbin/nologin zabbix

tar zxvf zabbix-3.2.1.tar.gz

 cd zabbix-3.2.1

   ./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl

   make && make install

mysql -e "create database zabbix default charset utf8;"

mysql -e "grant all on zabbix.* to zabbix@localhost identified by 'zabbix';"

mysql -uzabbix -pzabbix zabbix<./database/mysql/schema.sql

mysql -uzabbix -pzabbix zabbix<./database/mysql/p_w_picpaths.sql

mysql -uzabbix -pzabbix zabbix<./database/mysql/data.sql

mkdir /var/log/zabbix

chown -R zabbix.zabbix /var/log/zabbix

ln -s /usr/local/zabbix/etc/ /etc/zabbix

ln -s /usr/local/zabbix/bin/* /usr/bin/

ln -s /usr/local/zabbix/sbin/* /usr/sbin/

cp /root/zabbix-3.2.1/misc/init.d/fedora/core/zabbix_* /etc/init.d

 chmod 755 /etc/init.d/zabbix_*

sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_server

sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_agentd

sed -i "s@DBUser=root@DBUser=zabbix@g" /etc/zabbix/zabbix_server.conf

sed -i "s@#DBPassword=@DBPassword=zabbix@g" /etc/zabbix/zabbix_server.conf

sed -i "s@# DBPassword=@DBPassword=zabbix@g" /etc/zabbix/zabbix_server.conf

 sed -i "s@Server=127.0.0.1@Server=127.0.0.1,192.168.10.119@g" /etc/zabbix/zabbix_agentd.conf

sed -i "s@ServerActive=127.0.0.1@ServerActive=$IP:10051@g" /etc/zabbix/zabbix_agentd.conf

sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_agentd

sed -i "s@tmp/zabbix_agentd.log@var/log/zabbix/zabbix_agentd.log@g" /etc/zabbix/zabbix_agentd.conf

sed -i "s@^# UnsafeUserParameters=0@UnsafeUserParameters=1\n@g" /etc/zabbix/zabbix_agentd.conf

cp -r /root/zabbix-3.2.1/frontends/php/ /usr/local/apache/htdocs/zabbix/

chown -R apache.apache /usr/local/apache/htdocs/zabbix/

chkconfig zabbix_server on

chkconfig zabbix_agentd on

service zabbix_server start

service zabbix_agentd start


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI