varnish Basic
varnish Basic
从epel仓库中安装
yum install epel-release -yyum install varnishepel仓库中的varnish版本为4.0.5,截止目前,官方最新版本为6.4.0
从官方仓库中安装较新版本
以5.2.0版本为例
curl -s https://packagecloud.io/install/repositories/varnishcache/varnish52/script.rpm.sh | sudo bashyum install -y varnish编译安装
-
Download the appropriate release tarball, which you can find on https://varnish-cache.org/releases/ .
-
To build Varnish on a Red Hat or CentOS system, this command should install required packages (replace sudo yum install if needed):
sudo yum install \ make \ autoconf \ automake \ jemalloc-devel \ libedit-devel \ libtool \ ncurses-devel \ pcre-devel \ pkgconfig \ python-docutils \ python-sphinxOptionally, to rebuild the svg files:
yum install graphvizOptionally, to pull from a repository:
yum install git- The configuration will need the dependencies above satisfied. Once that is taken care of:
cd varnish-cachesh autogen.shsh configuremakeThe configure script takes some arguments, but more likely than not you can forget about that for now, almost everything in Varnish can be tweaked with run time parameters.
- Before you install, you may want to run the test suite, make a cup of tea while it runs, it usually takes a couple of minutes:
make check- And finally, the true test of a brave heart:
sudo make install
Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd. To make sure that the necessary links and caches of the most recent shared libraries are found, run sudo ldconfig.
启动
使用systemctl start varnish即可,手动启动使用一下命令:
varnishd -a :6081 -T localhost:6082 -b localhost:8080