Rate This Document
Findability
Accuracy
Completeness
Readability

Installing Varnish by Using a Script

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

No

Varnish 6.5.1

No

No

No

  1. Obtain the Varnish one-click script and copy it to the /home directory.

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

  2. Go to the /home directory and decompress the script package.
    1
    cd /home/
    
    1
    tar -xzvf varnish_automation.tar.gz
    

  3. Go to the varnish_automation directory and view the files in the directory.
    1
    cd varnish_automation
    
    1
    ll
    

    Table 1 describes the script directory structure.

    Table 1 Script package

    Directory/File

    Description

    deps directory

    Directory used for compilation and installation.

    NOTE:

    The installer script obtains the Varnish source code using the wget command. If the server is not connected to the Internet, download the Varnish source code and Python 3.6.0 source code package (see Obtaining the Source Code and 2.a) and save them to this directory.

    scripts directory

    Directory in which the general tuning script, configuration optimization script, and the script for binding NIC interrupts to cores are stored.

    install.sh

    Script used to implement one-click compilation, deployment, and tuning of Varnish.

    rollback.sh

    Script used to roll back all operations performed by install.sh.

  4. Configure the network port.
    1. Modify the install.sh file.
      1
      vim install.sh
      
    2. Press i to enter the insert mode and enter the network port name eth0 and the corresponding IP address in the current environment.

      The parameters in the install.sh file are described as follows:

      eth0: name of the network port in the current environment. The GE NIC cannot be used. This parameter is mandatory.

      IP: IP address of the network port eth0. This parameter is mandatory.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. Run the install.sh script. After the script is executed, restart the device for the optimization to take effect.
    1
    sh install.sh
    

    The script contains general tuning. The software-based tuning needs to be performed based on actual situation.

  6. Modify the network port name in the startSquid.sh file to be the same as that in the install.sh file.
    1. Open the startVarnish.sh file in edit mode.
      1
      vim startVarnish.sh
      
    2. Press i to enter the insert mode and enter the network port name eth0 in the current environment, which is the same as the eth0 in the install.sh file.

      The parameter in the startVarnish.sh file is described as follows:

      eth0: name of the network port in the current environment. The GE NIC cannot be used. This parameter is mandatory. The value must be the same as that of eth0 in the install.sh file.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  7. Run the startVarnish.sh script to start the Varnish.
    1
    sh startVarnish.sh
    
  8. Check the Varnish process.
    1
    ps -ef | grep varnish
    

    • You can ignore Running and Verifying Varnish after performing step 8.
    • To roll back the deployment, run the rollback.sh script and restart the device.
      1
      sh rollback.sh