首先说下我的环境,是在win系统下安装的子系统ubuntu,方便操作。
网上一般都是使用centos 安装keepalived,基于用ubuntu算是碰到很多坑,这里只说需要安装的缺少包,然后可以参考我都这边文档:Linux下Keepalived安装与配置.
首先需要安装一下依赖包,缺少一个都不行:
apt-get install libpopt-dev daemon gcc libssl-dev libc-dev openssl libnl-dev libnfnetlink-dev libnl-3-dev libnl-genl-3.dev

当然可能有的不能安装,推进使用官方源,切换其他源了可能会出现不可预知错误

安装完后,推荐下面命令执行:

$ ./configure --prefix=/usr/local/keepalived

$ make

$ sudo make install

$ sudo mkdir /etc/sysconfig

$ sudo cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/

$ sudo cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/

$ sudo cp /usr/local/keepalived/sbin/keepalived /sbin/

$ sudo mkdir /etc/keepalived

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