Blogger Information
Blog 41
fans 0
comment 1
visits 40053
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
CentOS 6.x 源码编译安装 LAMP/LNMP 环境(辅助软件的安装)
yeyiluLAMP
Original
931 people have browsed it

安装前的准备

软件源码包 链接:http://pan.baidu.com/s/1o7D5b66 密码:8ql2

查看系统是否安装了PHP,MYSQL,APACHE
查看是否安装

[root@localhost ~]#rpm -q httpd mysql php

如果安装请卸载

[root@localhost ~]#rpm -e httpd --nodeps
[root@localhost ~]#rpm -e mysql --nodeps
[root@localhost ~]#rpm -e php --nodeps


一些配置

0. 配置防火墙

root@centos6 ~]# vi /etc/sysconfig/iptables添加(在22端口那一行下面添加):
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #允许80端口通过防火墙-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #允许3306端口通过防火墙重启防火墙   
[root@centos6 ~]# /etc/init.d/iptables restart1. 配置网卡

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="00:0C:29:FD:FF:2A"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR=192.168.1.31
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BOOTPROTO=static
没有的项手动添加,记得重启网卡:
[root@localhost ~]# /etc/init.d/network stop
[root@localhost ~]# /etc/init.d/network start
2. 关闭SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
:wq 保存退出
setenforce 0 #使配置立即生效

安装必要的环境库
安装环境库

[root@localhost~]#yum -y install make gcc gcc-c++ zlib-devel libtool 
libtool-ltdllibtool-ltdl-devel bison ncurses-devel libaio  apr* autoconf 
automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-devel 
fontconfig fontconfig-devel freetype freetype* freetype-devel gcc 
gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers 
keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng 
libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel 
libtool* libgomp libxml2 libxml2-devel libXpm* libxml* libtiff libtiff* 
make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl 
php-common php-gd policycoreutils telnet t1lib t1lib* nasm nasm* wget 
zlib-devel
# 安装libxml2
libxml是一个用来解析XML文档的函数库。它用C语言写成, 并且能为多种语言所调用,例如C语言,C++,XSH。C#, Python,Kylix/Delphi,Ruby,和PHP等。Perl中也可以使用XML::LibXML模块。它最初是为GNOME开发的项目,但现在可以用在各种各样的方面。libXML 代码可移植性非常好,因为它基于标准的ANSI C库, 并采用MIT许可证。

多命令顺序执行:
&&  命令1正确执行,命令2才会执行
||  命令1不正确执行,命令2才会执行
;  命令1执行完成,命令2执行
|  命令1的执行结果,作为命令2 的操作对象


[root@centos6 src]# cd /usr/local/src 
[root@centos6 src]# tar -zxvf libxml2-2.9.1.tar.gz
[root@centos6 src]# cd ./libxml2-2.9.1
[root@centos6 libxml2-2.9.1]# ./configure --prefix=/usr/local/libxml2/ 
[root@centos6 libxml2-2.9.1]# make 
[root@centos6 libxml2-2.9.1]# make install

注:如果安装成功以后,在/usr/local/libxml2/目录下将生成bin,include,lib,share四个目录。在后面安装PHP5源代码的配置时,会通过在configure命令的选项中加上"--with-libxml-dir=/usr/local/libxml2"选项,用于指定安装libxml2库文件的位置


安装libmcrypt

注:libmcrypt是加密算法扩展库。支持DES, 3DES, RIJNDAEL, Twofish, IDEA, GOST, CAST-256, ARCFOUR,SERPENT, SAFER+等算法

[root@centos6 src]# cd /usr/local/LAMP 
[root@centos6 src]# tar -zxvf libmcrypt-2.5.8.tar.gz 
[root@centos6 LAMP]# cd ./libmcrypt-2.5.8 
[root@centos6 libmcrypt-2.5.8]# ./configure --prefix=/usr/local/libmcrypt/ 
[root@centos6 libmcrypt-2.5.7]# make && make install

注:
如果安装成功就会在/usr/local/libmcrypt/目录下生成
bin,include,lib,man,share五个目录。然后在安装PHP5源代码包的配置时,就可以通过configure命令加上“--with-mcrypt-dir=/usr/local/libmcrypt”
 选项,指定这个libmcrypt库文件的位置。
如果./configure时报错:configure: error: C++ compiler cannot create executables 解决方案:
yum install gcc gcc-c++ gcc-g77

重新./configure


安装完成libmcrypt库以后,不同的linux系统版本有可能还要安装一下libltdl库。安装方法和前面的步骤相同,可以进入到解压缩的目录/usr/local/libmcrypt-2.5.7下,找到libltdl库源代码所在的目录libltdl,进入这个目录按照下面几个命令配置、编译、安装就可以了

[root@localhost libltdl]# cd /usr/local/libmcrypt-2.5.8/libltdl //进入软件源代码目录
[root@localhost libltdl]# ./configure -enable-ltdl-install //配置ltdl库的安装
[root@localhost libltdl]# make //编译
[root@localhost libltdl]# make install  //安装

安装zlib

注:zlib是提供数据压缩用的函式库

[root@centos6 src]# cd /usr/local/src 
[root@centos6 src]# tar -zxvf zlib-1.2.8.tar.gz 
[root@centos6 src]# cd ./zlib-1.2.8 
[root@centos6 zlib-1.2.8]# ./configure --prefix=/usr/local/zlib/ {如果后面装apache或者php报zlib的错,回到这里这样编译:
[root@localhostzlib-1.2.8]# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib/(用64位元的方法进行编译)}
[root@centos6 zlib-1.2.8]# make && make install
# 安装mhash
Mhash是基于离散数学原理的不可逆向的php加密方式扩展库,其在默认情况下不开启。mhash的可以用于创建校验数值,消息摘要,消息认证码,以及无需原文的关键信息保存(如密码)等。
cd /usr/lcoal/src/mhash-0.9.9.9
./configure 
make
make install
# 安装mcrypt
mcrypt 是 php 里面重要的加密支持扩展库。Mcrypt库支持20多种加密算法和8种加密模式
cd /lamp/mcrypt-2.6.8
LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib  \
./configure --with-libmcrypt-prefix=/usr/local/libmcrypt
#以上为一条命令。LD_LIBRARY_PATH用于指定libmcrypt和mhash的库的位置。
--with-libmcrypt-prefix用于指定libmcrypt软件位置
make
make install
#mcrypt没有安装完成,这是php的模块,需要等php安装完成之后,再继续安装
# 安装libpng 
libpng 软件包包含 libpng 库.这些库被其他程式用于解码png图片
 cd /usr/local/src/libpng-1.2.31
 ./configure --prefix=/usr/local/libpng --enable-shared
 make
 make install
安装jpeg
注:安装GD2库前所需的jpeg8库文件,需要自己手动创建安装需要的目录,它们在安装时不能自动创建
[root@centos6 src]# tar -zxvf jpegsrc.v9a.tar.gz 
[root@centos6 src]# cd ./jpeg-9a/ 
[root@centos6 jpeg-9a]# mkdir /usr/local/jpeg/ (创建jpeg软件的安装目录) 
[root@centos6 jpeg-9a]# mkdir /usr/local/jpeg/bin/ (创建存放命令的目录)
[root@centos6 jpeg-9a]# mkdir /usr/local/jpeg/lib/ (创建jpeg库文件所在目录)
[root@centos6 jpeg-9a]# mkdir /usr/local/jpeg/include/ (创建存放头文件目录)
[root@centos6 jpeg-9a]# mkdir -p /usr/local/jpeg/man/man1(建立存放手册的目录)
[root@centos6 jpeg-9a]# ./configure --prefix=/usr/local/jpeg/ --enable-shared --enable-static(建立共享库使用的GNU的libtool和静态库使用的GNU的libtool)
[root@centos6 jpeg-9a]# make && make install

在安装GD2库配置时,可以在configure命令的选项中加上“--with-jpeg=/usr/local/jpeg8”选项,指定jpeg8库文件的位置。安装PHP时也要指定该库文件的位置

安装libvpx
cd /usr/local/src
tar xvf libvpx-1.6.0.tar.bz2
cd libvpx-1.6.0
./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9
make
make install

安装tiff
cd /usr/local/src
tar zxvf tiff-4.0.6.tar.gz
cd tiff-4.0.6
./configure --prefix=/usr/local/tiff --enable-shared
make
make install

安装yasm
cd /usr/local/src
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
make install

安装freetype

[root@centos6 src]# tar -zxvf freetype-2.5.3.tar.gz 
[root@centos6 src]# cd ./freetype-2.5.3
[root@centos6 freetype-2.5.3]#./configure --prefix=/usr/local/freetype/ --enable-shared 
[root@centos6 freetype-2.5.3]# make && make install
如果安装成功将会在/usr/local/freetype目录下存在bin,include,lib和share四个目录。并在安装GD2库时,通过configure命令选项中加上“--with-freetype=/usr/local/freetype/”选项,指定freetype库文件位置。
安装autoconf
[root@centos6 src]# cd /usr/local/LAMP 
[root@centos6 src]# tar -zxvf autoconf-2.69.tar.gz 
[root@centos6 src]# cd ./autoconf-2.69
[root@centos6 autoconf-2.69]# ./configure 
[root@centos6 autoconf-2.69]# make && make install
安装libgd
cd /usr/local/src
tar zxvf libgd-2.1.1.tar.gz #解压
cd libgd-2.1.1 #进入目录
./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/ --with-tiff=/usr/local/tiff  --with-vpx=/usr/local/libvpx/

此时会出现以下错误

make 
     报错误如下:
webpimg.c: In function 'VPXEncode':
webpimg.c:714:24: error: 'IMG_FMT_I420' undeclared (first use in this function)
     vpx_img_wrap(&img, IMG_FMT_I420,
                        ^
webpimg.c:714:24: note: each undeclared identifier is reported only once for each function it appears 
in
webpimg.c:716:16: error: 'PLANE_Y' undeclared (first use in this function)
     img.planes[PLANE_Y] = (uint8*)(Y);
                ^
webpimg.c:717:16: error: 'PLANE_U' undeclared (first use in this function)
     img.planes[PLANE_U] = (uint8*)(U);
                ^
webpimg.c:718:16: error: 'PLANE_V' undeclared (first use in this function)
     img.planes[PLANE_V] = (uint8*)(V);
                ^
make[2]: *** [webpimg.lo] Error 1
make[2]: Leaving directory `/usr/local/src/libgd-2.1.1/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/local/src/libgd-2.1.1/src'
make: *** [all-recursive] Error 1


解决方法::vim  /usr/local/src/libgd-2.1.1/src/webpimg.c         

 修改

         codec_ctl(&enc, VP8E_SET_STATIC_THRESHOLD, 0);
     codec_ctl(&enc, VP8E_SET_TOKEN_PARTITIONS, 2);
 
-    vpx_img_wrap(&img, IMG_FMT_I420,                   #需要修改处
+    vpx_img_wrap(&img, VPX_IMG_FMT_I420,               #被修改为
                  y_width, y_height, 16, (uint8*)(Y));
-    img.planes[PLANE_Y] = (uint8*)(Y); #需要修改处
-    img.planes[PLANE_U] = (uint8*)(U); #需要修改处
-    img.planes[PLANE_V] = (uint8*)(V); #需要修改处
-    img.stride[PLANE_Y] = y_stride;    #需要修改处
-    img.stride[PLANE_U] = uv_stride;   #需要修改处
-    img.stride[PLANE_V] = uv_stride;   #需要修改处
+    img.planes[VPX_PLANE_Y] = (uint8*)(Y); #被修改为
+    img.planes[VPX_PLANE_U] = (uint8*)(U); #被修改为
+    img.planes[VPX_PLANE_V] = (uint8*)(V); #被修改为
+    img.stride[VPX_PLANE_Y] = y_stride;    #被修改为
+    img.stride[VPX_PLANE_U] = uv_stride;   #被修改为
+    img.stride[VPX_PLANE_V] = uv_stride;   #被修改为

再重新编译

make && make install


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!