# Creating a new Loadbalancer

# Installation of haproxy

sudo apt update
sudo apt install --no-install-recommends software-properties-common
sudo add-apt-repository ppa:vbernat/haproxy-2.4 -y
sudo apt install haproxy=2.4.\*

HAProxy version should be 2.4

haproxy -v

Create a backup copy of haproxy.cfg

mv /etc/haproxy/haproxy.cfg{,.original}
mkdir /etc/letsencrypt
mkdir /etc/letsencrypt/live
mkdir /etc/haproxy/maps

Then go to the KhaCloud's servers section and insert the haproxy configurations to the new created loadbalancer (You will usually copy the same configurations from another loadbalancer)


To test a specific haproxy configuration without crashing the running version run

haproxy -f /etc/haproxy/haproxy.cfg -c