nginx-1.6.2+php-5.6.8+mariadb-10.0.14
mariadb10.0.14
请参看:源码安装MariaDB10
php5.6.8
一.编译安装php
A.安装编译工具和依赖库
[root@test1 ~]#yum -y install gcc gcc-c++ libxml2-devel openssl-devel pcre-devel libcurl-devel gd-devel bzip2-devel freetype-devel giflib-devel openjpeg-devel readline-devel libedit-devel
B.编译php扩展库
libmcrypt ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt
[root@test1 ~]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
[root@test1 ~]# tar -zxvf libmcrypt-2.5.7.tar.gz -C /usr/local/src
[root@test1 ~]# cd /usr/local/src/libmcrypt-2.5.7
[root@test1 libmcrypt-2.5.7]# ./configure && make && make install
[root@test1 ~]#ldconfig
mhash http://sourceforge.net/projects/mhash/files/
[root@test1 ~]# tar -jxvf mhash-0.9.9.9.tar.bz2 -C /usr/local/src
[root@test1 ~]# cd /usr/local/src/mhash-0.9.9.9/
[root@test1 mhash-0.9.9.9]# ./configure && make && make install
[root@test1 ~]#ldconfig
mcrypt ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic
[root@test1 ~]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/mcrypt-2.6.4.tar.gz
[root@test1 ~]# tar -zxvf mcrypt-2.6.4.tar.gz -C /usr/local/src
[root@test1 ~]# cd /usr/local/src/mcrypt-2.6.4
[root@test1 mcrypt-2.6.4]# LD_LIBRARY_PATH=/usr/local/lib ./configure && make && make install
[root@test1 ~]#ldconfig
注意:上面标红的部分一定不能省,不然会报如下错误
checking for libmcrypt - version >= 2.5.0... no
*** Could not run libmcrypt test program, checking why...
*** The test program compiled, but did not run. This usually means
*** that the run-time linker is not finding LIBMCRYPT or finding the wrong
*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location Also, make sure you
have run ldconfig if that
*** is required on your system
***
*** If you have an old version installed, it is best to remove it, although
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH
***
configure: error: *** libmcrypt was not found
说明:如果提示GD库找不到,可以再重新源码安装下GD库(可选)
libgd
http://libgd.bitbucket.org/
http://autosetup1.googlecode.com/files
[root@test1 ~]#wget http://autosetup1.googlecode.com/files/gd-2.0.35.tar.gz
[root@test1 ~]#tar -zxvf gd-2.0.35.tar.gz -C /usr/local/src/
[root@test1 ~]#cd /usr/local/src/gd-2.0.35/
[root@test1 gd-2.0.35]# ./configure && make && make install
[root@test1 ~]#ldconfig
gd库很重要,诸如dedeCMS, DiscuzX!,PHPwind等建站框架都需要gd库支持,并且官方下载的gd库一直安装不成功,所以这里才用了第三方的地址。
C.编译php-fpm
新建用户和用户组
groupadd -r php-fpm
useradd -r php-fpm -g php-fpm
php http://cn2.php.net/get/php-5.6.8.tar.xz/from/a/mirror
[root@test1 ~]# tar -xvf php-5.6.8.tar.xz -C /usr/local/src
[root@test1 ~]# cd /usr/local/src/php-5.6.8
[root@test1 php-5.6.8]# ./configure
--prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc
--with-config-file-scan-dir=/usr/local/php/etc/php.d
--with-fpm-user=php-fpm
--with-fpm-group=php-fpm
--enable-inline-optimization
--enable-pcntl
--enable-shmop
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-sockets
--enable-shared
--enable-opcache
--enable-bcmath
--enable-soap
--enable-zip
--enable-gd-native-ttf
--enable-ftp
--enable-fpm
--enable-mbstring
--enable-calendar
--enable-dom
--enable-xml
--with-pear
--with-pcre-regex
--with-curl
--with-bz2
--with-zlib
--with-gd
--with-gettext
--with-jpeg-dir=/usr/local
--with-png-dir=/usr/local
--with-iconv-dir=/usr/local
--with-freetype-dir=/usr/local
--with-libxml-dir=/usr/local
--with-readline
--with-iconv
--with-mcrypt
--with-mhash
--with-openssl
--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
--disable-debug
--disable-fileinfo
[root@test1 php-5.6.8]# make && make install
注意:
编译出现错误
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
这是由于内存小于1G所导致,解决办法在./configure加上选项:
--disable-fileinfo
#禁用 fileinfo
--enable-mbstring
# phpMyadmin4需要mbstring支持,编译时可以加上
mariadb10.0.14
请参看:源码安装MariaDB10
php5.6.8
一.编译安装php
A.安装编译工具和依赖库
[root@test1 ~]#yum -y install gcc gcc-c++ libxml2-devel openssl-devel pcre-devel libcurl-devel gd-devel bzip2-devel freetype-devel giflib-devel openjpeg-devel readline-devel libedit-devel
B.编译php扩展库
libmcrypt ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt
[root@test1 ~]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
[root@test1 ~]# tar -zxvf libmcrypt-2.5.7.tar.gz -C /usr/local/src
[root@test1 ~]# cd /usr/local/src/libmcrypt-2.5.7
[root@test1 libmcrypt-2.5.7]# ./configure && make && make install
[root@test1 ~]#ldconfig
mhash http://sourceforge.net/projects/mhash/files/
[root@test1 ~]# tar -jxvf mhash-0.9.9.9.tar.bz2 -C /usr/local/src
[root@test1 ~]# cd /usr/local/src/mhash-0.9.9.9/
[root@test1 mhash-0.9.9.9]# ./configure && make && make install
[root@test1 ~]#ldconfig
mcrypt ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic
[root@test1 ~]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/mcrypt-2.6.4.tar.gz
[root@test1 ~]# tar -zxvf mcrypt-2.6.4.tar.gz -C /usr/local/src
[root@test1 ~]# cd /usr/local/src/mcrypt-2.6.4
[root@test1 mcrypt-2.6.4]# LD_LIBRARY_PATH=/usr/local/lib ./configure && make && make install
[root@test1 ~]#ldconfig
注意:上面标红的部分一定不能省,不然会报如下错误
checking for libmcrypt - version >= 2.5.0... no
*** Could not run libmcrypt test program, checking why...
*** The test program compiled, but did not run. This usually means
*** that the run-time linker is not finding LIBMCRYPT or finding the wrong
*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location
*** is required on your system
***
*** If you have an old version installed, it is best to remove it, although
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH
***
configure: error: *** libmcrypt was not found
说明:如果提示GD库找不到,可以再重新源码安装下GD库(可选)
libgd
http://libgd.bitbucket.org/
http://autosetup1.googlecode.com/files
[root@test1 ~]#wget http://autosetup1.googlecode.com/files/gd-2.0.35.tar.gz
[root@test1 ~]#tar -zxvf gd-2.0.35.tar.gz -C /usr/local/src/
[root@test1 ~]#cd /usr/local/src/gd-2.0.35/
[root@test1 gd-2.0.35]# ./configure && make && make install
[root@test1 ~]#ldconfig
gd库很重要,诸如dedeCMS, DiscuzX!,PHPwind等建站框架都需要gd库支持,并且官方下载的gd库一直安装不成功,所以这里才用了第三方的地址。
C.编译php-fpm
新建用户和用户组
groupadd -r php-fpm
useradd -r php-fpm -g php-fpm
php http://cn2.php.net/get/php-5.6.8.tar.xz/from/a/mirror
[root@test1 ~]# tar -xvf php-5.6.8.tar.xz -C /usr/local/src
[root@test1 ~]# cd /usr/local/src/php-5.6.8
[root@test1 php-5.6.8]# ./configure
--prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc
--with-config-file-scan-dir=/usr/local/php/etc/php.d
--with-fpm-user=php-fpm
--with-fpm-group=php-fpm
--enable-inline-optimization
--enable-pcntl
--enable-shmop
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-sockets
--enable-shared
--enable-opcache
--enable-bcmath
--enable-soap
--enable-zip
--enable-gd-native-ttf
--enable-ftp
--enable-fpm
--enable-mbstring
--enable-calendar
--enable-dom
--enable-xml
--with-pear
--with-pcre-regex
--with-curl
--with-bz2
--with-zlib
--with-gd
--with-gettext
--with-jpeg-dir=/usr/local
--with-png-dir=/usr/local
--with-iconv-dir=/usr/local
--with-freetype-dir=/usr/local
--with-libxml-dir=/usr/local
--with-readline
--with-iconv
--with-mcrypt
--with-mhash
--with-openssl
--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
--disable-debug
--disable-fileinfo
注意:
编译出现错误
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
这是由于内存小于1G所导致,解决办法在./configure加上选项:
--disable-fileinfo
--enable-mbstring
--enable-gd-jis-conv
#该参数如无特殊需求,请勿添加,可能会导致图片中文乱码,请参看 zabbix-2.2.x LTS源码安装配置
添加环境变量
[root@test1
php-5.6.8]#vim
/etc/profile
PATH=$PATH:/usr/local/php/sbin:/usr/local/php/bin
[root@test1
php-5.6.8]#source
/etc/profile
二.配置php-fpm
[root@test1 ~]#cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
添加环境变量
PATH=$PATH:/usr/local/php/sbin:/usr/local/php/bin
二.配置php-fpm
[root@test1 ~]#cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
[root@test1
~]# cp /usr/local/src/php-5.6.8/sapi/fpm/init.d.php-fpm
/etc/init.d/php-fpm
[root@test1 ~]# chmod +x /etc/init.d/php-fpm
[root@test1 php]# /etc/init.d/php-fpm start
Starting php-fpm
done
[root@test1
php]#netstat -tunlp|grep
php
tcp
0
0 127.0.0.1:9000
0.0.0.0:*
LISTEN
32468/php-fpm
[root@test1 ~]# chkconfig php-fpm on
[root@test1 ~]# chkconfig --list php-fpm
php-fpm
0:off
1:off
2:on
3:on
4:on
5:on
6:off
cp
/usr/local/src/php-5.6.8/php.ini-production
/usr/local/php/etc/php.ini
nginx1.6.2
官方网站:
http://nginx.org/
http://nginx.org/download/nginx-1.6.2.tar.gz
https://openresty.org/en/benchmark.html
https://github.com/leancloud/resty-marathon-lb/blob/master/openresty/build-and-install.sh
ab -k -c10 -n10000 -t1 -r 'http://127.0.0.1:8080/
另参见:Nginx-1.x.x源码自动安装配置(CentOS6)
一.安装编译工具和依赖库
[root@test1 ~]#yum -y install gcc gcc-c++ autoconf automake make zlib zlib-devel openssl openssl-devel pcre-devel libxml2-devel libxslt-devel
perl-ExtUtils-Embed
二.下载,编译安装
[root@test1 ~]#wget http://nginx.org/download/nginx-1.6.2.tar.gz
[root@test1 ~]#tar -zxvf nginx-1.6.2.tar.gz -C
/usr/local/src/
[root@test1 ~]#cd /usr/local/src/nginx-1.6.2
[root@test1 nginx-1.6.2]#./configure
--prefix=/usr/local/nginx
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error_log
--pid-path=/var/run/nginx.pid
--lock-path=/var/lock/subsys/nginx
--user=nginx
--group=nginx
--with-http_ssl_module
--with-http_realip_module
--with-http_addition_module
--with-http_xslt_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_mp4_module
--with-http_gzip_static_module
--with-http_random_index_module
--with-http_secure_link_module
--with-http_degradation_module
--with-http_stub_status_module
--http-log-path=/var/log/nginx/access_log
--http-client-body-temp-path=/var/tmp/nginx/client
--http-proxy-temp-path=/var/tmp/nginx/proxy
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
--http-scgi-temp-path=/var/tmp/nginx/scgi
[root@test1 ~]# chmod +x /etc/init.d/php-fpm
[root@test1 php]# /etc/init.d/php-fpm start
Starting php-fpm
tcp
[root@test1 ~]# chkconfig php-fpm on
[root@test1 ~]# chkconfig --list php-fpm
php-fpm
补充:额外的php.ini文件也可以在源码里找到,有需要可以加上
[root@test1
~]# nginx1.6.2
官方网站:
http://nginx.org/
http://nginx.org/download/nginx-1.6.2.tar.gz
https://openresty.org/en/benchmark.html
https://github.com/leancloud/resty-marathon-lb/blob/master/openresty/build-and-install.sh
ab -k -c10 -n10000 -t1 -r 'http://127.0.0.1:8080/
另参见:Nginx-1.x.x源码自动安装配置(CentOS6)
一.安装编译工具和依赖库
[root@test1 ~]#yum -y install gcc gcc-c++ autoconf automake make zlib zlib-devel openssl openssl-devel pcre-devel
二.下载,编译安装
[root@test1 ~]#wget http://nginx.org/download/nginx-1.6.2.tar.gz
[root@test1 ~]#tar -zxvf nginx-1.6.2.tar.gz
[root@test1 ~]#cd /usr/local/src/nginx-1.6.2
[root@test1 nginx-1.6.2]#./configure