Environment:
Operating system: CentOS 6.8 x86_64 (off SELinux, iptables)
nginx:1.10.1
php:7.0.10
mysql:5.7.13
zabbix:3.0.4
One. Install MySQL
1. Installation dependencies
Yum-y install gcc gcc-devel gcc-c++ gcc-c++-devel libaio-devel boost boost-devel autoconf* automake* zlib* libxml* ncurse S-devel ncurses libgcrypt* libtool* cmake OpenSSL openssl-devel Bison bison-devel Unzip Numactl-devel
2. Uninstall Mysql-libs, or you will get an error when installing MySQL below
RPM-E--nodeps Mysql-libs
3. Download Unzip and install
wget tar xf mysql-5.7.13-1.el6.x86_64.rpm-bundle.tarrpm-ivh ' ls |grep mysql-community|grep-v test '
4. Since MySQL 5.7 has a great improvement over the previous 5.6 security, there are many different places.
Reset Password First
#修改默认字符集sed-i '/\[mysqld\]/a\character-set-server=utf8 ' my.cnf# start mysqld and initialize/etc/init.d/mysqld start# stop mysqld, For no password start/etc/init.d/mysqld stop# no password start mysqlmysqld_safe--skip-grant-tables &mysql# Note the new version of MySQL 5.7 There are no password fields under the Mysql.user table mysql> update mysql.user set Authentication_string=password (' 123456.ABCD ') where User= ' root ' and Host = ' localhost '; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements# will be told that your password does not conform to the existing policies # Modify the corresponding password policy, but the password is also at least 9 bits my Sql> set Global validate_password_policy=0;mysql> update mysql.user set Authentication_string=password (' 123456. ABCD ') where user= ' root ' and Host = ' localhost '; service mysqld restart
Two. Compile and install PHP 7.0.10
1. Install the Epel source and install the corresponding dependency package
RPM-IVH http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpmyum-y Install Libmcrypt-devel MCrypt mhash gd-devel ncurses-devel libxml2-devel bzip2-devel libcurl-devel curl-devel libjpeg-devel libpng-devel Freetype-devel Net-snmp-devel Openssl-devel
2. Installing Libiconv
wget Http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gztar zxf libiconv-1.14.tar.gzcd libiconv-1.14./ Configure--prefix=/usr/local/libiconv1.14make && make INSTALLCD.
3. Download and compile PHP
wget http://cn2.php.net/get/php-7.0.10.tar.gz/from/this/mirrortar zxf mirrorcd php-7.0.10/ ./configure --prefix=/usr/local/php7.0.10 --with-config-file-path=/usr/local/php7.0.10/etc -- enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/ Libiconv1.14 --with-pcre-regex --with-zlib --with-bz2 --enable-calendar --with-curl --enable-dba --with-libxml-dir --enable-ftp --with-gd --with-jpeg-dir -- with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --with-mhash --enable-mbstring --with-mcrypt --enable-pcntl --enable-xml --disable-rpath -- Enable-shmop --enable-sockets --enable-zip --enable-bcmath --with-snmp --disable-ipv6 --with-gettext --enable-fpm --with-fpm-user=www --with-fpm-group=www -- with-openssl# Note there's no--enable-gd-jis-.Conv parameter, otherwise graphics garbled Make && make install
4. Modify the appropriate parameters
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpmchmod +x /etc/init.d/php-fpmcp php.ini-production /usr/local/php7.0.10/etc/php.ini# Modify time zone sed -i ' s#;d ate.timezone =# Date.timezone = prc#g ' /usr/local/php7.0.10/etc/php.ini# hide php version sed -i ' s#expose_php = on#expose_php = off#g ' /usr/local/php7.0.10/etc/php.inicp /usr/local/ php7.0.10/etc/php-fpm.d/www.conf.default /usr/local/php7.0.10/etc/php-fpm.d/www.confsed -i ' s#; Rlimit_files = 1024#rlimit_files = 65535#g ' /usr/local/php7.0.10/etc/php-fpm.d/ www.confsed -i ' S#;listen.owner = www#listen.owner = www#g ' /usr/local/ php7.0.10/etc/php-fpm.d/www.confsed -i ' s#;listen.group = www#listen.group = www #g ' /usr/local/php7.0.10/etc/php-fpm.d/www.confsed -i ' s#;listen.mode = 0660# Listen.mode = 0660#g '  /USR/LOCAL/PHP7.0.10/etc/php-fpm.d/www.confsed -i ' s#listen = 127.0.0.1:9000#;listen = 127.0.0.1:9000#g ' /usr/local/php7.0.10/etc/php-fpm.d/www.confsed -i '/;listen = 127.0.0.1:9000/a\listen = /tmp/php-fpm.sock ' /usr/local/php7.0.10/etc/php-fpm.d/www.conf# Security configuration, disabling related functions, note that cannot contain scandir and Fsockopen,zabbix need to use to these 2 functions sed -i ' s#^;cgi.fix_pathinfo=1#cgi.fix_pathinfo= 0#g ' /usr/local/php7.0.10/etc/php.inised -i ' s#disable_functions = #disable_functions =exec,system,eval,passthru,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_ Restore,dl,pfsockopen,fsocket,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server#g ' /usr/ local/php7.0.10/etc/php.ini# restrict the execution of directories, my web directories are under/var/www/html sed -i ' s#;open_basedir = #open_ basedir = "/var/www/html/:/tmp/" #g ' /usr/local/php7.0.10/etc/php.ini# modify PHP related parameters to ensure Zabbix minimum requirements sed -i ' S#max_execution_time = 30#max_execution_time = 300#g ' /usr/local/php7.0.10/etc/php.inised -i ' s #max_input_time = 60#max_input_time = 300#g ' /usr/local/php7.0.10/etc/php.inised -i ' S#post_max_size = 8m#post_max_size = 24m#g ' /usr/local/php7.0.10/etc/ php.inised -i ' S#upload_max_filesize = 2m#upload_max_filesize = 4m#g ' /usr/ local/php7.0.10/etc/php.ini# Modify PHP connection mysqlsed -i ' s#pdo_mysql.default_socket= #pdo_mysql. Default_socket = /var/lib/mysql/mysql.sock#g ' /usr/local/php7.0.10/etc/php.inised -i ' s#mysqli.default_ socket = #mysqli. Default_socket = /var/lib/mysql/mysql.sock#g ' /usr/local/php7.0.10/etc/ php.ini add php Execution User groupadd -g 10080 wwwuseradd -g www -u 10080 -s / Sbin/nologin -d /dev/null www
Three. Installing Nginx
1. Download and install Nginx
Wget tar zxf nginx-1.10.1.tar.gzcd nginx-1.10.1# hidden nginx version sed-i ' s#1.10.1#2.2.14.0#g ' src/core/nginx.hsed-i ' s# ' nginx/ "#" apache/"#g ' src/core/nginx.hsed-i ' s#" Server:nginx "#" Server:apache "#g ' Src/http/ngx_http_header_filter_ Module.csed-i ' s#<center>nginx</center>#<center>apache</center> #g ' src/http/ngx_http_ Special_response.c./configure--prefix=/usr/local/nginx1.10.1--user=www--group=www--with-http_stub_status_ Module--with-http_gzip_static_module--with-http_ssl_modulemake && make installsed-i ' s#nginx/$nginx _ Version: #Apache/$nginx _version; #g '/usr/local/nginx1.10.1/conf/fastcgi.conf
2. Configure Nginx
vim /usr/local/nginx1.10.1/conf/nginx.confuser www www;worker_processes 4; Error_log logs/error.log;pid logs/nginx.pid;worker_ Rlimit_nofile 65535;events { use epoll; worker_ connections 65535;} 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; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; fastcgi _connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_ Buffers_size 128k; fastcgi_temp_file_write_size 128k; fastcgi_param http_ proxy ""; #隐藏后端服务器的相关参数 proxy_hide_header x-powered-by; proxy_hide_ Header x-forwarded-for; proxy_hide_header x-aspnet-version; proxy_hide_header X-AspNetMvc-Version; proxy_hide_header Via; proxy_hide_header X-Varnish; proxy_hide_header server; gzip on; gzip_min_length 1k; Gzip_buffers 4 16k; gzip_http_version 1.1; gzip_ comp_level 5; gzip_disable "msie [1-6]\."; gzip_types text/plain text/css text/xml application/javascript application/x-javascript; gzip_vary on; include host/*.conf;}
3. Configure the site
mkdir /usr/local/nginx1.10.1/conf/hostvim /usr/local/nginx1.10.1/conf/host/zabbix.conf server { listen 80; server_name localhost zabbix; location / { root /var/www/html; index index.html index.htm index.php; error_page 500 502 503 504 / 50x.html; location = /50x.html { root html; } location ~ \.php$ { fastcgi_pass unix:/tmp/php-fpm.sock; fastcgi_index index.php; fastcgi_param HTTP_PROXY ""; fastcgi_param SCRIPT_FILENAME $document _root$fastcgi_script_name; include fastcgi_params; } } }
Four. Installing Zabbix
1. Download and install Zabbix
Yum-y Install Openipmi-develwget http://120.52.73.47/nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest% 20STABLE/3.0.4/ZABBIX-3.0.4.TAR.GZTAR-ZXVF ZABBIX-3.0.4.TAR.GZCD zabbix-3.0.4./configure--prefix=/usr/local/ zabbix3.0.4--enable-server--with-mysql--with-net-snmp--with-libxml2--with-libcurl--WITH-OPENIPMI-- Enable-agentmake && make Installl
2. Configure Zabbix
CP MISC/INIT.D/FEDORA/CORE5/ZABBIX_SERVER/ETC/INIT.D/CP Misc/init.d/fedora/core5/zabbix_agentd/etc/init.d/sed-i ' S#/usr/local/sbin/zabbix_server#/usr/local/zabbix3.0.4/sbin/zabbix_server#g '/etc/init.d/zabbix_serversed-i ' s#/ Usr/local/sbin/zabbix_agentd#/usr/local/zabbix3.0.4/sbin/zabbix_agentd#g '/etc/init.d/zabbix_agentd
3. Copying a Web site
MKDIR/VAR/WWW/HTML/ZABBIXCP-RF frontends/php/*/var/www/html/zabbix
4.zabbix garbled graphics processing
Upload the Windows operating system's C:\Windows\Fonts\simkai.ttf font file to/var/www/html/zabbix/font. Prevent garbled occurrences
Sed-i ' S#dejavusans#simkai#g '/var/www/html/zabbix/include/defines.inc.php
5. Use MySQL to create a Zabbix database and authorize
Mysql-uroot-pmysql> CREATE DATABASE Zabbix character Set utf8;mysql> grant all on zabbix.* to ' Zabbix ' @ ' localhost ' Identified by ' Zabbix.localhost ';
6. Import the database
Enter zabbix-3.0.4 source file directory Mysql-uroot-p Zabbix < database/mysql/schema.sqlmysql-uroot-p Zabbix < Database/mysql/data . sqlmysql-uroot-p Zabbix < Database/mysql/images.sql
7. Modify the Zabbix_server configuration file, the following is my profile
Egrep-v ' ^:|^# '/usr/local/zabbix3.0.4/etc/zabbix_server.conf|awk ' nf>0 ' logfile=/tmp/zabbix_server.logdbname= zabbixdbuser=zabbixdbpassword=zabbix.localhoststartpollers=10startpingers=4startdiscoverers=4javagateway= 127.0.0.1javagatewayport=10052startjavapollers=5startvmwarecollectors=5vmwarefrequency=60vmwarecachesize=8m
8. Modify the configuration file in the Zabbix web directory
vim/var/www/html/zabbix3.0.4/conf/zabbix.conf.php<?php//Zabbix GUI configuration File.global $DB; $DB [' TYPE '] = ' M Ysql '; $DB [' SERVER '] = ' localhost '; $DB [' PORT '] = ' 0 '; $DB [' DATABASE '] = ' Zabbix '; $DB [' USER '] = ' Zabbix '; $DB [' PASSW ORD '] = ' zabbix.localhost ';//Schema name. Used for IBM DB2 and PostgreSQL. $DB [' SCHEMA '] = '; $ZBX _server = ' localhost '; $ZBX _server_port = ' 10051 '; $ZBX _server_n AME = "; $IMAGE _format_default = Image_format_png;
Qa:
1.zabbix garbled problem
A. Database character set issues, specifying a character set when creating a database
Create database Zabbix character set UTF8;
B. No Chinese fonts have been uploaded, or include/define.inc.php files have not been modified
C. PHP is compiled with the--enable-gd-jis-conv parameter, if it has this parameter, when drawing appears
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/86/D7/wKiom1fM4SmBRJkcAAJOxtHJDII525.png "title=" QQ picture 20160905110554.png "alt=" Wkiom1fm4smbrjkcaajoxthjdii525.png "/>
2.PHP7 Installing Memcache issues
git clone cd pecl-memcache/usr/local/php7.0.10/bin/phpize./configure--with-php-config=/usr/local/php7.0.10/bin/ Php-configmake && make installecho ' extension = "memcache.so" ' >>/usr/local/php7.0.10/etc/php.ini# Check if PHP is loading the memcache module/usr/local/php7.0.10/bin/php-m |grep memcache# Restart PHP-FPM service to load memcache module/ETC/INIT.D/PHP-FPM Restart
This article is from "Maple Night" blog, please be sure to keep this source http://fengwan.blog.51cto.com/508652/1846343
CentOS 6.8 compiled PHP 7.0.10 installation Zabbix3.0.4