1、从www.keepalived.org官方网址下载对应版本。
根据提示安装openssl库文件。 apt-get install openssl*
tar zxvf keepalived-1.2.27.tar.gz
2.安装
tar zxvf keepalived-1.1.19.tar.gz
cd keepalived-1.1.19
./configure --prefix=/usr/local/keepalived \
>--with-kernel-dir=/usr/src/linux-headers-2.6.32-5-686
注释:“--with-kernel-dir”指定内核源码中的头文件。但是debian系统默认是没有linux-headers-2.6.32-5-686这个目录。这是就需要通过apt-cache search linux-headers 搜索对应的系统内核版本安装
apt-get install linux-headers 。
checking openssl/ssl.h presence... no
checking for openssl/ssl.h... no
configure: error:
!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL headers files.
根据提示安装openssl库文件。 apt-get install openssl*
重新
cd keepalived-1.1.19
./configure --prefix=/usr/local/keepalived \
>--with-kernel-dir=/usr/src/linux-headers-2.6.32-5-686
configure: creating ./config.status
config.status: creating Makefile
config.status: creating genhash/Makefile
config.status: WARNING: 'genhash/Makefile.in' seems to ignore the --datarootdir setting
config.status: creating keepalived/core/Makefile
config.status: creating keepalived/include/config.h
config.status: creating keepalived.spec
config.status: creating keepalived/Makefile
config.status: WARNING: 'keepalived/Makefile.in' seems to ignore the --datarootdir setting
config.status: creating lib/Makefile
config.status: creating keepalived/vrrp/Makefile
config.status: creating keepalived/check/Makefile
config.status: creating keepalived/libipvs-2.6/Makefile
Keepalived configuration
------------------------
Keepalived version : 1.1.19
Compiler : gcc
Compiler flags : -g -O2
Extra Lib : -lpopt -lssl -lcrypto
Use IPVS Framework : Yes
IPVS sync daemon support : Yes
Use VRRP Framework : Yes
Use Debug flags : No
make
ipvswrapper.c: In function ?.pvs_group_range_cmd?.
ipvswrapper.c:534: error: incompatible types when assigning to type ?.nion nf_inet_addr?.from type ?.int32_t?
ipvswrapper.c: In function ?.pvs_group_cmd?.
ipvswrapper.c:558: error: incompatible types when assigning to type ?.nion nf_inet_addr?.from type ?.int32_t?
ipvswrapper.c:570: error: incompatible types when assigning to type ?.nion nf_inet_addr?.from type ?.nt?
ipvswrapper.c: In function ?.pvs_set_rule?.
ipvswrapper.c:630: error: incompatible types when assigning to type ?.nion nf_inet_addr?.from type ?.int32_t?
ipvswrapper.c: In function ?.pvs_cmd?.
ipvswrapper.c:667: error: incompatible types when assigning to type ?.nion nf_inet_addr?.from type ?.int32_t?
ipvswrapper.c: In function ?.pvs_group_remove_entry?.
ipvswrapper.c:696: error: wrong type argument to unary exclamation mark
ipvswrapper.c:701: error: incompatible types when assigning to type ?.nion nf_inet_addr?.from type ?.int32_t?
ipvswrapper.c:710: error: incompatible types when assigning to type ?.nion nf_inet_addr?.from type ?.int32_t?
make[2]: *** [ipvswrapper.o] Error 1
make[2]: Leaving directory `/root/keepalived-1.1.19/keepalived/check'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/root/keepalived-1.1.19/keepalived'
make: *** [all] Error 2
这时候根据红色部分的信息可以断定可能是由于你的keepalived和系统内核不太吻合导致
解决办法:uname -r 查看内核版本。我的是2.6.32-5-686,下载/keepalived-1.2.7这时候从新
tar zxvf keepalived-1.2.27.tar.gz
cd keepalived-1.2.27
./configure --prefix=/usr/local/keepalived \
>--with-kernel-dir=/usr/src/linux-headers-2.6.32-5-686
make
make install
ln -s /usr/local/keepalived/sbin/keepalived /sbin/
keepalived --help
出现如下信息则安装成功。
root@debian:~# keepalived --help
Keepalived v1.2.7 (01/16,2013)
Usage:
keepalived
keepalived -n
keepalived -f keepalived.conf
keepalived -d
keepalived -h
keepalived -v
Commands:
Either long or short options are allowed.
keepalived --vrrp -P Only run with VRRP subsystem.
keepalived --check -C Only run with Health-checker subsystem.
keepalived --dont-release-vrrp -V Dont remove VRRP VIPs & VROUTEs on daemon stop.
keepalived --dont-release-ipvs -I Dont remove IPVS topology on daemon stop.
keepalived --dont-fork -n Dont fork the daemon process.
keepalived --use-file -f Use the specified configuration file.
Default is /etc/keepalived/keepalived.conf.
keepalived --dump-conf -d Dump the configuration data.
keepalived --log-console -l Log message to local console.
keepalived --log-detail -D Detailed log messages.
keepalived --log-facility -S 0-7 Set syslog facility to LOG_LOCAL[0-7]. (default=LOG_DAEMON)
keepalived --help -h Display this short inlined help screen.
keepalived --version -v Display the version number
keepalived --pid -p pidfile
keepalived --checkers_pid -c checkers pidfile
keepalived --vrrp_pid -r vrrp pidfile
转载于:https://blog.51cto.com/faguo79/1120535