Installing Squid by Using a Script
- Obtain the Squid one-click script and copy it to the /home directory.
If the server can access 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.
1 2
cd /home/ tar -xzvf squid_automation.tar.gz

- Go to the squid_automation directory and query the files in the directory.
1 2
cd squid_automation ll

Table 1 describes the script directory structure.
Table 1 Overall script directory structure Folder or File
Description
deps folder
Directory used for compilation and installation
NOTE:The installer script downloads the Squid source code using the wget command. If the server is not connected to the Internet, download the Squid source code (see Installing Squid by Compiling the Source Code) and save it to this directory.
scripts folder
Optimization script directory, which contains the common optimization script, configuration optimization script, and the script for binding NIC interrupts to cores.
install.sh
Script used to implement one-click compilation, deployment, and tuning.
rollback.sh
Rollback script, which is used to roll back all operations of the script.
- 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="": communication network port name. This parameter is mandatory.
- IP="": IP address of the communication 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 common optimization. The software optimization needs to be adjusted based on your requirements.
- Modify the network port name in the startSquid.sh file to be the same as that in the install.sh file.
- Edit the startSquid.sh file.
1vim startSquid.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 parameters in the startSquid.sh file are described as follows:
eth0: name of the communication network port in the current environment. The GE NIC cannot be used. This parameter is mandatory. The value is the same as eth0 in the install.sh file.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Edit the startSquid.sh file.
- Run the startSquid.sh script to start Squid.
1sh startSquid.sh
- Check the Squid process.
1ps -ef | grep squid
- You can ignore steps in Running and Verifying Squid after performing step 8.
- Optional: To roll back the deployment, run the rollback.sh script and restart the device.
1sh rollback.sh