# varnish Basic
# 从epel仓库中安装
yum install epel-release -y
yum install varnish
2
epel仓库中的varnish版本为4.0.5
,截止目前,官方最新版本为6.4.0
# 从官方仓库中安装较新版本
以5.2.0
版本为例
curl -s https://packagecloud.io/install/repositories/varnishcache/varnish52/script.rpm.sh | sudo bash
yum install -y varnish
2
# 编译安装
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-sphinx
2
3
4
5
6
7
8
9
10
11
12
Optionally, to rebuild the svg files:
yum install graphviz
Optionally, to pull from a repository:
yum install git
- The configuration will need the dependencies above satisfied. Once that is taken care of:
cd varnish-cache
sh autogen.sh
sh configure
make
2
3
4
The 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