Category Archives: keepalived

Building keepalived from source on Ubuntu 12.04 for HAProxy

Presuming that HAProxy has been built from GIT.

Download the latest source for keepalived

wget http://www.keepalived.org/software/keepalived-1.2.7.tar.gz

untar the archive

tar -zxvf keepalived-1.2.7.tar.gz

now build keepalived

cd keepalived-1.2.7
./configure
make
sudo make install

link it from /usr/local/sbin to /usr/sbin

sudo ln -s /usr/local/sbin/keepalived /usr/sbin/keepalived

now configure keepalived to start automatically

create the init file

sudo nano /etc/init.d/keepalived

as per attached file init.d.keepalived.txt

make it executable

sudo chmod +x /etc/init.d/keepalived

now set the runlevels

sudo sudo update-rc.d keepalived defaults

now enable services to bind to the VRRP address

sudo nano /etc/sysctl.conf

add the line

net.ipv4.ip_nonlocal_bind=1

to test startup, use the supplied sample

sudo mkdir /etc/keepalived
sudo cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf

test startup

sudo /etc/init.d/keepalived start

to test that it is working

ip address list

this will show the keepalived addresses on the active server.