Rate This Document
Findability
Accuracy
Completeness
Readability

Installing Varnish from the Source Code

Software Version

Whether to Support CentOS 7.6

Whether to Support CentOS 8.1

Whether to Support openEuler 20.03 (LTS-SP1)

Varnish 6.2.0

Yes

No

Yes

Varnish 6.5.1

No

Yes

No

In the following commands, x.x.x indicates the Varnish version.

Obtaining the Source Code

  1. Download the Varnish source code package using the local browser.
  2. Copy the source code to the /home directory on the server.

    If the server is connected to the Internet, you can run the wget command on the server to download the source code.

    1
    cd /home
    
    1
    wget https://varnish-cache.org/_downloads/varnish-x.x.x.tgz --no-check-certificate
    

Compiling and Installing Varnish

  1. Go to the home directory.
    1
    cd /home/
    
  2. Decompress the source code package.
    1
    tar -zxvf varnish-x.x.x.tgz
    
  3. Go to the source code directory.
    1
    cd /home/varnish-x.x.x/
    
  4. Perform automatic compilation.
    1
    sh autogen.sh
    
  5. Check the dependency.
    1
    ./configure --prefix=/usr/local/varnish
    

    --prefix=PATH: specifies the Varnish installation directory.

  6. Compile and install Varnish.
    1
    make -j60 && make install
    

Configuration File

  1. Create a folder in the Varnish installation path for storing the configuration file.
    1
    cd /usr/local/varnish &&  mkdir config
    
  2. Copy the configuration file to the config directory.
    1
    cp /usr/local/varnish/share/doc/varnish/example.vcl   /usr/local/varnish/config/default.vcl