HAProxy 2.4.15 Guide

https://cbonte.github.io/haproxy-dconv/2.4/intro.html

1. Install Required Packages

apt-get install -y build-essential libssl-dev libpcre2-dev libpcre3-dev libsystemd-dev zlib1g-dev

2. Download and Extract Source Code

wget http://www.haproxy.org/download/2.4/src/haproxy-2.4.15.tar.gz
tar -xvzf haproxy-2.4.15.tar.gz

3. Install HAProxy

cd haproxy.2.4.15
make TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1
make install

4. Create HAProxy User and Group

groupadd –gid 980 haproxy
useradd –gid 980 –uid 980 -r haproxy

5. Create Directory and File

mkdir -p /etc/haproxy
touch /etc/haproxy/haproxy.cfg
chown -R haproxy:haproxy /etc/haproxy/
mkdir -p /var/lib/haproxy
touch /var/lib/haproxy/stats
chown -R haproxy:haproxy /var/lib/haproxy/
ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy

6. Create SystemD Unit File

cd /root/haproxy-2.4.15/admin/systemd/
make
cp haproxy.service /lib/systemd/system/

7. Daemon Reload and Configure HAProxy to Start at Boot

update-rc.d haproxy remove
systemctl daemon-reload
systemctl enable haproxy

8. Start HAProxy

systemctl start haproxy
systemctl status haproxy