一、编译安装varnish-3.0.3
wget repo.varnish-cache.org/source/varnish-3.0.3.tar.g
# tar -xf varnish-3.0.3.tar.gz
# cd varnish-3.0.3
# ./autogen.sh
报上述错误,提示缺少automake,yum安装即可:
# yum -y install automake
# ./autogen.sh
+ aclocal -I m4
+ libtoolize --copy --force
./autogen.sh: line 42: libtoolize: command not found
报上述错误,提示缺少libtool,yum安装即可:
# ./autogen.sh
+ aclocal -I m4
+ libtoolize --copy --force
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
+ autoheader
+ automake --add-missing --copy --foreign
+ autoconf
# ./configure --prefix=/usr/local/varnish --enable-dependency-tracking
--enable-developer-warnings --enable-debugging-symbols
checking for PCRE... configure: error: Package requirements (libpcre) were not met:
No package 'libpcre' 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 PCRE_CFLAGS
and PCRE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
报上述错误,提示没找到libpcre,也给出了方法导入PKG_CONFIG_PATH环境变量,解决办法:
(1)、先安装pcre-devel包,yum安装即可:
# yum -y install pcre-devel
(2)、找到pkgconfig并导入:
# find / -name pkgconfig
/usr/share/pkgconfig
/usr/lib64/pkgconfig
# export PKG_CONFIG_PATH=/usr/lib64/pkgconfig
# ./configure --prefix=/usr/local/varnish --enable-dependency-tracking
--enable-developer-warnings --enable-debugging-symbols
# make ; make install
../../lib/libvarnishapi/.libs/libvarnishapi.so: undefined reference to `pcre_free_study'
collect2: ld returned 1 exit status
make[3]: *** [varnishadm] Error 1
报上述错误,提示还是pcre的问题,解决办法:
(1)、删除pcre-devel包:
# yum erase pcre-devel
(2)、手动编译安装pcre-devel:
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
# tar xf pcre-8.36.tar.gz
# cd pcre-8.36
# ./configure --prefix=/usr/local/pcre
# make ; make install
(3)、找到pkgconfig并导入:
# find / -name pkgconfig
/usr/share/pkgconfig
/usr/local/varnish/lib/pkgconfig
/usr/local/pcre/lib/pkgconfig
/usr/lib64/pkgconfig
这次导入pcre安装目录下的pkgconfig:
# export PKG_CONFIG_PATH=/usr/local/pcre/lib/pkgconfig
# ./configure --prefix=/usr/local/varnish --enable-dependency-tracking
--enable-developer-warnings --enable-debugging-symbols
# make ; make install
安装完成。
安装总结:CentOS6.5编译安装varnish-3.0.3的依赖关系有:automake、libtool、pcre-devel.
二、编译安装varnish-3.0.6
编译安装varnish-3.0.6也需要automake、libtool、pcre-devel.
# wget https://repo.varnish-cache.org/source/varnish-3.0.6.tar.gz
# tar xf varnish-3.0.6.tar.gz
# cd varnish-3.0.6
# ./autogen.sh
# export PKG_CONFIG_PATH=/usr/local/pcre/lib/pkgconfig
# ./configure --prefix=/usr/local/varnish --enable-dependency-tracking
--enable-developer-warnings --enable-debugging-symbols
# make ; make install
varnishadm.c:48:33: error: editline/readline.h: No such file or directory
varnishadm.c: In function ?.li_write?.
varnishadm.c:76: warning: implicit declaration of function ?.l_callback_handler_remove?
varnishadm.c:76: warning: nested extern declaration of ?.l_callback_handler_remove?
varnishadm.c: In function ?.end_line?.
......中间略
make[2]: *** [varnishadm-varnishadm.o] Error 1
make[2]: Leaving directory `/root/varnish-3.0.6/bin/varnishadm'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/root/varnish-3.0.6/bin'
make: *** [install-recursive] Error 1
报上述错误,提示缺少readline,yum安装即可:
# yum -y install readline readline-devel
然后继续:
# make clean
# ./configure --prefix=/usr/local/varnish --enable-dependency-tracking
--enable-developer-warnings --enable-debugging-symbols
# make ; make install
安装完成
安装总结:CentOS6.5编译安装varnish-3.0.6的依赖关系有:automake、libtool、pcre-devel、readline、readline-devel.