varnish安装

系统环境CentOS7.3

第一种方法最简单:yum安装

本身使用的base源并没有varnish的yum包,但是

EPEL源上是有的,如果想YUM安装的话直接切换成EPEL源即可

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -ivh epel-release-latest-7.noarch.rpm

yum repolist varnish

第二种方式源码编译

这里主要记录一下varnish源码编译安装时候缺少的各种包及相关报错信息。

需要在安装varnish之前,安装的各种包

  • autoconf
  • automake
  • jemalloc-devel
  • libedit-devel
  • libtool
  • ncurses-devel
  • pcre-devel
  • pkgconfig
  • python-docutils
  • python-sphinx
  • graphviz

缺少python-docutils

checking for rst2man... no
checking for rst2man.py... no
configure: error: rst2man is needed to build Varnish, please install python-docutils.

缺少ncurses-devel

checking for NcursesW wide-character library... no
checking for Ncurses library... no
checking for Curses library... no
configure: error: requires an X/Open-compatible Curses library

缺少libedit-devel

checking edit/readline/readline.h usability... no
checking edit/readline/readline.h presence... no
checking for edit/readline/readline.h... no
checking for LIBEDIT... no
checking for a readline compatible library... no
configure: error: neither libedit nor another readline compatible library found

yum inistall python-docutils ncurses-devel libedit-devel

 ./configure --prefix=/var/varnish/

make && make install

编译安装完毕后程序所在位置:

/var/varnish/sbin/varnishd

/var/varnish/bin/

varnishadm  varnishhist  varnishlog  varnishncsa  varnishstat  varnishtest  varnishtop

如果在configure的时候不配置路径的话默认会安装在:

/usr/local

/usr/local/sbin/varnishd

/usr/local/bin/

配置文件位置:

需要自己cp一个初始文件或者自己创建一个

mkdir /etc/varnish/ || cp ./etc/example.vcl /etc/varnish/default.vcl

注:这个配置文件里默认定义的后端服务器

    backend default {
       .host = "127.0.0.1";
       .port = "8111";
     }

最后执行:

varnishd  -f /etc/varnish/default.vcl -a :6081 -T localhost:6082

就可以工作了。当然还有很多参数并没有设定。

猜你喜欢

转载自www.cnblogs.com/colinshi/p/8990938.html