Linux

How to Install HAProxy 2.x (latest stable) on almalinux

HAProxy is a powerful open-source load balancer and reverse proxy that provides high availability, SSL termination, traffic routing, and advanced health checks for modern web applications.

HAProxy (High Availability Proxy) is a fast, reliable load balancer and reverse proxy used to distribute traffic across multiple servers.

It is commonly used in:

  • Web servers (Apache, Nginx, Node.js…)

  • API servers

  • Microservices

  • Cloud and container environments (Docker, Kubernetes)

Key Features

  • Load balancing (Round Robin, Least Connection, IP hashing…)

  • High availability (failover, health-checks)

  • SSL termination

  • Rate limiting + DDOS protection

  • Reverse proxy

  • Very high performance (used by GitHub, Reddit, Airbnb…)

Install HAProxy 2.x on CentOS / Rocky / AlmaLinux

Step 1 — Enable EPEL + HAProxy repo

sudo yum install epel-release
sudo yum install https://repo.ius.io/ius-release-el7.rpm

Step 2 — Install HAProxy

sudo yum install haproxy2

Step 3 — Check version

haproxy -v

Basic HAProxy Configuration Example

Edit:

/etc/haproxy/haproxy.cfg

Example load balancer for two web servers:

frontend http_front
    bind *:80
    mode http
    default_backend http_back

backend http_back
    mode http
    balance roundrobin
    server web1 192.168.1.10:80 check
    server web2 192.168.1.11:80 check

Then restart:

sudo systemctl restart haproxy
sudo systemctl enable haproxy

Thanks for visit my website