How to install HAProxy on CentOS 7 Minimal

Fair comment. I didn’t have my notes on me at the time but will post them below now, might be of use to someone.

  1. Download the installation files and extract content.

    wget http://www.haproxy.org/download/1.8/src/haproxy-1.8.4.tar.gz
    mkdir haproxy
    tar xzvf haproxy-1.8.4.tar.gz -C haproxy
    cd haproxy/

  2. Install pre-requisites

yum install openssl-devel pcre-devel zlib-devel gcc

  1. Compile source

sudo make TARGET=linux2628 USE_OPENSSL=1 USE_PCRE=1 USE_ZLIB=1

  1. Install and complete installation

    sudo make install
    sudo mkdir -p /etc/haproxy
    sudo mkdir -p /var/lib/haproxy
    sudo touch /var/lib/haproxy/stats
    sudo ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy
    sudo cp examples/haproxy.init /etc/init.d/haproxy
    sudo chmod 755 /etc/init.d/haproxy
    sudo systemctl daemon-reload
    sudo chkconfig haproxy on
    sudo useradd -r haproxy

  2. Start HAProxy and Check the service status

    systemctl start haproxy
    systemctl status haproxy