Installation Keepalive-2.2.7 on CentOS 7.9
一、Installation Keepalive-2.2.7 on CentOS 7.9
1 地址
2 安装依赖
yum install -y ipvsadm popt popt-devel libnl libnl-devel libnl3-devel libnfnetlink libnfnetlink-devel net-snmp-devel openssl openssl-devel
# CentOS 8.3
yum install -y ipvsadm popt popt-devel libnl3-devel libnfnetlink net-snmp-devel openssl openssl-devel
3 wget 下载安装包
cd /opt/software
wget https://www.keepalived.org/software/keepalived-2.2.7.tar.gz --no-check-certificate
4 解压
tar -zxvf /opt/software/keepalived-2.2.7.tar.gz -C /opt/ && cd /opt/keepalived-2.2.7 && ls
5 编译&安装
./configure --prefix=/usr/local/keepalived
make && make install
6 使用keepalived -v查看版本号信息
/usr/local/keepalived/sbin/keepalived -v
7 安装过程中提示(没有省略)
*** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS.
Keepalived configuration
------------------------
Keepalived version : 2.2.7
Compiler : gcc gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)
Preprocessor flags : -D_GNU_SOURCE -I/usr/include/libnl3
Compiler flags : -g -g -O2 -Wall -Wextra -Wunused -Wstrict-prototypes -Walloca -Walloc-zero -Warray-bounds=2 -Wbad-function-cast -Wcast-align -Wcast-qual -Wchkp -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wfloat-conversion -Wfloat-equal -Wformat-overflow -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 -fPIE -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -O2
Linker flags : -pie -Wl,-z,relro -Wl,-z,now
Extra Lib : -lm -lcrypto -lssl -lnl-3 -lnl-genl-3
Use IPVS Framework : Yes
IPVS use libnl : Yes
IPVS syncd attributes : Yes
IPVS 64 bit stats : Yes
HTTP_GET regex support : No
fwmark socket support : Yes
Use VRRP Framework : Yes
Use VRRP VMAC : Yes
Use VRRP authentication : Yes
With track_process : Yes
With linkbeat : Yes
Use BFD Framework : No
SNMP vrrp support : No
SNMP checker support : No
SNMP RFCv2 support : No
SNMP RFCv3 support : No
DBUS support : No
Use JSON output : No
libnl version : 3
Use IPv4 devconf : Yes
Use iptables : No
Use nftables : No
init type : systemd
systemd notify : No
Strict config checks : No
Build documentation : No
Default runtime options : -D
解决上述警告问题
yum install -y libnl3.x86_64 libnl3-devel.x86_64
8 系统出现错误信息
configure: error: libnfnetlink headers missing
解决方法
yum install -y libnfnetlink-devel
查看版本
/usr/local/keepalived/sbin/keepalived -v
10 查看基本命令
[root@kube-master01 keepalived-2.2.7]# /usr/local/keepalived/sbin/keepalived --help
Usage: /usr/local/keepalived/sbin/keepalived [OPTION...]
-f, --use-file=FILE Use the specified configuration file
default '/usr/local/etc/keepalived/keepalived.conf'
or '/etc/keepalived/keepalived.conf'
-P, --vrrp Only run with VRRP subsystem
-C, --check Only run with Health-checker subsystem
--all Force all child processes to run, even if have no configuration
-l, --log-console Log messages to local console
-D, --log-detail Detailed log messages
-S, --log-facility=([0-7]|local[0-7]|user|daemon)
Set syslog facility to LOG_LOCAL[0-7], user or daemon (default)
-G, --no-syslog Don't log via syslog
-u, --umask=MASK umask for file creation (in numeric form)
-X, --release-vips Drop VIP on transition from signal.
-V, --dont-release-vrrp Don't remove VRRP VIPs and VROUTEs on daemon stop
-I, --dont-release-ipvs Don't remove IPVS topology on daemon stop
-R, --dont-respawn Don't respawn child processes
-n, --dont-fork Don't fork the daemon process
-d, --dump-conf Dump the configuration data
-p, --pid=FILE Use specified pidfile for parent process
-r, --vrrp_pid=FILE Use specified pidfile for VRRP child process
-T, --genhash Enter into genhash utility mode (this should be the first option used).
-c, --checkers_pid=FILE Use specified pidfile for checkers child process
-a, --address-monitoring Report all address additions/deletions notified via netlink
-s, --namespace=NAME Run in network namespace NAME (overrides config)
-m, --core-dump Produce core dump if terminate abnormally
-M, --core-dump-pattern=PATN Also set /proc/sys/kernel/core_pattern to PATN (default 'core')
-e, --all-config Error if any configuration file missing (same as includet)
-i, --config-id id Skip any configuration lines beginning '@' that don't match id
or any lines beginning @^ that do match.
The config-id defaults to the node name if option not used
--signum=SIGFUNC Return signal number for STOP, RELOAD, DATA, STATS, STATS_CLEAR
-t, --config-test[=LOG_FILE] Check the configuration for obvious errors, output to
stderr by default
-v, --version Display the version number
-h, --help Display this help message