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 |
- Obtain the script used to deploy Varnish.
- Download the script package using the local browser.
URL: https://mirrors.huaweicloud.com/kunpeng/archive/kunpeng_solution/web/Scripts/varnish_automation.tar.gz
- 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.
- Download the script package using the local browser.
- Go to the /home directory and decompress the script package.
1cd /home/
1tar -xzvf varnish_automation.tar.gz

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

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.
- Configure the network port.
- Modify the install.sh file.
1vi install.sh - 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.
- Save and exit the install.sh script.
- Modify the install.sh file.
- Run the install.sh script. After the script is executed, restart the device for the optimization to take effect.
1sh install.sh
The script contains general tuning. The software-based tuning needs to be performed based on actual situation.
- Modify the network port name in the startSquid.sh file to be the same as that in the install.sh file.
- Open the install.sh file in edit mode.
1vi startVarnish.sh - 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.
- Save and exit the startVarnish.sh script.
- Open the install.sh file in edit mode.
- Run the startVarnish.sh script to start the Varnish.
1sh startVarnish.sh - Check the Varnish process.
1ps -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.
1sh rollback.sh