上传文件到/usr/local目录下
# yum install gawk* gcc gcc-c++ libstdc++-devel httpd-devel pcre perl pcre-devel zlib zlib-devel GeoIP GeoIP-devel automake autoconf libtool ncurses-devel libxslt groff pcre-devel pkgconfig libedit libedit-devel docutils –y
# yum -y install gcc* gawk* make libbz*
#tar zxvf pcre-8.31.tar.gz
#mv pcre-7.9/ pcre
#cd pcre
#./configure --prefix=/usr/local/pcre/
#make && make install
#tar –vxzf varnish-3.0.3.tar.gz
# mv varnish-3.0.3 varnish
#cd varnish
# ./autogen.sh
//此处红色,路径极为重要
# ./configure --prefix=/opt/varnish PKG_CONFIG_PATH=/usr/lib/pkgconfig
# make
# make install
# cd /opt/varnish/sbin
# ./varnishd -V
查看版本,看是否安装成功
测试varnish
先编辑配置文件
# vi /opt /varnish/etc/varnish/default.vcl
#
/opt/varnish/sbin/varnishd -f /opt/varnish/etc/varnish/default.vcl -s
malloc,256m -T 127.0.0.1:200 -a 0.0.0.0:80