首先到官网下载需要的包:http://www.keepalived.org/download.html
[root@localhost local]# tar -zxvf /tmp/keepalived-1.3.5.tar.gz
[root@localhost local]# cd keepalived-1.3.5/
[root@localhost keepalived-1.3.5]# ./configure --prefix=/usr/local/keepalived
然后系统出现警告:
*** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS.
[root@localhost keepalived-1.3.5]# yum -y install libnl libnl-devel
安装完以后重新执行configure
这次出现错误:
configure: error: libnfnetlink headers missing
[root@localhost keepalived-1.3.5]# yum install -y libnfnetlink-devel
重新执行configure
现在进行编译:
[root@localhost keepalived-1.3.5]# make && make install
到这里就安装完成了!
补充:在之前服务器上按照以上步骤安装成功,后来换了一台出现了以下错误
check/libcheck.a(check_ssl.o): In function `build_ssl_ctx':
/usr/local/nginx/keepalived-2.0.0/keepalived/check/check_ssl.c:72: undefined reference to `OPENSSL_init_ssl'
/usr/local/nginx/keepalived-2.0.0/keepalived/check/check_ssl.c:73: undefined reference to `OPENSSL_init_ssl'
/usr/local/nginx/keepalived-2.0.0/keepalived/check/check_ssl.c:82: undefined reference to `TLS_method'
collect2: error: ld returned 1 exit status
make[2]: *** [keepalived] Error 1
make[2]: Leaving directory `/usr/local/nginx/keepalived-2.0.0/keepalived'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/nginx/keepalived-2.0.0/keepalived'
make: *** [all-recursive] Error 1
未解决!等待各位大神的答案!!!!重新装系统也不管用,不知道是不是版本问题,通过
yum install keepalived
命令安装时1.3.5版本的,通过
whereis keepalived
命令查看安装路径
这个问题处理方式借鉴于https://blog.csdn.net/lipeigang1109/article/details/54912696