Skip to content

Instantly share code, notes, and snippets.

@barankaynak
Forked from ryzy/a.sh
Last active September 7, 2017 20:35
Show Gist options
  • Save barankaynak/0439faf5fc591e1194248b4e8cd0ac93 to your computer and use it in GitHub Desktop.
Save barankaynak/0439faf5fc591e1194248b4e8cd0ac93 to your computer and use it in GitHub Desktop.
Compile OpenSSL 1.0.2 and HAProxy from the source on CentOS 7
# make sure you have these installed
yum install -y make gcc perl pcre-devel pcre-static zlib-devel
# Compile and install OpenSSL - via https://github.com/haproxy/haproxy/blob/master/README
wget -O /tmp/openssl.tgz https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz
tar -zxf /tmp/openssl.tgz -C /tmp
cd /tmp/openssl-*
./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib no-shared zlib-dynamic
make
make install_sw
# Compile and install HAProxy
wget -O /tmp/haproxy.tgz https://www.haproxy.org/download/1.7/src/haproxy-1.7.8.tar.gz
tar -zxvf /tmp/haproxy.tgz -C /tmp
cd /tmp/haproxy-1.7.8
make \
TARGET=linux2628 USE_LINUX_TPROXY=1 USE_ZLIB=1 USE_REGPARM=1 USE_PCRE=1 USE_PCRE_JIT=1 \
USE_OPENSSL=1 SSL_INC=/usr/include SSL_LIB=/usr/lib ADDLIB=-ldl \
CFLAGS="-O2 -g -fno-strict-aliasing -DTCP_USER_TIMEOUT=18"
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 /tmp/haproxy-1.7.8/examples/haproxy.init /etc/init.d/haproxy
sudo chmod 755 /etc/init.d/haproxy
sudo systemctl daemon-reload
sudo useradd -r haproxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment