• ADADADADAD

    zabbix 3.2 编译安装[ mysql数据库 ]

    mysql数据库 时间:2024-12-25 09:57:37

    作者:文/会员上传

    简介:

    安装平台 centos 6.82.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安装依

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    安装平台 centos 6.82.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-develphp-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.82.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.rpmlibaio-0.3.107-10.el6.x86_64.rpm

    安装依赖关系 yum install -y gccgcc-c++makecmakeautomakeautoconflibxml2libxml2-develzlibzlib-develncursesncurses-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,验证:



    apache

    httpd依赖于apr,apr-util pcre-devel apr全称为apacheportableruntime,能实现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

    //提示错误: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


    zabbix 3.2 编译安装.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载