Skip to content

Instantly share code, notes, and snippets.

@naxels
Created January 5, 2021 16:04
Show Gist options
  • Save naxels/a94714aedbc591362e72a366059875ec to your computer and use it in GitHub Desktop.
Save naxels/a94714aedbc591362e72a366059875ec to your computer and use it in GitHub Desktop.
HAProxy 2.3 setup CentOS 7
# assumes you have vim and wget installed
sudo su
cd ~
yum install gcc pcre-devel tar make openssl-devel systemd-devel -y
wget https://www.haproxy.org/download/2.3/src/haproxy-2.3.2.tar.gz -O ~/haproxy.tar.gz
tar xzvf ~/haproxy.tar.gz -C ~/
cd haproxy-2.3.2
make TARGET=linux-glibc USE_PCRE=1 USE_PCRE_JIT=1 USE_OPENSSL=1 USE_ZLIB=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 USE_SYSTEMD=1
make install
mkdir -p /etc/haproxy
mkdir -p /var/lib/haproxy
touch /var/lib/haproxy/stats
cd contrib/systemd
make
cp haproxy.service /etc/systemd/system
systemctl daemon-reload
systemctl enable haproxy
useradd -r haproxy
# open firewall ports
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --reload
## Config
# https://cbonte.github.io/haproxy-dconv/2.3/configuration.html
vim /etc/haproxy/haproxy.cfg
# copy/paste config (find online)
# and save :wq
systemctl start haproxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment