2025年libxml2-devel(libxml2-devel 源码安装)

libxml2-devel(libxml2-devel 源码安装)p 本文采用最复杂的 lamp 环境搭建源码安 p

大家好,我是讯享网,很高兴认识大家。



 <p>&#26412;&#25991;&#37319;&#29992;&#26368;&#22797;&#26434;&#30340;lamp&#29615;&#22659;&#25645;&#24314;&#28304;&#30721;&#23433;&#35013;:CentOS 6.x&#19979;&#30340; &#32534;&#35793;&#23433;&#35013; PHP5.6+MYSQL5.6+APACHE2.4<br> 

讯享网

由于文章篇幅比较大,所以分为上下篇两篇文章,敬请关注后续内容……
温馨提示:由于源码编译安装lamp环境出错率极高,所以请心理承受能力差的小伙伴们迅速撤离本文章 ……开玩笑而已:)

今天我这个大自然的搬运工就把我自己整理的源码包全部共享出来了,相比之前分享的更加齐全 如增加了mysql源码包5.6和5.7的 ,(后续将会讲解关于mysql5.6和mysql5.7源码安装的区别和步骤 手把手地教你安装配置mysql5.6和5.7) 以及redis的源码包 请大家要保存好 之后一起学习:) 都会为后续的lamp环境搭建 请相信我 其实源码编译安装lamp和lnmp不难的!!!

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

安装前的准备
查看系统是否安装了PHP,MYSQL,APACHE
查看是否安装

讯享网

如果安装请卸载

 
一些配置 
  1. 配置防火墙
    [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 restart
  2. 配置网卡
    [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
  3. 关闭SELINUX
    vi /etc/selinux/config SELINUX=disabled #增加
    :wq 保存,关闭
    shutdown -r now #重启系统SELINUX=enforcing #注释掉 SELINUXTYPE=targeted #注释掉

[root@localhost ]#rpm -q make gcc gcc-c++ zlib-devel libtool libtool-ltdl libtool-ltdl-devel bisonncurses-devel

没有的话请安装

[root@localhost]#yum -y install make gcc gcc-c++ zlib-devel libtool libtool-ltdllibtool-ltdl-devel bison ncurses-devel libaio

创建临时目录并把相关的源码包放进去

mkdir /usr/local/LAMP

安装依赖库 安装libxml2

yum -y install gcc
yum -y install gcc-c++
yum -y install python-devel 必须有

注:libxml2是一个xml的c语言解析器,支持C,c++,ph,Pascal,ruby,tcl绑定

[root@centos6 LAMP]# cd /usr/local/LAMP

[root@centos6 LAMP]# tar -zxvf libxml2-2.9.0.tar.gz

[root@centos6 LAMP]# cd https://www.imooc.com/article/libxml2-2.9.0

[root@centos6 libxml2-2.9.0]# https://www.imooc.com/article/configure –prefix=/usr/local/libxml2/

[root@centos6 libxml2-2.9.0]# make

[root@centos6 libxml2-2.9.0]# 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 LAMP]# cd /usr/local/LAMP

[root@centos6 LAMP]# tar -zxvf libmcrypt-2.5.7.tar.gz

[root@centos6 LAMP]# cd https://www.imooc.com/article/libmcrypt-2.5.7

[root@centos6 libmcrypt-2.5.7]# https://www.imooc.com/article/configure –prefix=/usr/local/libmcrypt/

[root@centos6 libmcrypt-2.5.7]# make && make install

注:

如果安装成功就会在/usr/local/libmcrypt/目录下生成 bin,include,lib,man,share五个目录。然后在安装PHP5源代码包的配置时,就可以通过configure命令加上&ldquo;–with-mcrypt-dir=/usr/local/libmcrypt&rdquo; 选项,指定这个libmcrypt库文件的位置。

如果https://www.imooc.com/article/configure时报错:configure: error: C++ compiler cannot create executables 解决方案:

yum install gcc gcc-c++ gcc-g77

重新https://www.imooc.com/article/configure

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

[root@localhost libltdl]# cd /usr/local/libmcrypt-2.5.7/libltdl //进入软件源代码目录

[root@localhost libltdl]# https://www.imooc.com/article/configure -enable-ltdl-install //配置ltdl库的安装

[root@localhost libltdl]# make //编译

[root@localhost libltdl]# make install //安装

安装mhash
讯享网

cd /lamp/mhash-0.9.9.9
https://www.imooc.com/article/configure
make
make install

安装mcrypt
 

cd /lamp/mcrypt-2.6.8
LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib
https://www.imooc.com/article/configure –with-libmcrypt-prefix=/usr/local/libmcrypt

以上为一条命令。LD_LIBRARY_PATH用于指定libmcrypt和mhash的库的位置。

–with-libmcrypt-prefix用于指定libmcrypt软件位置
make
make install

mcrypt没有安装完成,这是php的模块,需要等php安装完成之后,再继续安装 安装zlib

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

[root@centos6 LAMP]# cd /usr/local/LAMP

[root@centos6 LAMP]# tar -zxvf zlib-1.2.3.tar.gz

[root@centos6 LAMP]# cd https://www.imooc.com/article/zlib-1.2.3

[root@centos6 zlib-1.2.3]# https://www.imooc.com/article/configure –prefix=/usr/local/zlib/

{如果后面装apache或者php报zlib的错,回到这里这样编译:
[root@localhostzlib-1.2.3]# CFLAGS=“-O3 -fPIC” https://www.imooc.com/article/configure –prefix=/usr/local/zlib/(用64位元的方法进行编译)
}

[root@centos6 zlib-1.2.3]# make && make install

[root@centos6 LAMP]# cd /usr/local/LAMP

[root@centos6 LAMP]# tar -zxvf libpng-1.2.31.tar.gz

[root@centos6 LAMP]# cd https://www.imooc.com/article/libpng-1.2.31

如果报错:configure: error: ZLib not installed(没有请跳过)

这样解决 :


讯享网

讯享网
安装jpeg

注:安装GD2库前所需的jpeg8库文件,需要自己手动创建安装需要的目录,它们在安装时不能自动创建。

[root@centos6 LAMP]# cd /usr/local/LAMP

[root@centos6 LAMP]# tar -zxvf jpegsrc.v9a.tar.gz

[root@centos6 LAMP]# cd https://www.imooc.com/article/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]# https://www.imooc.com/article/configure –prefix=/usr/local/jpeg/ –enable-shared –enable-static(建立共享库使用的GNU的libtool和静态库使用的GNU的libtool)

[root@centos6 jpeg-9a]# make && make install

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

安装freetype

[root@centos6 LAMP]# cd /usr/local/LAMP

[root@centos6 LAMP]# tar -zxvf freetype-2.5.3.tar.gz

[root@centos6 LAMP]# cd https://www.imooc.com/article/freetype-2.5.3

[root@centos6 freetype-2.5.3]#https://www.imooc.com/article/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命令选项中加上&ldquo;–with-freetype=/usr/local/freetype/&rdquo;选项,指定freetype库文件位置。

安装autoconf

[root@centos6 LAMP]# cd /usr/local/LAMP

[root@centos6 LAMP]# tar -zxvf autoconf-2.69.tar.gz

[root@centos6 LAMP]# cd https://www.imooc.com/article/autoconf-2.69

[root@centos6 autoconf-2.69]# https://www.imooc.com/article/configure

[root@centos6 autoconf-2.69]# make && make install

编译安装GD

[root@centos6 LAMP]# cd /usr/local/LAMP

[root@centos6 LAMP]# tar -zxvf libgd-2.1.0.tar.gz

[root@centos6 LAMP]# cd https://www.imooc.com/article/libgd-2.1.0

[root@centos6 libgd-2.1.0]# https://www.imooc.com/article/configure –prefix=/usr/local/gd2 –with-jpeg=/usr/local/jpeg/ –with-png=/usr/local/libpng/ –with-zlib=/usr/local/zlib/ –with-freetype=/usr/local/freetype/

[root@centos6 libgd-2.1.0]# make && make instal

如果安装成功会在/usr/local/gd/目录下存在bin、include和lib这三个目录。在安装PHP5时,通过在configure命令选项中加上&ldquo;–with-gd=/usr/local/gd&rdquo;选项,指定GD库文件的位置。

如果报错:

gd_png.c 中

gdMalloc

函数的问题

make[2]: * [gd_png.lo] Error 1

make[2]: Leaving directory /tmp/gd-2.0.35' </p> <p>make[1]: * [all-recursive] Error 1 </p> <p>make[1]: Leaving directory/tmp/gd-2.0.35’

make: * [all] Error 2

解决方案:

vi gd_png.c

找到

include “png.h”

改成

include “/usr/local/libpng/include/png.h”

如果报错:

unrecognized option &ndash;with-zlib

解决方案:

重装zlib

https://www.imooc.com/article/configure 之前要先 make clean

或者把解压包删掉,重新解压

另附安装参数:

https://www.imooc.com/article/configure //配置命令

–prefix=/usr/local/gd //指定安装软件的位置

–with-jpeg=/usr/local/jpeg/ //指定去哪找jpeg库文件

–with-png=/usr/local/libpng/ //指定去哪找png库文件

–with-zlib=/usr/local/zlib/ //指定去哪找zlib库文件

–with-freetype=/usr/local/freetype/ //指定去哪找freetype 2.x字体库的位置

小讯
上一篇 2025-05-13 09:57
下一篇 2025-06-16 09:22

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/176322.html