Guides / Service Mesh & Networking

How to Install & Set Up HAProxy

Install HAProxy — the battle-tested TCP/HTTP load balancer — from the maintained PPA and wire up your first backend.

Updated 20264-step setupDownload HAProxy →

Prerequisites

  • ✓An Ubuntu/Debian host with sudo access
  • ✓Backend servers to load-balance

Install HAProxy on Ubuntu (maintained PPA, latest stable)

terminal
sudo add-apt-repository ppa:vbernat/haproxy-3.0
sudo apt update
sudo apt install -y haproxy

Install HAProxy on RHEL, CentOS Stream, or Fedora

HAProxy ships in the base/AppStream repos on RHEL-family distros, so no extra repo setup is needed — just a package name.

terminal
sudo dnf install -y haproxy
!

The dnf-provided version tends to lag behind the PPA's latest stable — if you need a specific newer HAProxy release on RHEL, build from source (see haproxy.org) or use their official container image instead.

Configure a simple HTTP frontend/backend

/etc/haproxy/haproxy.cfg (append)
frontend http_in
    bind *:80
    default_backend web_servers

backend web_servers
    balance roundrobin
    server web1 192.0.2.10:8080 check
    server web2 192.0.2.11:8080 check

Validate config and restart

terminal
haproxy -c -f /etc/haproxy/haproxy.cfg
sudo systemctl restart haproxy

Documentation & Knowledge Base

Official DocumentationHAProxy Documentation →Knowledge Base & CommunityHAProxy Community →
Download HAProxy— all versions & official links→

Related Guides

TraefikInstall guide →CaddyInstall guide →EnvoyInstall guide →

Need HAProxy deployed and managed for you?

We're OpenStack Dev — we design, deploy, and operate production DevOps infrastructure.

Get in TouchAll Install Guides