Release date: June 6th 2022
Welcome to my HAProxy Upgrade section. As HAProxy releases new version every now and then, I need to upgrade my installations as well. The newest Long Term supported version was released on May 31 2022. To review current versions, check out HAProxy The Reliable, High Performance TCP/HTTP Load Balancer
As always, before I do an upgrade, I make sure to have a good working backup or at least a current snapshot of my server
First, I add the repository
sudo add-apt-repository ppa:vbernat/haproxy-2.6 HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for web sites crawling under very high loads while needing persistence or Layer7 processing. Supporting tens of thousands of connections is clearly realistic with todays hardware. Its mode of operation makes its integration into existing architectures very easy and riskless, while still offering the possibility not to expose fragile web servers to the Net. This PPA contains packages for HAProxy 2.6. More info: https://launchpad.net/~vbernat/+archive/ubuntu/haproxy-2.6 Press [ENTER] to continue or Ctrl-c to cancel adding it. Hit:1 http://no.archive.ubuntu.com/ubuntu focal InRelease Hit:2 http://no.archive.ubuntu.com/ubuntu focal-updates InRelease Hit:3 http://no.archive.ubuntu.com/ubuntu focal-backports InRelease Hit:4 http://no.archive.ubuntu.com/ubuntu focal-security InRelease Hit:5 http://ppa.launchpad.net/vbernat/haproxy-2.3/ubuntu focal InRelease Get:6 http://ppa.launchpad.net/vbernat/haproxy-2.6/ubuntu focal InRelease [23.8 kB] Get:7 http://ppa.launchpad.net/vbernat/haproxy-2.6/ubuntu focal/main amd64 Packages [1,004 B] Get:8 http://ppa.launchpad.net/vbernat/haproxy-2.6/ubuntu focal/main Translation-en [704 B] Fetched 25.5 kB in 1s (39.1 kB/s) Reading package lists... Done
Next, I do the actual upgrade. When the upgrader asks about replacing my haproxy.cfg-file, I make sure to answer NO.
sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages have been kept back: fwupd The following packages will be upgraded: haproxy 1 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. Need to get 1,672 kB of archives. After this operation, 92.2 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://ppa.launchpad.net/vbernat/haproxy-2.6/ubuntu focal/main amd64 haproxy amd64 2.6.0-1ppa1~focal [1,672 kB] Fetched 1,672 kB in 1s (2,261 kB/s) (Reading database ... 109251 files and directories currently installed.) Preparing to unpack .../haproxy_2.6.0-1ppa1~focal_amd64.deb ... Unpacking haproxy (2.6.0-1ppa1~focal) over (2.3.20-1ppa1~focal) ... Setting up haproxy (2.6.0-1ppa1~focal) ... Configuration file '/etc/haproxy/haproxy.cfg' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version. *** haproxy.cfg (Y/I/N/O/D/Z) [default=N] ? Processing triggers for man-db (2.9.1-1) ... Processing triggers for rsyslog (8.2001.0-1ubuntu1.3) ... Processing triggers for systemd (245.4-4ubuntu3.17) ...
Finally I restart the HAProxy service
sudo service haproxy restart
Disclaimer: Every tips/tricks/posting I have published here, is tried and tested in different it-solutions. It is not guaranteed to work everywhere, but is meant as a tip for other users out there. Remember, Google is your friend and don’t be afraid to steal with pride! Feel free to comment below as needed.