本文共 18465 字,大约阅读时间需要 61 分钟。
[root@150 zabbix-2.2.6]# useradd zabbix[root@150 zabbix-2.2.6]# id zabbixuid=501(zabbix) gid=502(zabbix) groups=502(zabbix)如果同主机还需要运行agent, 建议再创建一个用户.
[root@150 soft_bak]# useradd zagent[root@150 soft_bak]# id zagentuid=502(zagent) gid=503(zagent) groups=503(zagent)
useradd postgrestar -jxvf postgresql-9.3.5.tar.bz2cd 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-safetygmake world && gmake install-worldln -s /opt/pgsql9.3.5 /opt/pgsqlvi /etc/profileexport PATH=/opt/pgsql/bin:$PATHexport MANPATH=/opt/pgsql/share/man:$MANPATHexport LD_LIBRARY_PATH=/opt/pgsql/lib:$LD_LIBRARY_PATHmkdir -p /data03/pgdata/pg_rootchown postgres:postgres /data03/pgdata/pg_rootsu - postgresvi .bash_profileexport PS1="$USER@`/bin/hostname -s`-> "export PGPORT=5432export PGDATA=/data03/pgdata/pg_rootexport LANG=en_US.utf8export PGHOME=/opt/pgsqlexport LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATHexport DATE=`date +"%Y%m%d%H%M"`export PATH=$PGHOME/bin:$PATH:.export MANPATH=$PGHOME/share/man:$MANPATHexport PGUSER=postgresexport PGHOST=$PGDATAalias rm='rm -i'alias ll='ls -lh'export PGDATABASE=postgresinitdb -D $PGDATA -E UTF8 --locale=C -U postgres -Wcd $PGDATAvi postgresql.conflisten_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 directoriesunix_socket_permissions = 0700 # begin with 0 to use octal notationtcp_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 128kBmaintenance_work_mem = 512MB # min 1MBshared_preload_libraries = 'pg_stat_statements' # (change requires restart)vacuum_cost_delay = 10 # 0-100 millisecondsvacuum_cost_limit = 10000 # 1-10000 creditsbgwriter_delay = 10ms # 10-10000ms between roundswal_level = hot_standby # minimal, archive, or hot_standbysynchronous_commit = off # synchronization level;wal_buffers = 16384kB # min 32kB, -1 sets based on shared_bufferswal_writer_delay = 10ms # 1-10000 millisecondscheckpoint_segments = 128 # in logfile segments, min 1, 16MB eacharchive_mode = on # allows archiving to be donearchive_command = '/bin/date' # command to use to archive a logfile segmentmax_wal_senders = 32 # max number of walsender processeswal_keep_segments = 256 # in logfile segments, 16MB each; 0 disableshot_standby = on # "on" allows queries during recoverymax_standby_archive_delay = 300s # max delay before canceling queriesmax_standby_streaming_delay = 300s # max delay before canceling querieswal_receiver_status_interval = 1s # send replies at least this oftenhot_standby_feedback = on # send info from standby to preventeffective_cache_size = 8192MBlog_destination = 'csvlog' # Valid values are combinations oflogging_collector = on # Enable capturing of stderr and csvloglog_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 thelog_rotation_age = 1d # Automatic rotation of logfiles willlog_rotation_size = 10MB # Automatic rotation of logfiles willlog_min_duration_statement = 1s # -1 is disabled, 0 logs all statementslog_checkpoints = onlog_connections = onlog_disconnections = onlog_error_verbosity = verbose # terse, default, or verbose messageslog_statement = 'ddl' # none, ddl, mod, alllog_timezone = 'PRC'log_autovacuum_min_duration = 0 # -1 disables, 0 logs all actions andautovacuum_vacuum_threshold = 50 # min number of row updates beforeautovacuum_analyze_threshold = 50 # min number of row updates beforeautovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuumautovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyzeautovacuum_vacuum_cost_delay = 10ms # default vacuum cost delay fordatestyle = 'iso, mdy'timezone = 'PRC'lc_messages = 'C' # locale for system error messagelc_monetary = 'C' # locale for monetary formattinglc_numeric = 'C' # locale for number formattinglc_time = 'C' # locale for time formattingdefault_text_search_config = 'pg_catalog.english'pg_stat_statements.max=1000pg_stat_statements.track=allpg_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
checking for SSH2 support... noconfigure: error: SSH2 library not found解决
[root@150 zabbix-2.2.6]# yum install -y libssh2-devel例如
checking for OPENIPMI support... noconfigure: 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]# lltotal 20drwxr-xr-x 2 root root 4096 Aug 31 12:10 bindrwxr-xr-x 6 root root 4096 Aug 31 12:10 etcdrwxr-xr-x 2 root root 4096 Aug 31 12:10 libdrwxr-xr-x 3 root root 4096 Aug 31 12:10 sbindrwxr-xr-x 4 root root 4096 Aug 31 12:10 share配置/etc/profile
vi /etc/profileexport PATH=/opt/zabbix/bin:/opt/zabbix/sbin:$PATHexport MANPATH=/opt/zabbix/share/man:$MANPATHexport 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/profileexport PATH=/opt/php5.5.14/bin:/opt/php5.5.14/sbin:$PATHexport MANPATH=/opt/php5.5.14/php/man:$MANPATH[root@150 ~]# php --iniConfiguration File (php.ini) Path: /opt/php5.5.14/libLoaded 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 9000tcp 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]# lltotal 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.conf5. 配置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.inipost_max_size = 16Mdate.timezone = Asia/Shanghaimax_execution_time = 300max_input_time = 300[root@150 etc]# ps -ewf|grep phproot 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 wwwnobody 14102 14100 0 09:25 ? 00:00:00 php-fpm: pool wwwroot 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/etc6. 创建数据库
[root@150 etc]# su - postgrespostgres@150-> psqlpsql (9.3.5)Type "help" for help.postgres=# create role zabbix nosuperuser login encrypted password 'digoal';CREATE ROLEpostgres=# create database zabbix with template template0 encoding 'UTF8' ;CREATE DATABASEpostgres=# grant all on database zabbix to zabbix;GRANT7. 创建schema
shell> psql -Upsql> create database zabbix; psql> \q shell> cd database/postgresqlshell> psql -U zabbix < schema.sql# stop here if you are creating database for Zabbix proxy , 如果是代理的话, 只需要创建schema.shell> psql -U zabbix < images.sqlshell> psql -U zabbix < data.sql[root@150 postgresql]# pwd/opt/soft_bak/zabbix-2.2.6/database/postgresql[root@150 postgresql]# lltotal 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 - postgrespostgres@150-> cd /opt/soft_bak/zabbix-2.2.6/database/postgresql/postgres@150-> psql -h 127.0.0.1 -U zabbix zabbix -f ./schema.sqlpostgres@150-> psql -h 127.0.0.1 -U zabbix zabbix -f ./images.sqlpostgres@150-> psql -h 127.0.0.1 -U zabbix zabbix -f ./data.sql
[root@150 conf]# cat zabbix.conf.php
zabbix=> select * from users;-[ RECORD 1 ]--+---------------------------------userid | 1alias | Adminname | Zabbixsurname | Administratorpasswd | 5fce1b3e34b520afeffb37ce08c7cd66url | autologin | 1autologout | 0lang | en_GBrefresh | 30type | 3theme | defaultattempt_failed | 0attempt_ip | attempt_clock | 0rows_per_page | 50-[ RECORD 2 ]--+---------------------------------userid | 2alias | guestname | surname | passwd | d41d8cd98f00b204e9800998ecf8427eurl | autologin | 0autologout | 900lang | en_GBrefresh | 30type | 1theme | defaultattempt_failed | 0attempt_ip | attempt_clock | 0rows_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"; then for i in $PHP_JPEG_DIR /usr/local /usr; do test -f $i/include/jpeglib.h && GD_JPEG_DIR=$i && break done if test -z "$GD_JPEG_DIR"; then as_fn_error $? "jpeglib.h not found." "$LINENO" 5 fi.... if test "$PHP_FREETYPE_DIR" != "no"; then for i in $PHP_FREETYPE_DIR /usr/local /usr; do if test -f "$i/bin/freetype-config"; then FREETYPE2_DIR=$i FREETYPE2_CONFIG="$i/bin/freetype-config" break fi done if test -z "$FREETYPE2_DIR"; then as_fn_error $? "freetype-config not found." "$LINENO" 5 fi
转载地址:http://qhbxa.baihongyu.com/