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 script used to deploy Varnish.
    1. Download the script package using the local browser.

      URL: https://mirrors.huaweicloud.com/kunpeng/archive/kunpeng_solution/web/Scripts/varnish_automation.tar.gz

    2. Copy varnish_automation.tar.gz 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 package.

    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
      vi install.sh
      
    2. Enter the network port name and IP address.

      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. Save and exit the install.sh script.
  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 install.sh file in edit mode.
      1
      vi startVarnish.sh
      
    2. Enter the network port name, which must be the same as the eth0 network port name 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. Save and exit the startVarnish.sh script.
  7. Run the startVarnish.sh script to start the Varnish.
    1
    sh startVarnish.sh
    
  8. Check the Varnish process.
    1
    ps -ef | grep varnish
    

    • After performing 8, you can skip Running and Verifying Varnish.
    • To roll back the deployment, run the rollback.sh script and restart the device.
      1
      sh rollback.sh