{"id":22691,"date":"2024-06-06T10:12:41","date_gmt":"2024-06-06T07:12:41","guid":{"rendered":"https:\/\/kifarunix.com\/?p=22691"},"modified":"2024-06-06T10:12:45","modified_gmt":"2024-06-06T07:12:45","slug":"how-to-install-keepalived-on-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/how-to-install-keepalived-on-ubuntu-24-04\/","title":{"rendered":"How to Install Keepalived on Ubuntu 24.04"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1066\" height=\"598\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/06\/install-keepalive-on-ubuntu.png?v=1717657858\" alt=\"install keepalived on ubuntu 24.04\" class=\"wp-image-22698\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/06\/install-keepalive-on-ubuntu.png?v=1717657858 1066w, https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/06\/install-keepalive-on-ubuntu-768x431.png?v=1717657858 768w\" sizes=\"(max-width: 1066px) 100vw, 1066px\" \/><\/figure>\n\n\n\n<p>What is the easiest way to install Keepalived on Ubuntu 24.04? In this tutorial, we will cover different ways you can use to install Keepalived on Ubuntu systems. <a href=\"https:\/\/keepalived.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Keepalived<\/a> is an open-source routing software primarily used for implementing high availability and load balancing in Linux-based systems.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#installing-keepalived-on-ubuntu-24-04\">Installing Keepalived on Ubuntu 24.04<\/a><ul><li><a href=\"#install-keepalived-from-default-ubuntu-repositories\">Install Keepalived from Default Ubuntu repositories<\/a><\/li><li><a href=\"#install-keepalived-from-snap-store\">Install Keepalived from Snap Store<\/a><\/li><li><a href=\"#build-and-install-keepalived-from-source-code\">Build and Install Keepalived from Source Code<\/a><ul><li><a href=\"#install-required-build-tools\">Install Required Build Tools<\/a><\/li><li><a href=\"#build-and-install-keepalived\ufffc\">Build and Install Keepalived\ufffc<\/a><\/li><\/ul><\/li><\/ul><\/li><li><a href=\"#configuring-keepalived\">Configuring Keepalived<\/a><\/li><li><a href=\"#conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-keepalived-on-ubuntu-24-04\">Installing Keepalived on Ubuntu 24.04<\/h2>\n\n\n\n<p>There are different ways in which you can install Keepalived on Ubuntu.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install Keepalived from default Ubuntu repositories<\/li>\n\n\n\n<li>Install Keepalived from Snap Store<\/li>\n\n\n\n<li>Build and Install Keepalived from Source Code<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-keepalived-from-default-ubuntu-repositories\">Install Keepalived from Default Ubuntu repositories<\/h3>\n\n\n\n<p>The default Ubuntu repositories usually provides Keepalived packages. As much as this is usually an easy method to install a package on an Ubuntu system, the available packages may not always be up-to-date.<\/p>\n\n\n\n<p>For example, the current Keepalived v2.3.1 is the current stable release version as per the <a href=\"https:\/\/keepalived.org\/release-notes\/\" target=\"_blank\" rel=\"noreferrer noopener\">release notes page<\/a>.<\/p>\n\n\n\n<p>But the available version on the default Ubuntu 24.04 repositories is v2.2.8;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<p>Confirm available version;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-cache madison keepalived<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>keepalived | 1:2.2.8-1build2 | http:\/\/de.archive.ubuntu.com\/ubuntu noble\/main amd64 Packages\n<\/code><\/pre>\n\n\n\n<p>As you can see, available version is not up-to-date.<\/p>\n\n\n\n<p>If you want to install the available version on the default Ubuntu repositories, just execute the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install keepalived<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-keepalived-from-snap-store\">Install Keepalived from Snap Store<\/h3>\n\n\n\n<p>Keepalived is available as a Snap package on the Snap Store. Snaps are containerized software packages that include all the dependencies needed to run an application, providing a consistent and reliable installation experience across different Linux distributions.<\/p>\n\n\n\n<p>Latest versions of Ubuntu, including Ubuntu 24.04 ship with Snapd installed and enabled.<\/p>\n\n\n\n<p>You can check if Snapd is installed by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snap --version<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>snap    2.62+24.04build1\nsnapd   2.62+24.04build1\nseries  16\nubuntu  24.04\nkernel  6.8.0-31-generic\n<\/code><\/pre>\n\n\n\n<p>Check available version of Keepalived on Snap store;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snap info keepalived<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>...\nchannels:\n  latest\/stable:    2.3.1              2024-05-24 (2751) 21MB classic\n  latest\/candidate: 2.3.1              2024-05-24 (2751) 21MB classic\n  latest\/beta:      2.3.1              2024-05-24 (2751) 21MB classic\n  latest\/edge:      v2.3.1-8-g379faa51 2024-06-03 (2761) 21MB classic\n<\/code><\/pre>\n\n\n\n<p>As you can see, Snap store provides the latest release version as of this writing.<\/p>\n\n\n\n<p>Thus, to install Keepalived from snap store;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo snap install keepalived --classic<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"build-and-install-keepalived-from-source-code\">Build and Install Keepalived from Source Code<\/h3>\n\n\n\n<p>It is also possible to build and install Keepalived from source code. If you really need to take this route, then proceed as follows.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"install-required-build-tools\">Install Required Build Tools<\/h4>\n\n\n\n<p>Install the required build tools\/packages;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install curl gcc libssl-dev libnl-3-dev libnl-genl-3-dev libsnmp-dev make<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"build-and-install-keepalived\ufffc\">Build and Install Keepalived<a href=\"https:\/\/keepalived.readthedocs.io\/en\/latest\/installing_keepalived.html#build-and-install\" target=\"_blank\" rel=\"noopener\"><\/a><\/h4>\n\n\n\n<p>Next, download Keepalived source code.<\/p>\n\n\n\n<p>Replace the value of VAR with the version of Keepalived you need to install<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>VER=2.3.1<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/www.keepalived.org\/software\/keepalived-${VER}.tar.gz<\/code><\/pre>\n\n\n\n<p>Extract and compile the package;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar xzf keepalived-${VER}.tar.gz<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>cd keepalived-${VER}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/configure --with-systemdsystemunitdir=\/etc\/systemd\/system\/<\/code><\/pre>\n\n\n\n<p>Read more on;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/configure --help<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>...\nKeepalived configuration\n------------------------\nKeepalived version       : 2.3.1\nCompiler                 : gcc gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0\nPreprocessor flags       : -D_GNU_SOURCE\nCompiler flags           : -g -g -O2 -Wall -Wextra -Wunused -Wstrict-prototypes -Wabsolute-value -Waddress-of-packed-member -Walloca -Walloc-zero -Warith-conversion -Warray-bounds=2 -Wattribute-alias=2 -Wbad-function-cast -Wc11-c2x-compat -Wcast-align -Wcast-qual -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wfloat-conversion -Wfloat-equal -Wformat-overflow -Wformat-security -Wformat-signedness -Wformat-truncation -Wframe-larger-than=5120 -Wimplicit-fallthrough=3 -Winit-self -Winline -Winvalid-pch -Wjump-misses-init -Wlogical-op -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wnormalized -Wnull-dereference -Wold-style-definition -Woverlength-strings -Wpointer-arith -Wredundant-decls -Wshadow -Wshift-overflow=2 -Wstack-protector -Wstrict-overflow=4 -Wstringop-overflow=2 -Wstringop-truncation -Wsuggest-attribute=cold -Wsuggest-attribute=format -Wsuggest-attribute=malloc -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsync-nand -Wtrampolines -Wundef -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunsuffixed-float-constants -Wunused-const-variable=2 -Wvariadic-macros -Wwrite-strings -fno-strict-aliasing -fPIE -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -O2\nLinker flags             : -pie -Wl,-z,relro -Wl,-z,now\nExtra Lib                : -lm -lssl -lcrypto\nUse IPVS Framework       : Yes\nIPVS use libnl           : No\nIPVS syncd attributes    : Yes\nIPVS 64 bit stats        : Yes\nHTTP_GET regex support   : No\nfwmark socket support    : Yes\nUse VRRP Framework       : Yes\nUse VRRP VMAC            : Yes\nUse VRRP authentication  : Yes\nWith track_process       : Yes\nWith linkbeat            : Yes\nUse NetworkManager       : No\nUse BFD Framework        : No\nSNMP vrrp support        : No\nSNMP checker support     : No\nSNMP RFCv2 support       : No\nSNMP RFCv3 support       : No\nDBUS support             : No\nUse JSON output          : No\nlibnl version            : None\nUse IPv4 devconf         : Yes\nUse iptables             : No\nUse nftables             : No\ninit type                : systemd\nsystemd notify           : No\nStrict config checks     : No\nBuild documentation      : No\nDefault runtime options  : -D\n\n*** WARNING - this build will not support IPVS with IPv6. Please install libnl\/libnl-3 dev libraries to support IPv6 with IPVS.\n<\/code><\/pre>\n\n\n\n<p>Compile and install Keepalived;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo make install<\/code><\/pre>\n\n\n\n<p>By default, <strong>make install<\/strong> will install all the files in \/usr\/local\/bin, \/usr\/local\/lib, \/usr\/local\/etc\/keepalived.<\/p>\n\n\n\n<p>See where the <strong>keepalived<\/strong> binary is placed;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>which keepalived <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/local\/sbin\/keepalived<\/code><\/pre>\n\n\n\n<p>The configuration directory set to <strong>\/usr\/local\/etc\/keepalived\/<\/strong>.<\/p>\n\n\n\n<p>Similary, a Systemd service unit is created as <strong>\/etc\/systemd\/system\/keepalived.service<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuring-keepalived\">Configuring Keepalived<\/h2>\n\n\n\n<p>Once the installation is done, you can now check our other guides on how to configure Keepalived to provide a VIP.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/configure-highly-available-haproxy-with-keepalived-on-ubuntu\/#install-and-configure-keepalived-on-ubuntu\" target=\"_blank\" rel=\"noreferrer noopener\">How to Configure Keepalived on Ubuntu<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Keepalived is a valuable tool for ensuring high availability and load balancing in Linux environments. It offers a robust and flexible solution for maintaining service uptime and efficient resource utilization.<\/p>\n\n\n\n<p>In this simple guide, you have learnt three different ways in which you can install Keepalived on Ubuntu.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install Keepalived from default Ubuntu repositories<\/li>\n\n\n\n<li>Install Keepalived from Snap Store<\/li>\n\n\n\n<li>Build and Install Keepalived from Source Code<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>What is the easiest way to install Keepalived on Ubuntu 24.04? In this tutorial, we will cover different ways you can use to install Keepalived<\/p>\n","protected":false},"author":10,"featured_media":22698,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121],"tags":[1665,7396],"class_list":["post-22691","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-keepalived","tag-ubuntu-24-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22691"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=22691"}],"version-history":[{"count":8,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22691\/revisions"}],"predecessor-version":[{"id":22700,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22691\/revisions\/22700"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/22698"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=22691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=22691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=22691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}