Install zabbix 2.2 + PostgreSQL + nginx + php on CentOS 6.x x64
[root@150 zabbix-2.2.6]# useradd zabbix
[root@150 zabbix-2.2.6]# id zabbix
uid=501(zabbix) gid=502(zabbix) groups=502(zabbix)
如果同主机还需要运行agent, 建议再创建一个用户.
[root@150 soft_bak]# useradd zagent
[root@150 soft_bak]# id zagent
uid=502(zagent) gid=503(zagent) groups=503(zagent)
useradd postgres
tar -jxvf postgresql-9.3.5.tar.bz2
cd postgresql-9.3.5
./configure --prefix=/opt/pgsql9.3.5 --with-pgport=5432 --with-perl --with-tcl --with-python --with-openssl --with-pam --with-ldap --with-libxml --with-libxslt --enable-thread-safety
gmake world && gmake install-world
ln -s /opt/pgsql9.3.5 /opt/pgsql
vi /etc/profile
export PATH=/opt/pgsql/bin:$PATH
export MANPATH=/opt/pgsql/share/man:$MANPATH
export LD_LIBRARY_PATH=/opt/pgsql/lib:$LD_LIBRARY_PATH
mkdir -p /data03/pgdata/pg_root
chown postgres:postgres /data03/pgdata/pg_root
su - postgres
vi .bash_profile
export PS1="$USER@`/bin/hostname -s`-> "
export PGPORT=5432
export PGDATA=/data03/pgdata/pg_root
export LANG=en_US.utf8
export PGHOME=/opt/pgsql
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export DATE=`date +"%Y%m%d%H%M"`
export PATH=$PGHOME/bin:$PATH:.
export MANPATH=$PGHOME/share/man:$MANPATH
export PGUSER=postgres
export PGHOST=$PGDATA
alias rm='rm -i'
alias ll='ls -lh'
export PGDATABASE=postgresinitdb -D $PGDATA -E UTF8 --locale=C -U postgres -W
cd $PGDATA
vi postgresql.conf
listen_addresses = '0.0.0.0' # what IP address(es) to listen on;
port = 5432 # (change requires restart)
max_connections = 500 # (change requires restart)
superuser_reserved_connections = 13 # (change requires restart)
unix_socket_directories = '.' # comma-separated list of directories
unix_socket_permissions = 0700 # begin with 0 to use octal notation
tcp_keepalives_idle = 60 # TCP_KEEPIDLE, in seconds;
tcp_keepalives_interval = 10 # TCP_KEEPINTVL, in seconds;
tcp_keepalives_count = 10 # TCP_KEEPCNT;
shared_buffers = 2048MB # min 128kB
maintenance_work_mem = 512MB # min 1MB
shared_preload_libraries = 'pg_stat_statements' # (change requires restart)
vacuum_cost_delay = 10 # 0-100 milliseconds
vacuum_cost_limit = 10000 # 1-10000 credits
bgwriter_delay = 10ms # 10-10000ms between rounds
wal_level = hot_standby # minimal, archive, or hot_standby
synchronous_commit = off # synchronization level;
wal_buffers = 16384kB # min 32kB, -1 sets based on shared_buffers
wal_writer_delay = 10ms # 1-10000 milliseconds
checkpoint_segments = 128 # in logfile segments, min 1, 16MB each
archive_mode = on # allows archiving to be done
archive_command = '/bin/date' # command to use to archive a logfile segment
max_wal_senders = 32 # max number of walsender processes
wal_keep_segments = 256 # in logfile segments, 16MB each; 0 disables
hot_standby = on # "on" allows queries during recovery
max_standby_archive_delay = 300s # max delay before canceling queries
max_standby_streaming_delay = 300s # max delay before canceling queries
wal_receiver_status_interval = 1s # send replies at least this often
hot_standby_feedback = on # send info from standby to prevent
effective_cache_size = 8192MB
log_destination = 'csvlog' # Valid values are combinations of
logging_collector = on # Enable capturing of stderr and csvlog
log_directory = 'pg_log' # directory where log files are written,
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
log_file_mode = 0600 # creation mode for log files,
log_truncate_on_rotation = on # If on, an existing log file with the
log_rotation_age = 1d # Automatic rotation of logfiles will
log_rotation_size = 10MB # Automatic rotation of logfiles will
log_min_duration_statement = 1s # -1 is disabled, 0 logs all statements
log_checkpoints = on
log_connections = on
log_disconnections = on
log_error_verbosity = verbose # terse, default, or verbose messages
log_statement = 'ddl' # none, ddl, mod, all
log_timezone = 'PRC'
log_autovacuum_min_duration = 0 # -1 disables, 0 logs all actions and
autovacuum_vacuum_threshold = 50 # min number of row updates before
autovacuum_analyze_threshold = 50 # min number of row updates before
autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
autovacuum_vacuum_cost_delay = 10ms # default vacuum cost delay for
datestyle = 'iso, mdy'
timezone = 'PRC'
lc_messages = 'C' # locale for system error message
lc_monetary = 'C' # locale for monetary formatting
lc_numeric = 'C' # locale for number formatting
lc_time = 'C' # locale for time formatting
default_text_search_config = 'pg_catalog.english'
pg_stat_statements.max=1000
pg_stat_statements.track=all
pg_stat_statements.save=on
[root@150 zabbix-2.2.6]# ./configure --help
选择要安装的组件, (例如server, proxy, agent全部安装)编译安装 :
[root@150 zabbix-2.2.6]# ./configure --prefix=/opt/zabbix2.2.6 --enable-server --enable-proxy --enable-agent --enable-java --enable-ipv6 --with-postgresql=/opt/pgsql/bin/pg_config --with-net-snmp --with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv
cnofigure时, 可能会因为缺少lib库报错,
checking for SSH2 support... no
configure: error: SSH2 library not found
解决
[root@150 zabbix-2.2.6]# yum install -y libssh2-devel
例如
checking for OPENIPMI support... no
configure: error: Invalid OPENIPMI directory - unable to find ipmiif.h
解决
[root@150 zabbix-2.2.6]# yum install -y OpenIPMI-devel# make && make install
[root@150 zabbix-2.2.6]# ln -s /opt/zabbix2.2.6 /opt/zabbix
[root@150 zabbix-2.2.6]# cd /opt/zabbix
[root@150 zabbix]# ll
total 20
drwxr-xr-x 2 root root 4096 Aug 31 12:10 bin
drwxr-xr-x 6 root root 4096 Aug 31 12:10 etc
drwxr-xr-x 2 root root 4096 Aug 31 12:10 lib
drwxr-xr-x 3 root root 4096 Aug 31 12:10 sbin
drwxr-xr-x 4 root root 4096 Aug 31 12:10 share
配置/etc/profile
vi /etc/profile
export PATH=/opt/zabbix/bin:/opt/zabbix/sbin:$PATH
export MANPATH=/opt/zabbix/share/man:$MANPATH
export LD_LIBRARY_PATH=/opt/zabbix/lib:$LD_LIBRARY_PATH
[root@150 zabbix]# ll bin/
total 560
-rwxr-xr-x 1 root root 256830 Aug 31 12:10 zabbix_get
-rwxr-xr-x 1 root root 314325 Aug 31 12:10 zabbix_sender
# vi /etc/profile
export PATH=/opt/php5.5.14/bin:/opt/php5.5.14/sbin:$PATH
export MANPATH=/opt/php5.5.14/php/man:$MANPATH[root@150 ~]# php --ini
Configuration File (php.ini) Path: /opt/php5.5.14/lib
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)# . /etc/profile注意拷贝到对应的配置目录
# cp php-5.5.14/php.ini-production /opt/php5.5.14/lib/php.ini
# cp /opt/php5.5.14/etc/php-fpm.conf.default /opt/php5.5.14/etc/php-fpm.conf[root@150 zabbix]# which php-fpm
/opt/php5.5.14/sbin/php-fpm
[root@150 zabbix]# php-fpm -R -c /opt/php5.5.14/etc
[root@150 zabbix]# netstat -anp|grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 26627/php-fpm
配置并启动nginx
[root@150 conf]# pwd
/opt/nginx1.6.0/conf
[root@150 conf]# ll
total 60
-rw-r--r-- 1 root root 1034 Aug 31 15:08 fastcgi.conf
-rw-r--r-- 1 root root 1034 Aug 31 15:08 fastcgi.conf.default
-rw-r--r-- 1 root root 964 Aug 31 15:08 fastcgi_params
-rw-r--r-- 1 root root 964 Aug 31 15:08 fastcgi_params.default
-rw-r--r-- 1 root root 2837 Aug 31 15:08 koi-utf
-rw-r--r-- 1 root root 2223 Aug 31 15:08 koi-win
-rw-r--r-- 1 root root 3957 Aug 31 15:08 mime.types
-rw-r--r-- 1 root root 3957 Aug 31 15:08 mime.types.default
-rw-r--r-- 1 root root 2639 Aug 31 15:12 nginx.conf
-rw-r--r-- 1 root root 2656 Aug 31 15:08 nginx.conf.default
-rw-r--r-- 1 root root 596 Aug 31 15:08 scgi_params
-rw-r--r-- 1 root root 596 Aug 31 15:08 scgi_params.default
-rw-r--r-- 1 root root 623 Aug 31 15:08 uwsgi_params
-rw-r--r-- 1 root root 623 Aug 31 15:08 uwsgi_params.default
-rw-r--r-- 1 root root 3610 Aug 31 15:08 win-utf[root@150 conf]# pwd
/opt/nginx1.6.0/conf
[root@150 conf]# cat nginx.confuser nobody;
worker_processes 2;#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;#log_format main '$remote_addr - $remote_user [$time_local] "$request" '# '$status $body_bytes_sent "$http_referer" '# '"$http_user_agent" "$http_x_forwarded_for"';#access_log logs/access.log main;sendfile on;#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;server {listen 8080;server_name digoal;root /opt/www/zabbix;#charset koi8-r;#access_log logs/host.access.log main;location / {index index.html index.htm index.php;}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~ \.php$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {# deny all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {# listen 8000;# listen somename:8080;# server_name somename alias another.alias;# location / {# root html;# index index.html index.htm;# }#}# HTTPS server##server {# listen 443 ssl;# server_name localhost;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_cache shared:SSL:1m;# ssl_session_timeout 5m;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}}
启动
[root@150 conf]# /opt/nginx1.6.0/sbin/nginx -c /opt/nginx1.6.0/conf/nginx.conf
5. 配置WEB
[root@150 php]# pwd
/opt/soft_bak/zabbix-2.2.6/frontends/php
将php目录中的所有文件拷贝到/opt/www/zabbix
[root@150 frontends]# mkdir -p /opt/www/zabbix
[root@150 php]# cp -a . /opt/www/zabbix/
# vi /opt/php5.5.14/lib/php.ini
post_max_size = 16M
date.timezone = Asia/Shanghai
max_execution_time = 300
max_input_time = 300
[root@150 etc]# ps -ewf|grep php
root 14100 1 0 09:25 ? 00:00:00 php-fpm: master process (/opt/php5.5.14/etc/php-fpm.conf)
nobody 14101 14100 0 09:25 ? 00:00:00 php-fpm: pool www
nobody 14102 14100 0 09:25 ? 00:00:00 php-fpm: pool www
root 14604 504 0 09:32 pts/0 00:00:00 grep php
[root@150 etc]# kill -9 14100
[root@150 etc]# kill -9 14101
[root@150 etc]# kill -9 14102
[root@150 etc]# php-fpm -R
同时, 如果要使用新版本的lib, 需要重新编译.
# wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.bz2
# tar -jxvf freetype-2.5.3.tar.bz2
# cd freetype-2.5.3
# ./configure --prefix=/opt/freetype2.5.3
# make && make install# ./configure --prefix=/opt/php5.5.14 --with-pcre-regex=/usr/lib64 --enable-fpm --enable-opcache --with-pdo-pgsql=/opt/pgsql/bin --with-pgsql=/opt/pgsql/bin --enable-bcmath --enable-mbstring --enable-sockets --with-gd --with-gettext --with-libdir=lib64 --with-jpeg-dir --with-png-dir --with-freetype-dir=/opt/freetype2.5.3
# make && make install注意php 5.5.14的gd库是随php源码包绑定的, 所以就是2.1的版本.# 重启php-fpm
# php-fpm -R -c /usr/local/etc
6. 创建数据库
[root@150 etc]# su - postgres
postgres@150-> psql
psql (9.3.5)
Type "help" for help.postgres=# create role zabbix nosuperuser login encrypted password 'digoal';
CREATE ROLE
postgres=# create database zabbix with template template0 encoding 'UTF8' ;
CREATE DATABASE
postgres=# grant all on database zabbix to zabbix;
GRANT
7. 创建schema
shell> psql -U <username>
psql> create database zabbix;
psql> \q
shell> cd database/postgresql
shell> psql -U <username> zabbix < schema.sql
# stop here if you are creating database for Zabbix proxy , 如果是代理的话, 只需要创建schema.
shell> psql -U <username> zabbix < images.sql
shell> psql -U <username> zabbix < data.sql[root@150 postgresql]# pwd
/opt/soft_bak/zabbix-2.2.6/database/postgresql
[root@150 postgresql]# ll
total 2896
-rw-rw-r-- 1 1000 1000 873252 Aug 27 21:08 data.sql
-rw-rw-r-- 1 1000 1000 1979089 Aug 27 21:07 images.sql
-rw-rw-r-- 1 1000 1000 102928 Aug 27 21:08 schema.sql
[root@150 postgresql]# su - postgres
postgres@150-> cd /opt/soft_bak/zabbix-2.2.6/database/postgresql/
postgres@150-> psql -h 127.0.0.1 -U zabbix zabbix -f ./schema.sql
postgres@150-> psql -h 127.0.0.1 -U zabbix zabbix -f ./images.sql
postgres@150-> psql -h 127.0.0.1 -U zabbix zabbix -f ./data.sql
[root@150 conf]# cat zabbix.conf.php
<?php
// Zabbix GUI configuration file
global $DB;$DB['TYPE'] = 'POSTGRESQL';
$DB['SERVER'] = '127.0.0.1';
$DB['PORT'] = '5432';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'digoal';// SCHEMA is relevant only for IBM_DB2 database
$DB['SCHEMA'] = '';$ZBX_SERVER = '0.0.0.0';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'digoal';$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
?>
zabbix=> select * from users;
-[ RECORD 1 ]--+---------------------------------
userid | 1
alias | Admin
name | Zabbix
surname | Administrator
passwd | 5fce1b3e34b520afeffb37ce08c7cd66
url |
autologin | 1
autologout | 0
lang | en_GB
refresh | 30
type | 3
theme | default
attempt_failed | 0
attempt_ip |
attempt_clock | 0
rows_per_page | 50
-[ RECORD 2 ]--+---------------------------------
userid | 2
alias | guest
name |
surname |
passwd | d41d8cd98f00b204e9800998ecf8427e
url |
autologin | 0
autologout | 900
lang | en_GB
refresh | 30
type | 1
theme | default
attempt_failed | 0
attempt_ip |
attempt_clock | 0
rows_per_page | 50
[问题]
/*** Checks for PHP GD JPEG support.** @return array*/public function checkPhpGdJpeg() {if (is_callable('gd_info')) {$gdInfo = gd_info();// check for PHP prior 5.3.0, it returns 'JPG Support' key.$current = isset($gdInfo['JPG Support']) ? $gdInfo['JPG Support'] : $gdInfo['JPEG Support'];}else {$current = false;}return array('name' => _('PHP gd JPEG support'),'current' => $current ? _('on') : _('off'),'required' => null,'result' => $current ? self::CHECK_OK : self::CHECK_FATAL,'error' => _('PHP gd JPEG image support missing.'));}/*** Checks for PHP GD FreeType support.** @return array*/public function checkPhpGdFreeType() {if (is_callable('gd_info')) {$gdInfo = gd_info();$current = $gdInfo['FreeType Support'];}else {$current = false;}return array('name' => _('PHP gd FreeType support'),'current' => $current ? _('on') : _('off'),'required' => null,'result' => $current ? self::CHECK_OK : self::CHECK_FATAL,'error' => _('PHP gd FreeType support missing.'));}
if test "$PHP_JPEG_DIR" != "no"; thenfor i in $PHP_JPEG_DIR /usr/local /usr; dotest -f $i/include/jpeglib.h && GD_JPEG_DIR=$i && breakdoneif test -z "$GD_JPEG_DIR"; thenas_fn_error $? "jpeglib.h not found." "$LINENO" 5fi....if test "$PHP_FREETYPE_DIR" != "no"; thenfor i in $PHP_FREETYPE_DIR /usr/local /usr; doif test -f "$i/bin/freetype-config"; thenFREETYPE2_DIR=$iFREETYPE2_CONFIG="$i/bin/freetype-config"breakfidoneif test -z "$FREETYPE2_DIR"; thenas_fn_error $? "freetype-config not found." "$LINENO" 5fi
[参考]
Install zabbix 2.2 + PostgreSQL + nginx + php on CentOS 6.x x64相关推荐
- Install OpenStack Kilo Dashboard wiht Nginx + uWSGI On RHEL7.1
一.安装Horizon.Nginx.uWSGI yum install -y uwsgi-plugin-python openstack-dashboard uwsgi nginx 二.配置uWSGI ...
- postgresql linux rpm,postgresql 9.6 rpm包安装 CentOS 7.2 X64
postgresql 9.6 rpm包安装 CentOS 7.2 X64 发布时间:2020-07-07 03:55:55 来源:51CTO 阅读:4069 作者:pgmia 栏目:数据库 1.pgd ...
- 基于Flask+Nginx+uWSGI实现CentOS服务端模型部署及预加载
基于Flask+Nginx+uWSGI实现CentOS服务端模型部署及预加载http://www.manongjc.com/article/37802.html
- ubuntu 16.04 + zabbix 3.4 + postgresql libzbxpgsql
os: ubuntu 16.04 zabbix: 3.4 ip 规划 192.168.56.101 node1 pgsql 9.6 master 192.168.56.102 node2 pgsql ...
- ubuntu 16.04 + zabbix 3.4 + postgresql pg_monz
os: ubuntu 16.04 zabbix: 3.4 pg_monz: 2.1 ip 规划 192.168.56.101 node1 pgsql 9.6 master 192.168.56.102 ...
- zabbix安装配置(nginx php mysql zabbix)
环境信息: 系统:rhel6.2 一.Nginx安装: 下载:http://nginx.org/en/download.html [root@primary apps]# yum install pc ...
- 企业运维实战--Zabbix监控之结合nginx、mysql、java应用、proxy分布式、睿象云报警、API批量操作、替换mysql为tidb数据库
一.zabbix server的nginx监控 nginx部署 在server5上进行: tar zxf nginx-1.20.1.tar.gz cd nginx-1.20.1 yum install ...
- zabbix snmp自定义OID nginx监控实例(55)
为什么80%的码农都做不了架构师?>>> 为什么要自定义OID? 前面的文章我们已经讲过zabbix如何使用snmp监控服务器,但是他有一个很明显的局限性:只能监控定义好的OI ...
- linux监控nginx占用,使用zabbix 2.4 监控nginx
1.获取 Nginx 状态( HTTP Stub Status )/usr/local/nginx/sbin/nginx -V 2.配置 nginx.confvim /usr/local/nginx/ ...
最新文章
- 关于使用strtok的一个小问题
- TCP/IP网络的一些问题(路由/协议/linux的实现)
- 计算机网络:分组交换
- Android—逐帧、补间、属性动画
- jQery 操作CSS
- 离散数学期末复习知识总结
- php base64原理
- SpringBoot使用快递鸟进行电子面单的获取以及打印
- #1024程序员节# cc2530 按键唤醒功耗模式PM3例程
- 如鹏网.Net高级技术4.String特点及常用方法
- 知识图谱可视化工具选型
- python游戏数据分析
- 年度总结 | 目标检测2019,你还有不知道的吗?
- mac版 IGV(版本2.12.3)安装
- Excel:批量将某字符替换为“换行符”
- ECCV 2022 | 新方案: 先剪枝再蒸馏
- 乔治·霍兹(George Hotz):特斯拉、谷歌最可怕的对手!
- 如何避免自己发出的邮件被误判为垃圾邮件
- App测试之Monkey压力测试
- 004-Mat对象详解