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 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.
- 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 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.
- Configure the network port.
- Modify the install.sh file.
1vim install.sh - 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.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- 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 startVarnish.sh file in edit mode.
1vim startVarnish.sh - 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.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the startVarnish.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

- 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.
1sh rollback.sh