zabbix,php,nginx,mysql源码安装 神仙操作
Posted pluto2charon
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix,php,nginx,mysql源码安装 神仙操作相关的知识,希望对你有一定的参考价值。
→软件包
mkdir /soft/
cd /soft
♦下载以下软件包
nginx-1.14.2.tar.gz
wget http://nginx.org/download/nginx-1.14.2.tar.gz
mysql-boost-5.7.25.tar.gz
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.25.tar.gz
boost_1_59_0.tar.gz
wget https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
php-7.1.27.tar.gz
wget http://cn2.php.net/get/php-7.1.27.tar.gz/from/this/mirror
zabbix-4.0.5.tar.gz
wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.0.5/zabbix-4.0.5.tar.gz/download
mv download zabbix-4.0.5.tar.gz
→解压
tar zxvf nginx-1.14.2.tar.gz tar zxvf mysql-boost-5.7.25.tar.gz tar zxvf boost_1_59_0.tar.gz tar zxvf php-7.1.27.tar.gz tar zxvf zabbix-4.0.5.tar.gz
→安装nginx
♦安装依赖
yum install -y pcre* openssl*
♦预编译
[[email protected] nginx-1.14.2]# ./configure --prefix=/usr/local/nginx > --with-http_ssl_module > --with-http_stub_status_module > --with-pcre
♦编译安装
[[email protected] nginx-1.14.2]# make && make install
♦创建网站目录
[[email protected] nginx-1.14.2]# mkdir /var/www/html -p
→安装PHP
♦安装依赖
[[email protected] nginx-1.14.2]# yum install -y gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel php-mysql php-bcmath
♦ 预编译
[[email protected] php-7.1.27]# ./configure --prefix=/usr/local/php > --with-config-file-path=/usr/local/php/etc > --with-bz2 > --with-curl > --enable-ftp > --enable-sockets > --disable-ipv6 > --with-gd > --with-jpeg-dir=/usr/local > --with-png-dir=/usr/local > --with-freetype-dir=/usr/local > --enable-gd-native-ttf > --with-iconv-dir=/usr/local > --enable-mbstring > --enable-calendar > --with-gettext > --with-libxml-dir=/usr/local > --with-zlib > --with-pdo-mysql=mysqlnd > --enable-dom > --enable-xml > --enable-fpm > --with-libdir=lib64
♦编译安装
[[email protected] php-7.1.27]# make && make install
♦配置PHP
cp php.ini-production /usr/local/php/etc/php.ini [[email protected] php-7.1.27]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
♦参数配置PHP(zabbix硬性要求)
vim /usr/local/php/etc/php.ini
max_execution_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 date.timezone = Asia/Shanghai
♦启动php-fpm
[[email protected] php-7.1.27]# mv /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf [[email protected] php-7.1.27]# /usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini
♦确定php启动
[[email protected] php-7.1.27]# ss -lnt | grep 9000 LISTEN 0 128 127.0.0.1:9000 *:*
♦配置nginx配置文件,供测试php,以及zabbix页面配置
[[email protected] php-7.1.27]# cat /usr/local/nginx/conf/nginx.conf #user nobody; worker_processes 1; #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 80; server_name localhost; #charset koi8-r; access_log /usr/local/nginx/logs/host.access.log main; root /var/www/html; index index.htm index.html index.php; location / { try_files $uri $uri/ /index.php?$args; } location ~ .*.(php)?$ { expires -1s; try_files $uri =404; fastcgi_split_path_info ^(.+.php)(/.+)$; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; } #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$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$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; # } #} }
♦检测一下,并启动
[[email protected] php-7.1.27]# /usr/local/nginx/sbin/nginx -t [[email protected] php-7.1.27]# /usr/local/nginx/sbin/nginx
♦测试php页面
[[email protected] php-7.1.27]# cat /var/www/html/info.php <?php phpinfo(); ?>
♦测试php
[[email protected] php-7.1.27]# curl 127.0.0.1/info.php
→安装mysql数据库
♦安装前准备
[[email protected] soft]# rpm -qa | grep mariadb [[email protected] soft]# rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64 [[email protected] soft]# rpm -e --nodeps mariadb-5.5.60-1.el7_5.x86_64 [[email protected] soft]# rpm -e --nodeps mariadb-server-5.5.60-1.el7_5.x86_64
♦安装依赖
yum -y install gcc gcc-c++ ncurses ncurses-devel cmake bison
♦将解压的
boost_1_59_0移动
mv boost_1_59_0 /usr/local/boost
♦新建MySQL用户和用户组,创建/data/mysql 目录存放mysql数据
[[email protected] soft]# groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql [[email protected] soft]# mkdir -pv /data/mysql
♦预编译
[[email protected] mysql-5.7.17]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock-DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_BOOST=/usr/local/boost -DMYSQL_USER=mysql -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
♦编译安装
[[email protected] mysql-5.7.25]# make && make install
以上是关于zabbix,php,nginx,mysql源码安装 神仙操作的主要内容,如果未能解决你的问题,请参考以下文章
zabbix 3.2.6+centos 7 +nginx 1.12+ mysql 5.6+ Grafana +php 5.6