Varnish是一款高性能的开源HTTP加速器

# 关闭防火墙、修改 seLinux 
[root@aliyun ~]# systemctl stop firewalld.service 
[root@aliyun ~]# setenforce 0
#安装所需依赖
[root@aliyun ~]# yum -y install autoconf.noarch automake.noarch jemalloc-devel.x86_64 libedit-devel.x86_64 libtool.x86_64 ncurses-devel.x86_64 pcre-devel.x86_64 pkgconfig.x86_64 python-docutils.noarch python-sphinx.noarch graphviz.x86_64
Loaded plugins: fastestmirror
Determining fastest mirrors
……
Complete!
#上传源码包
[root@aliyun ~]# mkdir varnish
[root@aliyun ~]# cd varnish
[root@aliyun varnish]# rz
[root@aliyun varnish]# ls
varnish-6.3.2.tgz
#查看源码包的类型
[root@aliyun varnish]# file varnish-6.3.2.tgz 
varnish-6.3.2.tgz: gzip compressed data, from Unix, last modified: Fri Jan 31 20:27:18 2020, max compression
#解压
[root@aliyun varnish]#gunzip varnish-6.3.2.tgz 
[root@aliyun varnish]# ls
varnish-6.3.2
#进入varnish
[root@aliyun varnish]# cd varnish-6.3.2/
[root@aliyun varnish-6.3.2]# ll
total 948
-rw-r--r--.  1 1000 1000  63162 Jan 31 20:21 aclocal.m4
-rwxr-xr-x.  1 1000 1000    849 Dec 17 17:50 autogen.sh
drwxr-xr-x. 10 1000 1000    190 Jan 31 20:27 bin
drwxr-xr-x.  2 1000 1000    143 Jan 31 20:27 build-aux
-rw-r--r--.  1 1000 1000     95 Aug  2  2017 ChangeLog
-rw-r--r--.  1 1000 1000   8270 Jan 31 20:13 config.h.in
-rwxr-xr-x.  1 1000 1000 761298 Jan 31 20:21 configure
……
#有两个可执行文件(autogen.sh、configure),先进行预编译
[root@aliyun varnish-6.3.2]# ./autogen.sh 
+ libtoolize --copy --force
……
lib/libvmod_debug/Makefile.am:9:   'lib/libvmod_debug/automake_boilerplate.am' included from here
+ autoconf

注意需要python 3.4以上版本,否则编译不成功

[root@aliyun varnish-6.3.2]# python -V
Python 3.7.3
#进行编译安装
[root@aliyun varnish-6.3.2]# ./configure --prefix=/usr/local/varnish
checking for gcc... gcc
……
checking for a Python interpreter with version >= 3.4... none
configure: error: Python >= 3.4 is required.
[root@aliyun varnish-6.3.2]# make
make  all-recursive
make[1]: Entering directory `/opt/varnish/varnish-6.3.2'
Making all in include
……
ModuleNotFoundError: No module named 'docutils'
make[2]: *** [vsl.7] Error 1
make[2]: Leaving directory `/opt/varnish/varnish-6.3.2/man'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/varnish/varnish-6.3.2'
make: *** [all] Error 2
#安装
[root@aliyun varnish-6.3.2]# pip install docutils
Collecting docutils
  Downloading https://files.pythonhosted.org/packages/81/44/8a15e45ffa96e6cf82956dd8d7af9e666357e16b0d93b253903475ee947f/docutils-0.16-py2.py3-none-any.whl (548kB)
    100% |████████████████████████████████| 552kB 13kB/s 
Installing collected packages: docutils
Successfully installed docutils-0.16
#再次安装
[root@aliyun varnish-6.3.2]## make
make  all-recursive
make[1]: Entering directory `/opt/varnish/varnish-6.3.2'
Making all in include
……
make[2]: Leaving directory `/opt/varnish/varnish-6.3.2/man'
make[2]: Entering directory `/opt/varnish/varnish-6.3.2'
make[2]: Leaving directory `/opt/varnish/varnish-6.3.2'
make[1]: Leaving directory `/opt/varnish/varnish-6.3.2'
[root@aliyun varnish-6.3.2]# make install
Making install in include
make[1]: Entering directory `/opt/varnish/varnish-6.3.2/include'
make  install-am
……
make[2]: Leaving directory `/opt/varnish/varnish-6.3.2'
make[1]: Leaving directory `/opt/varnish/varnish-6.3.2'

安装完成,做软链接

[root@aliyun ~]# ln -s /usr/local/varnish/sbin/varnishd /usr/bin/varnishd

查看版本信息

[root@aliyun ~]# varnishd -V
varnishd (varnish-6.3.2 revision 6870fd661a2b42c2e8adad838b5d92a71f27dccd)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2019 Varnish Software AS

启动服务

[root@aliyun ~]# varnishd -a :6081 -T localhost:6802 -b localhost:8080
Debug: Version: varnish-6.3.2 revision 6870fd661a2b42c2e8adad838b5d92a71f27dccd
Debug: Platform: Linux,3.10.0-957.el7.x86_64,x86_64,-jnone,-sdefault,-sdefault,-hcritbit
Debug: Child (31574) Started

查看进程和端口

# 进程信息
[root@aliyun ~]# ps -ef |grep varnishd
root      31564      1  0 06:42 ?        00:00:00 varnishd -a :6081 -T localhost:6802 -b localhost:8080
root      31574  31564  0 06:42 ?        00:00:00 varnishd -a :6081 -T localhost:6802 -b localhost:8080
root      31795   7788  0 06:44 pts/0    00:00:00 grep --color=auto varnishd

# 端口信息
[root@aliyun ~]# ss -lntp |grep varnishd
LISTEN   0    10     127.0.0.1:6802    *:*    users:(("varnishd",pid=31564,fd=9))
LISTEN   0    128      *:6081       *:*       users:(("cache-main",pid=31574,fd=3),("varnishd",pid=31564,fd=3))
LISTEN   0    10       ::1:6802     :::*      users:(("varnishd",pid=31564,fd=8))
LISTEN   0    128      :::6081      :::*      users:(("cache-main",pid=31574,fd=5),("varnishd",pid=31564,fd=5))
GitHub 加速计划 / li / linux-dash
6
1
下载
A beautiful web dashboard for Linux
最近提交(Master分支:3 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐