系统:centos6.8
Zabbix-server(服务端):192.168.137.36
Zabbix-agent(客户端):192.168.137.35
以下是zabbix-server服务端安装操作
@H_301_31@
@H_301_31@yum install lrzsz -y
@H_301_31@
@H_301_31@rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
@H_301_31@yum clean all
@H_301_31@yum repolist
@H_301_31@yum install -y Nginx
@H_301_31@
@H_301_31@
@H_301_31@wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
@H_301_31@rpm -Uvh MysqL57-community-release-el6-9.noarch.rpm
@H_301_31@yum install MysqL-community-server
@H_301_31@service MysqLd start
@H_301_31@grep 'temporary password' /var/log/MysqLd.log
@H_301_31@set global validate_password_policy=0;
@H_301_31@set global validate_password_length=6;
@H_301_31@ALTER USER 'root'@'localhost' IDENTIFIED BY 'abc123';
@H_301_31@
@H_301_31@
@H_301_31@
@H_301_31@
@H_301_31@wget http://cn2.php.net/distributions/php-5.6.0.tar.xz
@H_301_31@xz -d PHP-5.6.0.tar.xz
@H_301_31@tar xf PHP-5.6.0.tar -C /usr/local/src/
@H_301_31@
安装依赖
@H_301_31@yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel
@H_301_31@
@H_301_31@groupadd www
@H_301_31@useradd -g www -s /sbin/nologin -M www
编译安装
@H_301_31@cd /usr/local/src/PHP-5.6.0/
@H_301_31@
@H_301_31@./configure \
@H_301_31@--prefix=/usr/local/PHP56 \
@H_301_31@--with-config-file-path=/usr/local/PHP56/etc \
@H_301_31@--enable-inline-optimization \
@H_301_31@--disable-debug \
@H_301_31@--disable-rpath \
@H_301_31@--enable-shared \
@H_301_31@--enable-opcache \
@H_301_31@--enable-fpm \
@H_301_31@--with-fpm-user=www \
@H_301_31@--with-fpm-group=www \
@H_301_31@--with-MysqL=MysqLnd \
@H_301_31@--with-MysqLi=MysqLnd \
@H_301_31@--with-pdo-MysqL=MysqLnd \
@H_301_31@--with-gettext \
@H_301_31@--enable-mbstring \
@H_301_31@--with-iconv \
@H_301_31@--with-mcrypt \
@H_301_31@--with-mhash \
@H_301_31@--with-openssl \
@H_301_31@--enable-bcmath \
@H_301_31@--enable-soap \
@H_301_31@--with-libxml-dir \
@H_301_31@--enable-pcntl \
@H_301_31@--enable-shmop \
@H_301_31@--enable-sysvmsg \
@H_301_31@--enable-sysvsem \
@H_301_31@--enable-sysvshm \
@H_301_31@--enable-sockets \
@H_301_31@--with-curl \
@H_301_31@--with-zlib \
@H_301_31@--enable-zip \
@H_301_31@--with-bz2 \
@H_301_31@--with-readline
@H_301_31@
@H_301_31@# make -j8
@H_301_31@# make install
@H_301_31@
配置文件:
@H_301_31@cp PHP.ini-development /usr/local/PHP56/etc/PHP.ini
@H_301_31@
@H_301_31@cp /usr/local/PHP56/etc/PHP-fpm.conf.default /usr/local/PHP56/etc/PHP-fpm.conf
@H_301_31@cp sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm56
@H_301_31@chmod +x /etc/init.d/PHP-fpm56
@H_301_31@service PHP-fpm56 start
@H_301_31@PHP-fpm 可用参数@H_301_31@start|stop|force-quit|restart|reload|status
@H_301_31@
编辑@H_301_31@~/.bash_profile,将:
@H_301_31@
@H_301_31@PATH=$PATH:$HOME/bin
改为:
@H_301_31@PATH=$PATH:$HOME/bin:/usr/local/PHP56/bin
@H_301_31@
@H_301_31@. ~/.bash_profile
@H_301_31@
@H_301_31@
@H_301_31@
测试短语、
@H_301_31@vim /usr/share/Nginx/html/a.PHP@H_301_31@
@H_301_31@<?PHP
@H_301_31@?>
@H_301_31@
http://ip/a.php
@H_301_31@
@H_301_31@如出现以上界面@H_301_31@表示@H_301_31@lnmp环境搭建成功
@H_301_31@
@H_301_31@
如果访问网址的时候回报错 解决方法:
location ~ \.PHP$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_FILENAME /usr/share/Nginx/html$fastcgi_script_name;
include fastcgi_params;
}
@H_301_31@
@H_301_31@
@H_301_31@
@H_301_31@zabbix安装
下载@H_301_31@zabbix的安装包
@H_301_31@
@H_301_31@groupadd zabbix
@H_301_31@useradd -g zabbix zabbix -s /sbin/nologin
@H_301_31@
解压源码包
@H_301_31@tar zxvf zabbix-3.0.2.tar.gz -C /usr/src/
@H_301_31@
进入数据库
@H_301_31@
@H_301_31@CREATE DATABASE zabbix DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
@H_301_31@
创建@H_301_31@zabbix授权库账户@H_301_31@zabbix,密码是@H_301_31@123456
@H_301_31@grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
@H_301_31@
导入@H_301_31@zabbix数据表结构
@H_301_31@use zabbix;
@H_301_31@source /usr/src/zabbix-3.0.2/database/MysqL/schema.sql;
@H_301_31@source /usr/src/zabbix-3.0.2/database/MysqL/data.sql;
@H_301_31@source /usr/src/zabbix-3.0.2/database/MysqL/images.sql;
@H_301_31@
安装组件
@H_301_31@yum install -y net-snmp net-snmp-devel curl curl-devel
进入解压目录,编译安装
@H_301_31@cd /usr/src/zabbix-3.0.2/
@H_301_31@./configure --prefix=/usr/local/zabbix --with-MysqL --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy
@H_301_31@
@H_301_31@
会报错:
@H_301_31@configure: error: MysqL library not found
@H_301_31@the problem is not installed MysqL-devel
解决方法:@H_301_31@yum install MysqL-devel
@H_301_31@
@H_301_31@make && make install
@H_301_31@
创建日志目录
@H_301_31@mkdir /usr/local/zabbix/logs
@H_301_31@cd /usr/local/zabbix/etc/
@H_301_31@mv zabbix_agentd.conf zabbix_agentd.conf.bak
@H_301_31@vim zabbix_agentd.conf
@H_301_31@LogFile=/usr/local/zabbix/logs/zabbix_agentd.log
@H_301_31@Server=127.0.0.1
@H_301_31@#ServerActive=127.0.0.1
@H_301_31@Hostname=Zabbix server
@H_301_31@
@H_301_31@mv zabbix_server.conf zabbix_server.conf.bak
@H_301_31@vim zabbix_server.conf
@H_301_31@LogFile=/usr/local/zabbix/logs/zabbix_server.log
@H_301_31@DBName=zabbix
@H_301_31@DBUser=zabbix
@H_301_31@DBHost=localhost
@H_301_31@DBPassword=123456
@H_301_31@AlertScriptsPath=/usr/local/zabbix/alertscripts
@H_301_31@
创建自定义脚本目录,设置权限,目录下的脚步,可以被@H_301_31@zabbix调用
@H_301_31@mkdir /usr/local/zabbix/alertscripts
@H_301_31@chown zabbix:zabbix -R /usr/local/zabbix
@H_301_31@
@H_301_31@sed -i 's/post_max_size = 8M/post_max_size = 32M/g' /usr/local/PHP56/etc/PHP.ini
@H_301_31@sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/PHP56/etc/PHP.ini
@H_301_31@sed -i 's/;date.timezone =/date.timezone =PRC/' /usr/local/PHP56/etc/PHP.ini
@H_301_31@sed -i 's/max_execution_time = 30/max_execution_time = 600/g' /usr/local/PHP56/etc/PHP.ini
@H_301_31@sed -i 's/max_input_time = 60/max_input_time = 600/g' /usr/local/PHP56/etc/PHP.ini
@H_301_31@sed -i 's/memory_limit = 128M/memory_limit = 256M/g'@H_301_31@/usr/local/PHP56/etc/PHP.ini
@H_301_31@
@H_301_31@vim /usr/local/PHP56/etc/PHP.ini
@H_301_31@cgi.fix_pathinfo=0
改为
@H_301_31@cgi.fix_pathinfo=1
@H_301_31@
@H_301_31@service PHP-fpm56 @H_301_31@restart
进入源码目录,复制启动脚本@H_301_31@
@H_301_31@cd /usr/src/zabbix-3.0.2/misc/
@H_301_31@cp init.d/tru64/zabbix_server /etc/init.d/
@H_301_31@cp init.d/tru64/zabbix_agentd /etc/init.d/
@H_301_31@chmod +x /etc/init.d/zabbix_*
@H_301_31@
修改@H_301_31@zabbix_agentd、@H_301_31@zabbix_server程序目录的位置
@H_301_31@vim /etc/init.d/zabbix_agentd
@H_301_31@DAEMON=/usr/local/zabbix/sbin/zabbix_agentd
@H_301_31@
@H_301_31@vim /etc/init.d/zabbix_server
@H_301_31@DAEMON=/usr/local/zabbix/sbin/zabbix_server
@H_301_31@
@H_301_31@
由于@H_301_31@zabbix_server 服务不支持@H_301_31@chkconfig,使用下列方法自启动
@H_301_31@
@H_301_31@vim /etc/init.d/zabbix_server
@H_301_31@
@H_301_31@#chkconfig: 345 95 95
@H_301_31@#description: Zabbix_Server
@H_301_31@
@H_301_31@vim /etc/init.d/zabbix_agentd
@H_301_31@
@H_301_31@#chkconfig: 345 95 95
@H_301_31@#description: Zabbix_agentd
@H_301_31@
添加到系统服务
@H_301_31@chkconfig zabbix_server on
@H_301_31@chkconfig zabbix_agentd on
@H_301_31@
编辑系统库配置文件
@H_301_31@vim /etc/ld.so.conf
加入一行
@H_301_31@/usr/local/MysqL/lib/
@H_301_31@
重新加载
@H_301_31@ldconfig
启动服务
@H_301_31@/etc/init.d/zabbix_server start
@H_301_31@/etc/init.d/zabbix_agentd start
查看端口
@H_301_31@netstat -ntpl|grep zabbix
@H_301_31@tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 21188/zabbix_agentd
@H_301_31@tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 21140/zabbix_server
@H_301_31@
@H_301_31@
复制@H_301_31@PHP页面@H_301_31@,并设置权限
@H_301_31@cp -rf /usr/src/zabbix-3.0.2/frontends/PHP/ /usr/local/zabbix/PHP
@H_301_31@chown www:www -R /usr/local/zabbix/PHP/
@H_301_31@
@H_301_31@vim /etc/Nginx/conf.d/default.conf
@H_301_31@server {
@H_301_31@listen 80;
@H_301_31@server_name localhost;
@H_301_31@root /usr/local/zabbix/PHP;
@H_301_31@index index.PHP index.html index.htm;
@H_301_31@
@H_301_31@location / {
@H_301_31@if (!-e $request_filename) {
@H_301_31@rewrite ^(.*)$ /index.PHP/$1 last;
@H_301_31@break;
@H_301_31@}
@H_301_31@}
@H_301_31@
@H_301_31@fastcgi_pass 127.0.0.1:9000;
@H_301_31@fastcgi_index index.PHP;
@H_301_31@include fastcgi_params;
@H_301_31@set $real_script_name $fastcgi_script_name;
@H_301_31@if ($fastcgi_script_name ~ "^(.+?\.PHP)(/.+)$") {
@H_301_31@set $real_script_name $1;
@H_301_31@set $path_info $2;
@H_301_31@}
@H_301_31@
@H_301_31@fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
@H_301_31@fastcgi_param SCRIPT_NAME $real_script_name;
@H_301_31@fastcgi_param PATH_INFO $path_info;
@H_301_31@}
@H_301_31@
@H_301_31@}
@H_301_31@
@H_301_31@/etc/init.d/Nginx restart
vim /usr/local/zabbix/PHP/include/locales.inc.PHP
打开'zh_CN' => ['name' => _('Chinese (zh_CN)'),'display' =>true],
/etc/init.d/PHP-fpm56 restart
访问@H_301_31@http://ip/setup.php例如:http://192.168.137.36/setup.PHP
出现报错
解决方法:
@H_301_31@
PHP option “always_populate_raw_post_data”must be set to -1”
打开@H_301_31@/usr/local/PHP56/etc/PHP.ini文件把always_populate_raw_post_data = -1这一行注释打开,保存重启PHP-fpm56
@H_301_31@
1.Freetype
wget "http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2"
tar jxvf freetype-2.4.0.tar.bz2
cd freetype-2.4.0
./configure --prefix=/usr/local/freetype && make && make install
2. jpegsrc
wget http://www.ijg.org/files/jpegsrc.v9.tar.gz
tar zxvf jpegsrc.v9.tar.gz
cd jpeg-9
CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/jpeg && make && make install
3. libpng
tar zxvf libpng-1.6.31.tar
cd libpng-1.6.31
CFLAGS="-O3 -fPIC"./configure --prefix=/usr/local/libpng && make && make install
cd /usr/local/src/PHP-5.6.0/ext/gd/
运行/usr/local/PHP56/bin/PHPize 命令
./configure --with-PHP-config=/usr/local/PHP56/bin/PHP-config --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype
出现了异常error: png.h not found.
解决办法:
yum install libpng-devel,下面就是编译安装
./configure --with-PHP-config=/usr/local/PHP56/bin/PHP-config --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype
make && make install
接着修改PHP.ini文件在; default extension directory. 下面添加一行extension=gd.so
yum install PHP-gd
service Nginx restart
/etc/init.d/PHP-fpm56 restart
输入密码123456
@H_301_31@
ln -s /var/lib/MysqL/MysqL.sock /tmp/
vim /usr/local/PHP56/etc/PHP.ini
MysqLi.default_socket = /var/lib/MysqL/MysqL.sock
/etc/init.d/PHP-fpm56 restart
然后一直下一步 输入用户名Admin,密码zabbix
原文链接:https://www.f2er.com/centos/375662.html