Download source code
wget https://repo.varnish-cache.org/source/varnish-4.0.3.tar.gz
Compile
> TAR-XZVF varnish-4.03.tar.gz
Enter the source directory
> SH autogen.sh
> Export pkg_config_path=/usr/local/lib/pkgconfig/
>./configure--prefix=/usr/local/varnish--enable-dependency-tracking--enable-debugging-symbols-- Enable-developer-warnings
> Make && make
* Libpcre errors and Libedit or readline errors may not be reported during the configure process. You may need to install Pcre and ReadLine separately. 8.0 or more versions of Pcre do not seem to support.
Test
Simply create a DEFAULT.VCL file
Backend default{
. host 127.0.0.1;
. port 8080;
}
Command line execution
>./varnishd-f. /etc/default.vcl-a 172.28.211.16:8080-s malloc,1g-f-u varnish-g Varnish
* Pay attention to first build a user varnish:varnish
Output information for success
Child (80451) Started
Child (80451) said child starts
4. Service Configuration
> CP varnish.initrc/etc/init.d/varnish
> CP varnish.sysconfig/etc/sysconfig/varnish
> CP VARNISH_RELOAD_VCL/USR/LOCAL/VARNISH/SBIN/VARNISH_RELOAD_VCL
Modify the/etc/init.d/varnish file, mainly speaking the correct path modification
Exec= "/usr/local/varnish/sbin/varnishd"
Reload_exec= "/USR/LOCAL/VARNISH/SBIN/VARNISH_RELOAD_VCL"
Prog= "Varnishd"
Config= "/etc/sysconfig/varnish"
Lockfile= "/var/lock/subsys/varnish"
Modify the/etc/sysconfig/varnish file
VARNISH_VCL_CONF=/USR/LOCAL/VARNISH/ETC/DEFAULT.VCL #/etc/varnish/default.vcl
Varnish_secret_file=/usr/local/varnish/etc/secret #etc/varnish/secret Source installation Without this file, you need to create a, fill in the key
Daemon_opts= "-A ${varnish_listen_address}:${varnish_listen_port} \
-F ${varnish_vcl_conf} \
-T ${varnish_admin_listen_address}:${varnish_admin_listen_port} \
-T ${varnish_ttl} \
-P thread_pool_min=${varnish_min_threads} \
-P thread_pool_max=${varnish_max_threads} \
-P thread_pool_timeout=${varnish_thread_timeout} \
- u varnish-g varnish \
-S ${varnish_secret_file} \
-S ${varnish_storage} "
> Service varnish start
In particular, if you are 64-bit Linux, do not install it in Yum mode.
SOURCE Varnish Installation