源码编译配置lnmp部署zabbix

环境说明:

[root@wcy ~]# cat /etc/redhat-release 
CentOS release 6.9 (Final)
[root@wcy ~]# uname -a
Linux wcy.admin 2.6.32-696.30.1.el6.x86_64 #1 SMP Tue May 22 03:28:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@wcy ~]# ip a | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host 
inet 192.168.233.10/24 brd 192.168.233.255 scope global eth0
inet6 fe80::20c:29ff:fe79:1b0f/64 scope link 

下载文件:

mysql-5.6.40.tar.gz     http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/
nginx-1.10.2.tar.gz     https://nginx.org/en/download.html
php-5.6.36.tar.gz       https://secure.php.net/downloads.php

安装nginx:

[root@wcy ~]# rpm -qa | grep -E "httpd|nginx|mysqld"    确保没有rpm格式的同文件
[root@wcy ~]# yum -y install pcre-devel zlib-devel          安装依赖
[root@wcy ~]# useradd -M -s /sbin/nologin nginx
[root@wcy ~]# tar xf nginx-1.10.2.tar.gz -C /usr/src/
[root@wcy ~]# cd /usr/src/nginx-1.10.2/
[root@wcy nginx-1.10.2]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-file-aio --with-http_gzip_static_module --with-http_flv_module --with-http_ssl_module --with-pcre

编译过程中有报错如下:

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

执行:

[root@wcy nginx-1.10.2]# yum -y install openssl openssl-devel

编译、安装

[root@wcy nginx-1.10.2]# make && make install

做个软链接

[root@wcy nginx-1.10.2]# ln -s /usr/local/nginx/sbin/* /usr/local/bin/

启动服务,测试服务

[root@wcy nginx-1.10.2]# nginx 
[root@wcy nginx-1.10.2]# curl -I http://localhost
HTTP/1.1 200 OK
Server: nginx/1.10.2
Date: Wed, 01 Aug 2018 14:49:58 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Wed, 01 Aug 2018 14:48:33 GMT
Connection: keep-alive
ETag: "5b61c841-264"
Accept-Ranges: bytes

安装php

[root@wcy ~]# tar xf php-5.6.36.tar.gz -C /usr/src/
[root@wcy ~]# cd /usr/src/php-5.6.36/
[root@wcy php-5.6.36]# ./configure --prefix=/usr/local/php56 \
> --with-mysql --with-pdo-mysql \
> --with-mysqli --with-openssl \
> --enable-fpm --enable-sockets \
> --enable-sysvshm --enable-mbstring \
> --with-freetype-dir --with-jpeg-dir \
> --with-png-dir --with-zlib-dir \
> --with-libxml-dir=/usr --enable-xml \
> --with-mhash --with-mcrypt \
> --with-config-file-path=/etc \
> --with-config-file-scan-dir=/etc/php.d \
> --with-bz2 --with-curl \
> --enable-ftp \
> --disable-ipv6 \
> --with-gd \
> --enable-gd-native-ttf \
> --with-iconv-dir=/usr \
> --enable-calendar \
> --with-gettext \
> --with-zlib \
> --enable-dom --with-libdir=lib64 \
> --enable-bcmath

编译过程所遇报错及解决办法,兵来将挡水来土掩

报错:
configure: error: xml2-config not found. Please check your libxml2 installation.
解决:
[root@wcy ~]# yum -y install libxml2-devel libxml2
报错:
checking for BZip2 in default path... not found
解决:
[root@wcy ~]# yum -y install bzip2 bzip2-devel
报错:
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
解决:
[root@wcy ~]# yum -y install curl-devel
报错:
configure: error: jpeglib.h not found.
解决:
[root@wcy ~]# yum -y install libjpeg-devel
报错:
configure: error: png.h not found.
解决:
[root@wcy ~]# yum install libpng-devel
报错:
configure: error: freetype-config not found.
解决:
[root@wcy ~]# yum install freetype-devel
报错:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决:
[root@wcy ~]# yum install -y libmcrypt-devel

可谓是一步一坑呀,踩过最深的坑就是编译安装PHP。。。

扫描二维码关注公众号,回复: 2505820 查看本文章

编译安装

[root@wcy php-5.6.36]# make && make install

  

 

猜你喜欢

转载自www.cnblogs.com/LuckWJL/p/9401852.html