How To Install haproxy on CentOS 7
Introduction
In this tutorial we learn how to install haproxy on CentOS 7.
What is haproxy
HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments. Indeed, it can - route HTTP requests depending on statically assigned cookies - spread load among several servers while assuring server persistence through the use of HTTP cookies - switch to backup servers in the event a main server fails - accept connections to special ports dedicated to service monitoring - stop accepting connections without breaking existing ones - add, modify, and delete HTTP headers in both directions - block requests matching particular patterns - report detailed status to authenticated users from a URI intercepted by the application
We can use yum or dnf to install haproxy on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install haproxy.
Install haproxy on CentOS 7 Using yum
Update yum database with yum using the following command.
sudo yum makecache
After updating yum database, We can install haproxy using yum by running the following command:
sudo yum -y install haproxy
Install haproxy on CentOS 7 Using dnf
If you don’t have dnf installed you can install DNF on CentOS 7 first.
Update yum database with dnf using the following command.
sudo dnf makecache
After updating yum database, We can install haproxy using dnf by running the following command:
sudo dnf -y install haproxy
How To Uninstall haproxy on CentOS 7
To uninstall only the haproxy package we can use the following command:
sudo dnf remove haproxy
References
Summary
In this tutorial we learn how to install haproxy on CentOS 7 using yum and dnf.