5

Where can I find official documentation on HAproxy 2x installation documentation for Centos 7?

$ yum install haproxy
$ haproxy -v
HA-Proxy version 1.5.18 2016/05/10
Copyright 2000-2016 Willy Tarreau <[email protected]>

$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

I would like to not run an outdated, potentially insecure version of the product.

5 Answers 5

2

HAProxy from the repo is unlikely to be insecure as long as CentOS7 is supported, but yes, the 1.5 version is outdated functionality-wise.

From what I see, only modern Fedora versions have more modern versions of HAProxy in their official repositories. If you purchase a commercial version of HAProxy it looks as though there's a RHEL/CentOS compatible repository supported directly by the HAProxy people. Otherwise you may actually have to compile and roll your own packages for your environment.

If running another distro is a possible workaround, the most user-friendly effort for the community version of HAProxy seems to exist on the Debian and Ubuntu side of things: https://haproxy.debian.net/

1
  • 1
    Fedora EPEL also provides a more modern version of HAProxy for CentOS/RHEL 7, even HAProxy 1.8 offered there is too old to satisfy the initial request.
    – rsc
    Sep 28, 2023 at 0:19
4

I was able to install the latest version HAProxy 2.4.2 (LTS) on CentOS 7 by executing the steps from this blog, Here they are in case the link goes down, I've modified them a bit because the blog talks about 2.0 version while I needed the latest:

Steps

Choose the haproxy branch

The 1st step defines the branch you are going to install, If you want latest of 2.0 just modify the URL to the branch you want, you'll have to repeat that change in every step you see an URL:

LATEST_HAPROXY=$(wget -qO-  http://www.haproxy.org/download/2.4/src/ | egrep -o "haproxy-2\.[0-9]+\.[0-9]+" | head -1)
Download and install the package:
cd /usr/src/
wget http://www.haproxy.org/download/2.4/src/${LATEST_HAPROXY}.tar.gz
tar xzvf ${LATEST_HAPROXY}.tar.gz
yum install gcc-c++ openssl-devel pcre-static pcre-devel systemd-devel -y
cd /usr/src/${LATEST_HAPROXY}
make TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 USE_SYSTEMD=1
mkdir /etc/haproxy
make install
Create a systemd service /usr/lib/systemd/system/haproxy.service
cat > /usr/lib/systemd/system/haproxy.service << 'EOL'
   
    [Unit]
    Description=HAProxy Load Balancer
    After=syslog.target network.target
    
    
    [Service]
    Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/haproxy.pid"
    ExecStartPre=/usr/local/sbin/haproxy -f $CONFIG -c -q
    ExecStart=/usr/local/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE
    ExecReload=/usr/local/sbin/haproxy -f $CONFIG -c -q
    ExecReload=/bin/kill -USR2 $MAINPID
    KillMode=mixed
    Restart=always
    SuccessExitStatus=143
    Type=notify
    
    
    [Install]
    WantedBy=multi-user.target
EOL
Create /etc/haproxy/haproxy.cfg
cat > /etc/haproxy/haproxy.cfg << 'EOL'

    global
     log /dev/log local0
     log /dev/log local1 notice
     daemon
    
    
    defaults
     log global
     option dontlognull
     timeout connect 50000
     timeout client  50000
     timeout server  50000
    
    
    listen ListenName
            bind *:80
            mode tcp
            server YourServer 127.0.0.1:80
EOL
Restart HAProxy and verify bash
systemctl start haproxy
systemctl status haproxy
3

Found this project on github, if you need to produce RPMs of the latest haproxy versions.

https://github.com/DBezemer/rpm-haproxy

Steps

Install dev dependencies.

sudo yum groupinstall 'Development Tools'

Checkout the repo and switch to the branch for the version you want.

cd /opt
git clone https://github.com/DBezemer/rpm-haproxy.git 
cd ./rpm-haproxy
git checkout 2.4

Build the RPMS

make

Resulting RPMs will be in ./RPMS/

Update your version by running

sudo rpm -U haproxy-2.4.9-1.amzn1.x86_64.rpm
1
2

You can install the latest from: http://au1.mirror.crc.id.au/repo/el7-extra/x86_64/

puppet example:

    yumrepo { "haproxy-repo":
        baseurl => "http://au1.mirror.crc.id.au/repo/el7-extra/x86_64/",
        gpgkey => "http://au1.mirror.crc.id.au/repo/RPM-GPG-KEY-kernel-xen",
        descr => "haproxy",
        enabled => 1,
        gpgcheck => 1
    }
0

Until the instructions for HAProxy 2.0 are available, you can install HAProxy 1.8 by following the instructions at this url: https://www.softwarecollections.org/en/scls/rhscl/rh-haproxy18/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .