我要评分
获取效率
正确性
完整性
易理解

Compiling and Installing HAProxy from Source Code

  1. Obtain the HAProxy source code.
    1. Download the HAProxy source code package using a local browser.

      Download address: https://www.haproxy.org/download/1.9/src/haproxy-1.9.0.tar.gz

    2. Copy the source code to the /home directory on the server.

      If the server is connected to the Internet, you can run the wget command on the server to download the source code.

      1
      cd /home
      
      1
      wget https://www.haproxy.org/download/1.9/src/haproxy-1.9.0.tar.gz --no-check-certificate
      
  2. Switch to the home directory.
    1
    cd /home/
    
  3. Decompress the HAProxy package.
    1
    tar -xzvf haproxy-1.9.0.tar.gz
    

  4. Switch to the haproxy-1.9.0 directory.
    1
    cd /home/haproxy-1.9.0/
    
  5. Compile and install HAProxy.
    1
    make TARGET=linux41 && make install PREFIX=/usr/local/haproxy/
    

    PREFIX=PATH specifies the HAProxy installation directory.

  6. Create a folder in the HAProxy installation path for storing the configuration file.
    1
    mkdir -p /usr/local/haproxy/conf
    
  7. Copy the configuration file from the source code directory to the installation directory.
    1
    cp /home/haproxy-1.9.0/examples/*.cfg /usr/local/haproxy/conf/
    
  8. Check the installation directory.
    1
    ll /usr/local/haproxy