How To Install HAProxy on CentOS 7

Install HAProxy on CentOS 7

In this tutorial we will show you how to install and configuration of HAProxy on your CentOS 7 server. For those of you who didn’t know, HAProxy is a free HTTP/TCP high availability load balancer and proxy server. It spreads requests among multiple servers to mitigate issues resulting from single server failure. HA Proxy is used by a number of high-profile websites including GitHub, Bitbucket, Stack Overflow, Reddit, Tumblr, Twitter and Tuenti and is used in the OpsWorks product from Amazon Web Services.

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 through the step by step installation HAProxy on a CentOS 7 server.

Install HAProxy on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

Step 2. Installing HAProxy.

HAProxy package is by default  available in CentOs and RHEL Repositories. We can install it by using the yum command as follows:

Step 3. Configuring HAProxy.

We have to modify the configuraion file of haproxy i.e. /etc/haproxy/haproxy.cfg as per our requirement. (Change this configuration as your network requirements). For more configuration details check this url.

Once you have configured HAProxy, its time to start the service:

Step 4. Accessing HAProxy.

HAProxy will be available on HTTP port 8980 by default. Open your favorite browser and navigate to or http://server-ip:31337. It will ask you for the username and password. Use the username and password you defined on the configuraion file as “stats auth”. If you are using a firewall, please open port 31337 to enable access to the control panel.

Congratulation’s! You have successfully installed HAProxy. Thanks for using this tutorial for installing HAProxy on your CentOS 7 system. For additional help or useful information, we recommend you to check the official HAProxy web site.

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 a best deal!