FedoraRHEL Based

How To Install HAProxy on Fedora 39

Install HAProxy on Fedora 39

In this tutorial, we will show you how to install HAProxy on Fedora 39. HAProxy, a high-performance and highly robust load balancer, is renowned for its ability to distribute web traffic across multiple servers. This open-source software solution is a favorite among system administrators and DevOps professionals, thanks to its versatility and reliability in handling vast amounts of traffic. By ensuring that no single server bears an excessive load, HAProxy optimizes server resource utilization, enhances website speed, and improves overall user experience.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the HAProxy High-Performance TCP/HTTP Load Balancer on a Fedora 39.


Before diving into the installation process, let’s ensure that you have everything you need:

  • A server running one of the following operating systems: Fedora 39.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora 39 provides the Terminal application for this purpose. It can be found in your Applications menu.
  • A network connection or internet access to download the HAProxy packages.
  • You should also have a user account with sudo privileges to execute administrative commands.

Install HAProxy on Fedora 39

Step 1. Keeping your system updated is a fundamental best practice in system administration. It ensures that you have the latest security patches, bug fixes, and software versions, providing a stable base for any new software installations. To update your Fedora system, open your terminal and type the following command:

sudo dnf clean all
sudo dnf update

Step 2. Installing HAProxy on Fedora 39.

With your system updated, you’re now ready to install HAProxy. Fedora repositories conveniently provide the HAProxy package, simplifying the installation process. To install HAProxy, use the following command:

sudo dnf install haproxy

To ensure that HAProxy has been installed correctly and is running as expected, use the following command:

sudo systemctl status haproxy

This command checks the status of the HAProxy service. If the installation was successful, you should see an active status indicating that HAProxy is running.

Step 3. Configure HAProxy

The behavior of HAProxy is determined by its configuration file, which is located at /etc/haproxy/haproxy.cfg. This file defines the rules for how HAProxy should handle incoming traffic and distribute it among your servers. To open this file for editing, use the following command:

sudo nano /etc/haproxy/haproxy.cfg

In the configuration file, you’ll define the frontend and the backend. The frontend is the interface that receives client connections, while the backend is the set of servers to which HAProxy distributes traffic.

For a simple round-robin load-balancing setup, you can use the following configuration:

frontend http-in
    bind *:80
    default_backend backend_servers

backend backend_servers
    balance roundrobin
    server server1 :80 check
    server server2 :80 check

In this configuration, replace <server1-ip> and <server2-ip> with the IP addresses of your backend servers. The check option enables health checks on the servers, ensuring that they are available to receive traffic.

After configuring HAProxy, you need to enable it to start on boot and start the service. This ensures that HAProxy is always running, even after a system reboot. Use the following commands to enable and start HAProxy:

sudo systemctl enable haproxy
sudo systemctl start haproxy

Step 4. Configure Firewall Rules

If you’re running a firewall on your Fedora system, you need to configure it to allow incoming connections to HAProxy. This is crucial for HAProxy to function correctly as a load balancer and proxy server. The following commands allow HTTP traffic through the firewall:

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload

Step 5. Verify HAProxy Setup.

After setting up HAProxy, it’s important to verify that it’s working as expected. You can do this by sending a request to the IP address or domain name of your HAProxy server using a web browser or a tool like curl.

If HAProxy is correctly distributing traffic to your backend servers, you should receive a response from one of your servers.

Congratulations! You have successfully installed HAProxy. Thanks for using this tutorial for installing HAProxy on your Fedora 39 system. For additional or useful information, we recommend you check the official HAProxy website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button