Rate This Document
Findability
Accuracy
Completeness
Readability

Installing HAProxy by Using a Script

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

  2. Go to the /home directory and decompress the script package.
    1
    2
    cd /home/
    tar -xzvf haproxy_automation.tar.gz
    

  3. 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.

  4. Run the install.sh script. After the script is executed, restart the server for the tuning to take effect.
    1
    sh 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.
      1
      sh rollback.sh