Erlo

zabbix4.0搭建(基于CentOS6.8)

时间:2018-10-11 18:21   阅读:15次   来源:博客园页面报错

环境

服务端:188.188.3.241,系统:centos6.8,mysql:5.7.3,php:5.4.9,nginx:1.12.0

=================================================分割线==============================================

一、nginx编译安装

NGINX_VERSION=1.12.0

yum -y install pcre-devel openssl-devel

cd /usr/src

tar -zxf nginx-${NGINX_VERSION}.tar.gz

cd nginx-${NGINX_VERSION}

useradd -M -s /sbin/nologin nginx

./configure

--prefix=/usr/local/nginx

--user=nginx

--group=nginx

--with-http_ssl_module

--with-http_stub_status_module

--with-http_realip_module

--with-http_gzip_static_module

--with-pcre

make && make install

===============================================分割线==================================================

二、mysql编译安装

#mysql5.7.13下载地址

wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz

#安装mysql之前必须安装boost库,mysql5.7.13要求的boost版本是boost1.59.0或以上版本。

#下载地址

wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

tar -xzvf boost_1_59_0.tar.gz 

cd boost_1_59_0 

./bootstrap.sh --with-libraries=system,filesystem,log,thread --with-toolset=gcc 

./b2 toolset=gcc

./b2 install --prefix=/usr/local/boost

MYSQL_VERSION=5.7.13

yum -y install cmake ncurses-devel readline-devel bison libaio-devel openssl-devel gcc-c++

cd /usr/src

useradd -M -s /sbin/nologin mysql

tar -zxf mysql-${MYSQL_VERSION}.tar.gz

cd mysql-${MYSQL_VERSION}

#注意,6.8版本cmake不成功的话把LAMP(yum)里面的东西除了开头两个都卸载试试

cmake

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql

-DSYSCONFDIR=/etc

-DMYSQL_DATADIR=/usr/local/mysql/data

-DMYSQL_TCP_PORT=3306

-DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock

-DMYSQL_USER=mysql

-DEXTRA_CHARSETS=all

-DWITH_READLINE=1

-DWITH_SSL=system

-DWITH_EMBEDDED_SERVER=1

-DENABLED_LOCAL_INFILE=1

-DWITH_MYISAM_STORAGE_ENGINE=1

-DWITH_INNOBASE_STORAGE_ENGINE=1

-DWITH_MEMORY_STORAGE_ENGINE=1

-DWITH_ARCHIVE_STORAGE_ENGINE=1

-DWITH_PARTITION_STORAGE_ENGINE=1

-DDEFAULT_CHARSET=utf8

-DDOWNLOAD_BOOST=1

-DDEFAULT_COLLATION=utf8_general_ci

-DWITH_BOOST=/usr/local/boost

make && make install

make clean

rm CMakeCache.txt

chown -R mysql:mysql /usr/local/mysql

cd /usr/local/mysql/bin

#数据库初始化

./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 

#这条命令执行后会产生一个初始密码

#A temporary password is generated for root@localhost: SU,G6RPpfGhV (要记下来)

mv /etc/my.cnf /etc/my.cnf.old

cp support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

chkconfig mysqld on

service mysqld start

echo '/usr/local/mysql/lib/' >> /etc/ld.so.conf  #指定mysql库文件位置

ldconfig

echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile

source /etc/profile

#修改root密码

mysql -uroot -p

#密码为之前随机生成的初始密码,使用alter语句修改默认密码

mysql>alter user 'root'@'localhost' identified by 'root';

=================================================分割线================================================

三、php编译安装

cd /usr/src

tar -zxf mhash-0.9.9.9.tar.gz

cd mhash-0.9.9.9

./configure

make && make install

cd /usr/src

tar -zxf libiconv-1.13.tar.gz

cd libiconv-1.13

./configure

make && make install

cd /usr/src

tar -zxf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure

make && make install

ldconfig -v

cd libltdl/

./configure --with-gmetad --enable-gexec --enable-ltdl-install

make && make install

ln -sv /usr/local/lib/libmcrypt* /usr/lib

ln -sv /usr/local/lib/libmhash* /usr/lib

ln -sv /usr/local/lib/libiconv* /usr/lib

ldconfig -v

=================================================分割线================================================

PHP_VERSION=5.4.9

yum -y install libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel openldap-devel

cp -frp /usr/lib64/libldap* /usr/lib/

cd /usr/src

tar -zxf php-${PHP_VERSION}.tar.gz

cd php-${PHP_VERSION}

./configure

--prefix=/usr/local/php

--with-config-file-path=/usr/local/php/etc

--with-mysql=/usr/local/mysql

--with-mysqli=/usr/local/mysql/bin/mysql_config

--with-pdo-mysql=/usr/local/mysql

--with-iconv

--with-freetype-dir

--with-jpeg-dir

--with-png-dir

--with-zlib

--with-libxml-dir=/usr/local

--enable-xml

--enable-dom

--disable-rpath

--enable-bcmath

--enable-shmop

--enable-sysvsem

--enable-inline-optimization

--with-gettext

--with-curl

--enable-mbregex

--enable-fpm

--enable-mbstring

--with-mcrypt

--with-gd

--enable-gd-native-ttf

--with-openssl

--with-mhash

--enable-pcntl

--enable-sockets

--with-ldap

--with-ldap-sasl

--with-xmlrpc

--enable-zip

--enable-soap

make ZEND_EXTRA_LIBS='-liconv' && make install

cp php.ini-production /usr/local/php/etc/php.ini

echo 'export PATH=$PATH:/usr/local/php/bin' >> /etc/profile

source /etc/profile

==================================================分割线===============================================

四、zabbix编译安装

groupadd zabbix

useradd -g zabbix -m -s /sbin/nologin zabbix

cd /usr/src

tar -zxf zabbix-4.0.0.tar.gz

cd zabbix-4.0.0

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

--sysconfdir=/etc/zabbix/

--enable-server

--enable-agent

--with-net-snmp

--with-libcurl 

--with-mysql=/usr/local/mysql/bin/mysql_config 

--with-libxml2

 --enable-bcmath --with-gd

make && make install

#导入zabbix数据库

cd  /usr/src/zabbix-4.0.0/database/mysql

mysql -uzabbix -pzabbix zabbix < schema.sql

mysql -uzabbix -pzabbix zabbix < images.sql

mysql -uzabbix -pzabbix zabbix < data.sql

#配置zabbix_server

#vim /etc/zabbix/zabbix_server.conf

DBHost=188.188.3.241

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

ListenIP=188.188.3.241

StartIPMIPollers=10

StartPollersUnreachable=10

StartTrappers=10

StartPingers=10

StartDiscoverers=10

CacheSize=256M

StartDBSyncers=40

HistoryCacheSize=128M

TrendCacheSize=128M

ValueCacheSize=128M

Timeout=30

AlertScriptsPath=/etc/zabbix/alertscripts      

ExternalScripts=/etc/zabbix/externalscripts    

LogSlowQueries=10000

StartProxyPollers=50

LogFile=/tmp/zabbix_server.log

#创建zabbix所需要的脚本目录

mkdir /etc/zabbix/alertscripts 

mkdir /etc/zabbix/externalscripts

ln -s /usr/local/zabbix/sbin#zs#    /usr/sbin/

cp /usr/src/zabbix-4.0.0/misc/init.d/fedora/core/zabbix_*    /etc/init.d/   #复制服务启动脚本

chmod +x /etc/init.d/zabbix_*

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

#配置web

#cd /usr/local/nginx/conf/vhost

#vim zabbix.conf

server {

        listen       80;

        server_name zabbix.com;

        access_log  /data/logs/nginx/zabbix/access.log  main;

 error_log  /data/logs/nginx/zabbix/error.log;

        index index.html index.php index.html;

        root /data/web/zabbix;

 

        location /

        {

                try_files $uri $uri/ /index.php?$args;

        }

 

        location ~ ^(.+.php)(.*)$ {

                fastcgi_split_path_info ^(.+.php)(.*)$;

                include fastcgi.conf;

                fastcgi_pass  127.0.0.1:9000;

                fastcgi_index index.php;

                fastcgi_param  PATH< 来源:https://www.erlo.vip/share/2/20616.html

下一篇:CentOS6.8 安装python2.7,pip以及y...

评论留言

还没有评论留言,赶紧来抢楼吧~~

Erlo大厅()

* 这里是“Erlo大厅”,在这发言所有人都可以看到。只保留当天信息

  • Erlo.vip2018-10-23 10:15:40Hello、欢迎使用Erlo大厅,这里是个吐槽的地方。
  • 首页 源码分享 新闻资讯 ERLO 搜索
    鼠标试试
    返回顶部