Following my earlier post using Vbernat’s PPA to install the latest Haproxy on Ubuntu, there have been several minor versions since the original post. The steps below will show you how to upgrade to any version offered by Vbernat’s PPA including the latest branch, 1.8 as of the time writing.
Check the version of Haproxy that’s currently installed as a note for step later on:
sudo haproxy -v
Go to Debian/Ubuntu HAProxy packages page and enter the relevant information. For example Ubuntu and 1.8.
This will list some command lines to run however you only need to use the information for reference although going through all the steps won’t hurt.
Add the selected PPA version. For example:
sudo add-apt-repository ppa:vbernat/haproxy-1.8
It will ask for confirmation to add this to the repository list. Press the Enter key to confirm (or Ctrl+C to cancel if you do not wish to continue).
Check for updates:
sudo apt update
At the end of this command it should automatically detect the newer version from the recently added PPA (Cool right!). Press ‘y’ and Enter to confirm the upgrade.
It may ask if you wish to overwrite the haproxy.cfg file. The changes will depend on the version you’re upgrading to. If you chose to install the maintainers version i.e the default then it will backup the current version to /etc/haproxy/haproxy.cfg.dpkg-old (recommended) and merge the differences).
Clean up and remove the old PPA. You’ll need to know what version you was running before or use the command:
apt-cache policy
and find the old entry. The example below will use 1.5 as the version to be removed:
sudo add-apt-repository --remove ppa:vbernat/haproxy-1.5
Ubuntu’s PPA system made the upgrade smoother than I first thought and love the simplicity. I hope the Snap packages are just as easy.