安装2.0+版本
前期准备:
下载pcre
http://sourceforge.net/projects/pcre/files/pcre/
http://optimate.dl.sourceforge.net/project/pcre/pcre/7.9/pcre-7.9.tar.gz
下载varnish
https://www.varnish-cache.org/releases
http://repo.varnish-cache.org/source/varnish-2.1.2.tar.gz
建立 目录和存储文件目录
useradd -s /sbin/nologin varnish mkdir -p /wwwdata/varnish/cache mkdir -p /wwwdata/varnish/logchown -R varnish:varnish /wwwdata/varnish/cachechown -R varnish:varnish /wwwdata/varnish/log
安装pcre
cd /usr/local/src/
tar -zxvf pcre-7.9.tar.gz
cd pcre-7.9
./configure --prefix=/usr/local/pcre
make
make install
安装varnish
cd /usr/local/src/
tar -zxvf varnish-2.1.2.tar.gz
cd varnish-2.1.2 export PKG_CONFIG_PATH=/usr/local/pcre/lib/pkgconfig/./configure --prefix=/usr/local/varnish/ \
--enable-dependency-tracking \
--enable-debugging-symbols \
--enable-developer-warnings \
make
make install
至此安装完成,
备注:我试过安装最新版,没有安装成功,全部卸载后从新安装此版本可以安装成功!~
安装3.0+版本
yum install -y automake autoconf libtool ncurses-devel libxslt groff pcre-devel pkgconfig
rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release/varnish-release-3.0-1.noarch.rpm
yum install varnish
varnish的启动
#启动varnish
varnishd -f /etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:3500 -a 0.0.0.0:80
service varnish restart