//安装基础依赖包
>yum -y install gcc gcc-c++ autoconf ncurses

//编译安装zlib
>tar zxvf zlib-*.tar.gz
>cd zlib-*
>./configure --prefix=/usr/local/zlib
>make
>make install

//编译安装 libpng
>tar zxvf libpng-*.tar.gz
>cd libpng-*
>cp scripts/makefile.std makefile

>make
>make install

//编译安装 jpeg
>tar zxvf jpegsrc.v8c.tar.gz
>cd jpeg-8c/
>./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static
>make
>make install
>ln -s /usr/local/libjpeg/lib/* /usr/lib/

//编译安装 freetype
>tar zxvf freetype-*.tar.gz
>cd freetype-*
>./configure --prefix=/usr/local/freetype
>make
>make install

//编译安装libxml
>tar zxvf libxml2-*.tar.gz
>cd libxml2-*
>./configure --prefix=/usr/local/libxml
>make
>make install

如遇报错:

libxml.c:3908: error: 'PyObject' undeclared (first use in this function)

libxml.c:3908: error: 'module' undeclared (first use in this function)

libxml.c:3914: warning: implicit declaration of function 'Py_InitModule'

libxml.c:3914: warning: nested extern declaration of 'Py_InitModule'

libxml.c:3914: error: 'libxmlMethods' undeclared (first use in this function)

make[4]: *** [libxml.lo] Error 1

make[4]: Leaving directory `/var/software/phplib/libxml2-2.9.1/python'

make[3]: *** [all-recursive] Error 1

make[3]: Leaving directory `/var/software/phplib/libxml2-2.9.1/python'

make[2]: *** [all] Error 2

make[2]: Leaving directory `/var/software/phplib/libxml2-2.9.1/python'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/var/software/phplib/libxml2-2.9.1'

./configure --prefix=/usr/local/libxml --with-python=no或者

安装python-devel



//编译安装gperf-*.tar.gz

>tar zxvf gperf-*.tar.gz

>cd gperf-*

>./configure --prefix=/usr/local/gperf



//编译安装 fontconfig
>tar zxvf fontconfig-*.tar.gz
>cd fontconfig-*
>./autogen.sh --sysconfdir=/etc --prefix=/usr/local/fontconfig --mandir=/usr/share/man --with-freetype-config=/usr/local/freetype/bin/freetype-config --enable-libxml2

>make
>make install

如遇报错:

checking for FREETYPE... configure: error: Package requirements (freetype2) were not met:


No package 'freetype2' found


Consider adjusting the PKG_CONFIG_PATH environment variable if you

installed software in a non-standard prefix.


Alternatively, you may set the environment variables FREETYPE_CFLAGS

and FREETYPE_LIBS to avoid the need to call pkg-config.

See the pkg-config man page for more details.

加上环境路径再试:export PKG_CONFIG_PATH=/usr/local/freetype/lib/pkgconfig



//编译安装libiconv
>tar zxvf libiconv-*.tar.gz
>cd libiconv-*/
>./configure --prefix=/usr/local/libiconv
>make
>make install

//编译安装libmcrypt
>tar zxvf libmcrypt-*.tar.gz
>cd libmcrypt-*
>./configure --prefix=/usr/local/libmcrypt
>make
>make install

//编译安装gettext
>tar zxvf gettext-*.tar.gz
>cd gettext-*
>./configure
>make
>make install

//编译安装 GD
>tar zxvf libgd-2.1.0.tar.gz
>cd libgd-*
>vi gd_png.c
include "/usr/local/libpng/include/png.h"
>./configure --prefix=/usr/local/libgd --with-png=/usr/local/libpng --with-libiconv-prefix=/usr/local/libiconv --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/libjpeg --with-fontconfig=/usr/local/fontconfig/ --with-bcmath --with-sockets

>make
>make install