HTTP加速器varnish安装小记(1)

时间:2022-05-05
本文章向大家介绍HTTP加速器varnish安装小记(1),主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

上午共享的那个varnish 安装手册,个人看了下,有点不知所云,好吧~看来还是先安装玩玩!

苦逼公司服务器没法连外网,不能用什么 wget 或 yum 命令直接下载安装,每每看到别人博客贴出的在线安装代码时,总有一股羡慕嫉妒“恨”冒了出来。。。好吧,既然没法上外网,那只能麻烦点通过下载源码来编译安装了!

Varnish 3.0.4 下载地址: http://repo.varnish-cache.org/source/varnish-3.0.4.tar.gz

开始安装:

tar zxvf varnish-3.0.4.tar.gz   
cd varnish-3.0.4  
./configure --prefix=/usr/local/src/varnish/   
make && make install

发现到第三步时,报如下错误:

checking for PCRE... no   
  
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.

经验告诉我,看到 pcre 字眼,就立即想到了是不是要安装支持正则表达式的 pcre 8??于是又找到 pcre8 开始安装:

unzip pcre-8.30.zip   
cd pcre-8.30     
./configure && make && make install

完了之后,继续安装 varnish,依然报同样的错!在参数中加入--with-pcre-config=/path/ 重试,依然。。。

看来不是 pcre 8 的问题了,在百思不得其解时,我打开了 RedHat 的软件包,搜了一下 pcre 关键字,结果发现还有个名为 pcre-devel-6.6-2.el5_1.7.x86_64.rpm 的软件包,好吧,就尝试安装一下看看:

[root@TEST-HOST ~]# rpm -ivh pcre-devel-6.6-2.el5_1.7.x86_64.rpm    
warning: pcre-devel-6.6-2.el5_1.7.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186  
Preparing...                ########################################### [100%]   
   1:pcre-devel             ########################################### [100%]

安装完成后,继续编译 varnish,发现没报错了!我勒个去,还真是少了这个软件包的支持,编译的安装方式就是麻烦,要是 rpm 包的话,直接就会报缺少依赖包的错误了,也不会走那么多弯路!不过也好,至少又涨了一点经验值。