Installing HAProxy by Using a Script
- Obtain the HAProxy one-click script package and save 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.
1 2
cd /home/ tar -xzvf haproxy_automation.tar.gz

- Switch to the haproxy_automation directory and view the files in the directory.
1 2
cd haproxy_automation ll

Table 1 describes the script directory structure.
Table 1 haproxy_automation directory structure Folder or File
Description
deps
Directory used for compilation and installation.
NOTE:The installation script first obtains the HAProxy source code using the wget command. If the server is not connected to the Internet, download the HAProxy source code (see Compiling and Installing HAProxy from Source Code) and save the source code to this directory.
scripts
Folder in which common tuning scripts are stored.
install.sh
Script used to compile, deploy, and tune HAProxy.
rollback.sh
Script used to roll back all the operations performed by the script.
- Run the install.sh script. After the script is executed, restart the server for the tuning to take effect.
1sh install.sh
- The script contains only common tuning. Software tuning needs to be performed based on actual situation.
- (Optional) If the environment needs to be rolled back or the deployment using a script fails, run the rollback script to roll back the script operation and restart the device.
1sh rollback.sh
Parent topic: Installing HAProxy