【keepalived部署安装】

keepalive 安裝部署

1、官网下载地址:https://www.keepalived.org/download.html

2、解压:tar xf keepalived-2.2.8

3、编译

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

[root@master~/install_packages/keepalived-2.2.8]#  ./configure --prefix=/usr/local/keepalived
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking whether make sets $(MAKE)... (cached) yes
checking for ranlib... ranlib
checking for grep that handles long lines and -e... /usr/bin/grep
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for strip... strip
checking for ldd... ldd
checking for ar... ar
checking the archiver (ar) interface... ar
checking if using GCC Link Time Optimisation... no
checking msghdr.msg_controllen is size_t... yes
checking diagnostic pragmas in functions... 
yes
checking diagnostic push/pop pragmas... yes
checking for -Wall... yes
checking for -Wextra... yes
checking for -Wunused... yes
checking for -Wstrict-prototypes... yes
checking for -Wabi... no
checking for -Wabsolute-value... no
checking for -Waddress-of-packed-member... no
checking for -Walloca... yes
checking for -Walloc-larger-than=4096... no
checking for -Walloc-zero... yes
checking for -Warith-conversion... no
checking for -Warray-bounds=2... yes
checking for -Wattribute-alias=2... no
checking for -Wbad-function-cast... yes
checking for -Wc11-c2x-compat... no
checking for -Wcast-align... yes
checking for -Wcast-qual... yes
checking for -Wchkp... yes
checking for -Wdate-time... yes
checking for -Wdisabled-optimization... yes
checking for -Wdouble-promotion... yes
checking for -Wduplicated-branches... yes
checking for -Wduplicated-cond... yes
checking for -Wfloat-conversion... yes
checking for -Wfloat-equal... yes
checking for -Wformat-overflow... yes
checking for -Wformat-security... no
checking for -Wformat-signedness... yes
checking for -Wformat-truncation... yes
checking for -Wframe-larger-than=5120... yes
checking for -Wimplicit-fallthrough=3... yes
checking for -Winit-self... yes
checking for -Winline... yes
checking for -Winvalid-pch... yes
checking for -Wjump-misses-init... yes
checking for -Wlogical-op... yes
checking for -Wmissing-declarations... yes
checking for -Wmissing-field-initializers... yes
checking for -Wmissing-include-dirs... yes
checking for -Wmissing-prototypes... yes
checking for -Wnested-externs... yes
checking for -Wnormalized... yes
checking for -Wnull-dereference... yes
checking for -Wold-style-definition... yes
checking for -Woverlength-strings... yes
checking for -Wpointer-arith... yes
checking for -Wredundant-decls... yes
checking for -Wshadow... yes
checking for -Wshift-overflow=2... yes
checking for -Wstack-protector... yes
checking for -Wstrict-overflow=4... yes
checking for -Wstringop-overflow=2... yes
checking for -Wstringop-truncation... yes
checking for -Wsuggest-attribute=cold... yes
checking for -Wsuggest-attribute=const... no
checking for -Wsuggest-attribute=format... yes
checking for -Wsuggest-attribute=malloc... yes
checking for -Wsuggest-attribute=noreturn... yes
checking for -Wsuggest-attribute=pure... yes
checking for -Wsync-nand... yes
checking for -Wtrampolines... yes
checking for -Wundef... yes
checking for -Wuninitialized... yes
checking for -Wunknown-pragmas... yes
checking for -Wunsafe-loop-optimizations... yes
checking for -Wunsuffixed-float-constants... yes
checking for -Wunused-const-variable=2... yes
checking for -Wunused-macros... no
checking for -Wvariadic-macros... yes
checking for -Wwrite-strings... yes
checking for function __attribute__((error(msg))) support... no
checking for function __attribute__((warn_unused_result)) support... yes
checking for PIE support... yes
checking for -Wformat -Werror=format-security support... yes
checking for -Wp,-D_FORTIFY_SOURCE=2 support... yes
checking for -fexceptions support... yes
checking for -fstack-protector-strong support... yes
checking for --param=ssp-buffer-size=4 support... yes
checking for -grecord-gcc-switches support... yes
checking for -Wl,-z,relro support... yes
checking for -Wl,-z,now support... yes
checking for -O2 support... yes
CFLAGS=-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 -fno-strict-aliasing -fPIE -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -O2
checking for unaligned memory access... yes
checking for unaligned memory access causes warnings... no
checking for clock_gettime() requires -lrt... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for vfork.h... no
checking for arpa/inet.h... yes
checking for fcntl.h... yes
checking for limits.h... yes
checking for netdb.h... yes
checking for netinet/in.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for sys/ioctl.h... yes
checking for sys/param.h... yes
checking for sys/prctl.h... yes
checking for sys/socket.h... yes
checking for sys/time.h... yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking linux/errqueue.h needs sys/time.h... no
checking for asm/types.h... yes
checking for linux/ethtool.h... yes
checking for linux/icmpv6.h... yes
checking for linux/if_ether.h... yes
checking for linux/if_packet.h... yes
checking for linux/ip.h... yes
checking for linux/sockios.h... yes
checking for linux/types.h... yes
checking for linux/fib_rules.h... yes
checking for linux/if_addr.h... yes
checking for linux/if_link.h... yes
checking for linux/if_arp.h... yes
checking for _Bool... yes
checking for stdbool.h that conforms to C99... yes
checking for inline... inline
checking for int64_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for an ANSI C-conforming const... yes
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for dup2... yes
checking for dup3... yes
checking for getcwd... yes
checking for gettimeofday... yes
checking for malloc... yes
checking for memmove... yes
checking for memset... yes
checking for realloc... yes
checking for select... yes
checking for setenv... yes
checking for socket... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strdup... yes
checking for strerror... yes
checking for strpbrk... yes
checking for strstr... yes
checking for strtol... yes
checking for strtoul... yes
checking for uname... yes
checking for vsyslog... yes
checking for memfd_create... yes
checking for gcc options needed to detect all undeclared functions... none needed
checking whether O_TMPFILE is declared... yes
checking whether ETHERTYPE_IPV6 is declared... yes
checking whether IPV6_MULTICAST_ALL is declared... no
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for openssl/md5.h... yes
checking for openssl/evp.h... yes
checking for SSL_CTX_new in -lssl... yes
checking for EVP_DigestInit_ex in -lcrypto... yes
checking for EVP_MD_CTX_new in -lcrypto... yes
checking SSL_set_tlsext_host_name() - may be a definition... yes
checking for SSL_CTX_set_verify_depth... yes
checking for SSL_set0_rbio... yes
checking for SSL_set0_wbio... yes
checking for OPENSSL_init_crypto... yes
checking for TLS_method... yes
checking for ERR_get_error_all... no
checking whether IPV4_DEVCONF_ARP_IGNORE is declared... yes
checking whether IPV4_DEVCONF_ACCEPT_LOCAL is declared... yes
checking whether IPV4_DEVCONF_RP_FILTER is declared... yes
checking whether IPV4_DEVCONF_ARPFILTER is declared... yes
checking for linux/rtnetlink.h... yes
checking for nl_socket_modify_cb in -lnl... no
configure: WARNING: keepalived will be built without libnl support.
checking for magic_open in -lmagic... no
checking whether RTA_ENCAP is declared... yes
checking whether RTA_EXPIRES is declared... yes
checking whether RTA_NEWDST is declared... yes
checking whether RTA_PREF is declared... yes
checking whether FRA_SUPPRESS_PREFIXLEN is declared... yes
checking whether FRA_SUPPRESS_IFGROUP is declared... yes
checking whether FRA_TUN_ID is declared... yes
checking whether RTAX_CC_ALGO is declared... yes
checking whether RTAX_QUICKACK is declared... yes
checking whether RTEXT_FILTER_SKIP_STATS is declared... yes
checking whether FRA_L3MDEV is declared... yes
checking whether FRA_UID_RANGE is declared... yes
checking whether RTAX_FASTOPEN_NO_COOKIE is declared... yes
checking whether RTA_VIA is declared... yes
checking whether FRA_PROTOCOL is declared... yes
checking whether FRA_IP_PROTO is declared... yes
checking whether FRA_SPORT_RANGE is declared... yes
checking whether FRA_DPORT_RANGE is declared... yes
checking whether RTA_TTL_PROPAGATE is declared... yes
checking whether IFA_FLAGS is declared... yes
checking whether LWTUNNEL_ENCAP_MPLS is declared... yes
checking whether LWTUNNEL_ENCAP_ILA is declared... yes
checking for libiptc/libip6tc.h... no
checking whether NFTA_TABLE_MAX is declared... yes
configure: WARNING: libnftnl missing
configure: WARNING: libmnl missing
checking for linux/if.h and net/if.h namespace collision... yes
checking for linux/if_ether.h then netinet/in.h then linux/if.h namespace collision... no
checking for linux/if_ether.h then netinet/if_ether.h namespace collision... no
checking for libiptc/libiptc.h linux/if.h and net/if.h namespace collision... yes
checking whether IPVS_DEST_ATTR_ADDR_FAMILY is declared... yes
checking whether IPVS_DAEMON_ATTR_SYNC_MAXLEN is declared... yes
checking whether IPVS_DAEMON_ATTR_MCAST_GROUP is declared... yes
checking whether IPVS_DAEMON_ATTR_MCAST_GROUP6 is declared... yes
checking whether IPVS_DAEMON_ATTR_MCAST_PORT is declared... yes
checking whether IPVS_DAEMON_ATTR_MCAST_TTL is declared... yes
checking whether IPVS_SVC_ATTR_STATS64 is declared... yes
checking whether IPVS_DEST_ATTR_STATS64 is declared... yes
checking whether IPVS_DEST_ATTR_TUN_TYPE is declared... no
checking whether IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM is declared... no
checking whether IP_VS_CONN_F_TUNNEL_TYPE_GRE is declared... no
checking whether IFLA_IPVLAN_MODE is declared... yes
checking whether IPVLAN_MODE_L3S is declared... yes
checking whether IFLA_IPVLAN_FLAGS is declared... yes
checking whether GLOB_BRACE is declared... yes
checking whether GLOB_ALTDIRFUNC is declared... yes
checking for timegm()... yes
checking whether IFLA_INET6_ADDR_GEN_MODE is declared... yes
checking whether IFLA_VRF_MAX is declared... yes
checking whether SO_MARK is declared... yes
checking for sphinx-build... No
checking for rpm... Yes
checking for rpmbuild... Yes

checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating keepalived/Makefile
config.status: creating lib/Makefile
config.status: creating keepalived/core/Makefile
config.status: creating keepalived.spec
config.status: creating Dockerfile
config.status: creating keepalived/check/Makefile
config.status: creating keepalived/vrrp/Makefile
config.status: creating keepalived/bfd/Makefile
config.status: creating doc/Makefile
config.status: creating bin_install/Makefile
config.status: creating keepalived/dbus/Makefile
config.status: creating keepalived/etc/Makefile
config.status: creating keepalived/etc/init/Makefile
config.status: creating keepalived/etc/init.d/Makefile
config.status: creating keepalived/etc/sysconfig/Makefile
config.status: creating keepalived/etc/keepalived/Makefile
config.status: creating keepalived/trackers/Makefile
config.status: creating doc/man/man8/Makefile
config.status: creating doc/man/man5/Makefile
config.status: creating doc/man/man1/Makefile
config.status: creating lib/config.h
config.status: lib/config.h is unchanged
config.status: creating lib/config_warnings.h
config.status: lib/config_warnings.h is unchanged
config.status: executing depfiles commands

Keepalived configuration
------------------------
Keepalived version       : 2.2.8
Compiler                 : gcc gcc (GCC) 8.3.1 20191121 (Anolis 8.3.1-5.0.1)
Preprocessor flags       : -D_GNU_SOURCE
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 -fno-strict-aliasing -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 -lssl -lcrypto
Use IPVS Framework       : Yes
IPVS use libnl           : No
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 NetworkManager       : No
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            : None
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

*** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS.

[root@master~/install_packages/keepalived-2.2.8]#  

4、安装

-j 跟进cpu核心数来定

make -j 8 && make install

[root@k8s-node01 ~/install_packages/keepalived-2.2.8]#  ls -l /usr/local/keepalive
ls: cannot access '/usr/local/keepalive': No such file or directory
[root@k8s-node01 ~/install_packages/keepalived-2.2.8]#  make -j 8 && make install
Making all in lib
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8/lib'
make  all-am
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/lib'
  CC       memory.o
  CC       utils.o
  CC       notify.o
  CC       timer.o
  CC       scheduler.o
  CC       vector.o
  CC       html.o
  CC       parser.o
  CC       signals.o
  CC       logger.o
  CC       list_head.o
  CC       rbtree.o
  CC       process.o
  CC       json_writer.o
  CC       rttables.o
  AR       liblib.a
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/lib'
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8/lib'
Making all in keepalived
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived'
Making all in core
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/core'
  CC       main.o
  CC       daemon.o
  CC       pidfile.o
  CC       layer4.o
  CC       smtp.o
  CC       global_data.o
  CC       global_parser.o
  CC       keepalived_netlink.o
  CC       namespaces.o
  CC       track_process.o
  CC       reload_monitor.o
  CC       config_notify.o
  AR       libcore.a
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/core'
Making all in vrrp
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/vrrp'
  CC       vrrp_daemon.o
  CC       vrrp_print.o
  CC       vrrp_data.o
  CC       vrrp_parser.o
  CC       vrrp.o
  CC       vrrp_notify.o
  CC       vrrp_scheduler.o
  CC       vrrp_sync.o
  CC       vrrp_arp.o
  CC       vrrp_if.o
  CC       vrrp_track.o
  CC       vrrp_ipaddress.o
  CC       vrrp_ndisc.o
  CC       vrrp_if_config.o
  CC       vrrp_static_track.o
  CC       vrrp_iproute.o
  CC       vrrp_iprule.o
  CC       vrrp_ip_rule_route_parser.o
  CC       vrrp_vmac.o
  CC       vrrp_ipsecah.o
  AR       libvrrp.a
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/vrrp'
Making all in check
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/check'
  CC       check_daemon.o
  CC       check_data.o
  CC       check_parser.o
  CC       check_api.o
  CC       check_tcp.o
  CC       check_http.o
  CC       check_ssl.o
  CC       check_genhash.o
  CC       check_smtp.o
  CC       check_misc.o
  CC       check_dns.o
  CC       check_print.o
  CC       ipwrapper.o
  CC       ipvswrapper.o
  CC       libipvs.o
  CC       check_udp.o
  CC       check_ping.o
  CC       check_file.o
  AR       libcheck.a
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/check'
Making all in trackers
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/trackers'
  CC       track_file.o
  AR       libtracker.a
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/trackers'
Making all in etc
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
Making all in init
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init'
Making all in init.d
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init.d'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init.d'
Making all in keepalived
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/keepalived'
  CP       keepalived.conf.sample
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/keepalived'
Making all in sysconfig
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/sysconfig'
  EDIT     keepalived
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/sysconfig'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived'
  CC       main.o
  EDIT     keepalived-non-root.service
  EDIT     keepalived.service
  CCLD     keepalived
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived'
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived'
Making all in doc
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8/doc'
Making all in man/man8
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/doc/man/man8'
  EDIT     keepalived.8
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc/man/man8'
Making all in man/man5
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/doc/man/man5'
  EDIT     keepalived.conf.5
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc/man/man5'
Making all in man/man1
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/doc/man/man1'
  EDIT     genhash.1
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc/man/man1'
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/doc'
make[2]: Nothing to be done for 'all-am'.
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc'
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc'
Making all in bin_install
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8/bin_install'
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8/bin_install'
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8'
  EDIT     README
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8'
Making install in lib
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8/lib'
make  install-am
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/lib'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/lib'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/lib'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/lib'
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8/lib'
Making install in keepalived
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived'
Making install in core
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/core'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/core'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/core'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/core'
Making install in vrrp
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/vrrp'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/vrrp'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/vrrp'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/vrrp'
Making install in check
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/check'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/check'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/check'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/check'
Making install in trackers
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/trackers'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/trackers'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/trackers'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/trackers'
Making install in etc
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
Making install in init
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init'
make[4]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init'
make[4]: Nothing to be done for 'install-exec-am'.
make[4]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init'
Making install in init.d
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init.d'
make[4]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init.d'
make[4]: Nothing to be done for 'install-exec-am'.
make[4]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init.d'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/init.d'
Making install in keepalived
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/keepalived'
make[4]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/keepalived'
make[4]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/local/keepalive/etc/keepalived'
 /usr/bin/install -c -m 644 keepalived.conf.sample '/usr/local/keepalive/etc/keepalived'
make  install-data-hook
make[5]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/keepalived'
make[5]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/keepalived'
make[4]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/keepalived'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/keepalived'
Making install in sysconfig
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/sysconfig'
make[4]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/sysconfig'
make[4]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/local/keepalive/etc/sysconfig'
 /usr/bin/install -c -m 644 keepalived '/usr/local/keepalive/etc/sysconfig'
make[4]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/sysconfig'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc/sysconfig'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
make[4]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
make[4]: Nothing to be done for 'install-exec-am'.
make[4]: Nothing to be done for 'install-data-am'.
make[4]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived/etc'
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived'
 /usr/bin/mkdir -p '/usr/local/keepalive/sbin'
  /usr/bin/install -c keepalived '/usr/local/keepalive/sbin'
make  install-exec-hook
make[4]: Entering directory '/root/install_packages/keepalived-2.2.8/keepalived'
/usr/bin/mkdir -p //usr/local/keepalive/bin
make[4]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived'
 /usr/bin/mkdir -p '/usr/lib/systemd/system'
 /usr/bin/install -c -m 644 keepalived.service '/usr/lib/systemd/system'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived'
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8/keepalived'
Making install in doc
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8/doc'
Making install in man/man8
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/doc/man/man8'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/doc/man/man8'
make[3]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/local/keepalive/share/man/man8'
 /usr/bin/install -c -m 644 keepalived.8 '/usr/local/keepalive/share/man/man8'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc/man/man8'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc/man/man8'
Making install in man/man5
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/doc/man/man5'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/doc/man/man5'
make[3]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/local/keepalive/share/man/man5'
 /usr/bin/install -c -m 644 keepalived.conf.5 '/usr/local/keepalive/share/man/man5'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc/man/man5'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc/man/man5'
Making install in man/man1
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/doc/man/man1'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/doc/man/man1'
make[3]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/local/keepalive/share/man/man1'
 /usr/bin/install -c -m 644 genhash.1 '/usr/local/keepalive/share/man/man1'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc/man/man1'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc/man/man1'
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/doc'
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8/doc'
make[3]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/local/keepalive/share/snmp/mibs'
 /usr/bin/mkdir -p '/usr/local/keepalive/etc/keepalived/samples'
 /usr/bin/install -c -m 644 ./samples/keepalived.conf.conditional_conf ./samples/keepalived.conf.fwmark ./samples/keepalived.conf.HTTP_GET.port ./samples/keepalived.conf.inhibit ./samples/keepalived.conf.IPv6 ./samples/keepalived.conf.misc_check ./samples/keepalived.conf.misc_check_arg ./samples/keepalived.conf.PING_CHECK ./samples/keepalived.conf.quorum ./samples/keepalived.conf.sample ./samples/keepalived.conf.SMTP_CHECK ./samples/keepalived.conf.SSL_GET ./samples/keepalived.conf.status_code ./samples/keepalived.conf.track_interface ./samples/keepalived.conf.UDP_CHECK ./samples/keepalived.conf.virtualhost ./samples/keepalived.conf.virtual_server_group ./samples/keepalived.conf.vrrp ./samples/keepalived.conf.vrrp.localcheck ./samples/keepalived.conf.vrrp.lvs_syncd ./samples/keepalived.conf.vrrp.routes ./samples/keepalived.conf.vrrp.rules ./samples/keepalived.conf.vrrp.scripts ./samples/keepalived.conf.vrrp.static_ipaddress ./samples/keepalived.conf.vrrp.sync ./samples/sample.misccheck.smbcheck.sh ./samples/sample_notify_fifo.sh '/usr/local/keepalive/etc/keepalived/samples'
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc'
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8/doc'
Making install in bin_install
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8/bin_install'
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8/bin_install'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8/bin_install'
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8/bin_install'
make[1]: Entering directory '/root/install_packages/keepalived-2.2.8'
make[2]: Entering directory '/root/install_packages/keepalived-2.2.8'
make[2]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/local/keepalive/share/doc/keepalived'
 /usr/bin/install -c -m 644 README '/usr/local/keepalive/share/doc/keepalived'
make  install-data-hook
make[3]: Entering directory '/root/install_packages/keepalived-2.2.8'
make[3]: Nothing to be done for 'install-data-hook'.
make[3]: Leaving directory '/root/install_packages/keepalived-2.2.8'
make[2]: Leaving directory '/root/install_packages/keepalived-2.2.8'
make[1]: Leaving directory '/root/install_packages/keepalived-2.2.8'
[root@k8s-node01 ~/install_packages/keepalived-2.2.8]#  ls -ld /usr/local/keepalive
drwxr-x--- 6 root root 53 Mar 25 15:15 /usr/local/keepalive
[root@k8s-node01 ~/install_packages/keepalived-2.2.8]#  

5、设置配置文件

cd /usr/local/keepalive/etc/keepalived
cp keepalived.conf.sample keepalived.conf

[root@master init.d]# cat /usr/local/keepalive/etc/keepalived/keepalived.conf

! Configuration File for keepalived
global_defs {                                            # 全局参数
    router_id LVS_01                                     # 指定名称,各个服务器名称要不一样
}
vrrp_script check_port {
    script  "/usr/bin/bash -c '</dev/tcp/127.0.0.1/80'"  # 修改最后的nginx端口80为自己需要监听的端口,理论上可以监听远程端口
    interval 2                                           # 检查脚本的频率,单位(秒)
    weight -30                                           # 端口检查失败,优先级减少30,默认减少2[注意:两台主机配置的weight相同时候必须保证weight的值大于priority差值]
}
vrrp_instance VI_1 {                                     # 指定vrrp热备参数
    state MASTER                                         # 服务器角色是master,备份服务器设置为BACKUP
    interface ens33                                      # 修改物理网卡名称,默认是centos6的eth0 
    virtual_router_id 10                                 # 组号相同
    priority 150                                         # 优先级,主服务器设置要大于备服务器
    advert_int 1
    authentication {
    	auth_type PASS                                   # 验证类型和密码,不建议修改
    	auth_pass 123
	}
	virtual_ipaddress {
    	10.6.5.222/24                                    # 漂移地址(VIP)地址,可以有多个
	}
	track_script {
        check_port
	}
}

6、启动并设置开机自启动

systemctl start keepalived && systemctl enable keepalived

7、可能会遇到的问题

7.1 以下报错信息的原因是没有安装openssl导致的

checking for openssl/ssl.h... no
configure: error: 
  !!! OpenSSL is not properly installed on your system. !!!
  !!! Can not include OpenSSL headers files.            !!!
[root@k8s-node01 keepalived-2.2.4]# 

7.2 编译报警

找不到对应的libnal 和libnal-devel包

*** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS.
# 安装对应包时找不到
[root@k8s-node01 keepalived-2.2.4]#  yum install -y libnl-3 libnl
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:49:12 ago on Mon Mar 25 11:50:04 2024.
No match for argument: libnl-3
No match for argument: libnl
Error: Unable to find a match: libnl-3 libnl

8、处理方案

8.1安装openssl

yum -y install openssl openssl-devel

 [root@k8s-node01 keepalived-2.2.4]# yum -y install openssl openssl-devel
已加载插件:fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * elrepo: mirrors.tuna.tsinghua.edu.cn
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 openssl.x86_64.1.1.0.2k-26.el7_9 将被 安装
---> 软件包 openssl-devel.x86_64.1.1.0.2k-26.el7_9 将被 安装
--> 正在处理依赖关系 zlib-devel(x86-64),它被软件包 1:openssl-devel-1.0.2k-26.el7_9.x86_64 需要
--> 正在处理依赖关系 krb5-devel(x86-64),它被软件包 1:openssl-devel-1.0.2k-26.el7_9.x86_64 需要
--> 正在检查事务
---> 软件包 krb5-devel.x86_64.0.1.15.1-55.el7_9 将被 安装
--> 正在处理依赖关系 libkadm5(x86-64) = 1.15.1-55.el7_9,它被软件包 krb5-devel-1.15.1-55.el7_9.x86_64 需要
--> 正在处理依赖关系 krb5-libs(x86-64) = 1.15.1-55.el7_9,它被软件包 krb5-devel-1.15.1-55.el7_9.x86_64 需要
--> 正在处理依赖关系 libverto-devel,它被软件包 krb5-devel-1.15.1-55.el7_9.x86_64 需要
--> 正在处理依赖关系 libselinux-devel,它被软件包 krb5-devel-1.15.1-55.el7_9.x86_64 需要
--> 正在处理依赖关系 libcom_err-devel,它被软件包 krb5-devel-1.15.1-55.el7_9.x86_64 需要
--> 正在处理依赖关系 keyutils-libs-devel,它被软件包 krb5-devel-1.15.1-55.el7_9.x86_64 需要
---> 软件包 zlib-devel.x86_64.0.1.2.7-21.el7_9 将被 安装
--> 正在处理依赖关系 zlib = 1.2.7-21.el7_9,它被软件包 zlib-devel-1.2.7-21.el7_9.x86_64 需要
--> 正在检查事务
---> 软件包 keyutils-libs-devel.x86_64.0.1.5.8-3.el7 将被 安装
---> 软件包 krb5-libs.x86_64.0.1.15.1-50.el7 将被 升级
--> 正在处理依赖关系 krb5-libs(x86-64) = 1.15.1-50.el7,它被软件包 krb5-workstation-1.15.1-50.el7.x86_64 需要
---> 软件包 krb5-libs.x86_64.0.1.15.1-55.el7_9 将被 更新
---> 软件包 libcom_err-devel.x86_64.0.1.42.9-19.el7 将被 安装
---> 软件包 libkadm5.x86_64.0.1.15.1-50.el7 将被 升级
---> 软件包 libkadm5.x86_64.0.1.15.1-55.el7_9 将被 更新
---> 软件包 libselinux-devel.x86_64.0.2.5-15.el7 将被 安装
--> 正在处理依赖关系 libsepol-devel(x86-64) >= 2.5-10,它被软件包 libselinux-devel-2.5-15.el7.x86_64 需要
--> 正在处理依赖关系 pkgconfig(libsepol),它被软件包 libselinux-devel-2.5-15.el7.x86_64 需要
--> 正在处理依赖关系 pkgconfig(libpcre),它被软件包 libselinux-devel-2.5-15.el7.x86_64 需要
---> 软件包 libverto-devel.x86_64.0.0.2.5-4.el7 将被 安装
---> 软件包 zlib.x86_64.0.1.2.7-18.el7 将被 升级
---> 软件包 zlib.x86_64.0.1.2.7-21.el7_9 将被 更新
--> 正在检查事务
---> 软件包 krb5-workstation.x86_64.0.1.15.1-50.el7 将被 升级
---> 软件包 krb5-workstation.x86_64.0.1.15.1-55.el7_9 将被 更新
---> 软件包 libsepol-devel.x86_64.0.2.5-10.el7 将被 安装
---> 软件包 pcre-devel.x86_64.0.8.32-17.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

======================================================================================================================
 Package                           架构                 版本                              源                     大小
======================================================================================================================
正在安装:
 openssl                           x86_64               1:1.0.2k-26.el7_9                 updates               494 k
 openssl-devel                     x86_64               1:1.0.2k-26.el7_9                 updates               1.5 M
为依赖而安装:
 keyutils-libs-devel               x86_64               1.5.8-3.el7                       base                   37 k
 krb5-devel                        x86_64               1.15.1-55.el7_9                   updates               273 k
 libcom_err-devel                  x86_64               1.42.9-19.el7                     base                   32 k
 libselinux-devel                  x86_64               2.5-15.el7                        base                  187 k
 libsepol-devel                    x86_64               2.5-10.el7                        base                   77 k
 libverto-devel                    x86_64               0.2.5-4.el7                       base                   12 k
 pcre-devel                        x86_64               8.32-17.el7                       base                  480 k
 zlib-devel                        x86_64               1.2.7-21.el7_9                    updates                50 k
为依赖而更新:
 krb5-libs                         x86_64               1.15.1-55.el7_9                   updates               810 k
 krb5-workstation                  x86_64               1.15.1-55.el7_9                   updates               821 k
 libkadm5                          x86_64               1.15.1-55.el7_9                   updates               180 k
 zlib                              x86_64               1.2.7-21.el7_9                    updates                90 k

事务概要
======================================================================================================================
安装  2 软件包 (+8 依赖软件包)
升级           ( 4 依赖软件包)

总下载量:5.0 M
Downloading packages:
No Presto metadata available for updates
(1/14): krb5-devel-1.15.1-55.el7_9.x86_64.rpm                                                  | 273 kB  00:00:06     
(2/14): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm                                             |  37 kB  00:00:08     
(3/14): krb5-workstation-1.15.1-55.el7_9.x86_64.rpm                                            | 821 kB  00:00:13     
(4/14): krb5-libs-1.15.1-55.el7_9.x86_64.rpm                                                   | 810 kB  00:00:21     
(5/14): libkadm5-1.15.1-55.el7_9.x86_64.rpm                                                    | 180 kB  00:00:00     
(6/14): libcom_err-devel-1.42.9-19.el7.x86_64.rpm                                              |  32 kB  00:00:14     
(7/14): libsepol-devel-2.5-10.el7.x86_64.rpm                                                   |  77 kB  00:00:03     
(8/14): libselinux-devel-2.5-15.el7.x86_64.rpm                                                 | 187 kB  00:00:04     
(9/14): pcre-devel-8.32-17.el7.x86_64.rpm                                                      | 480 kB  00:00:02     
(10/14): libverto-devel-0.2.5-4.el7.x86_64.rpm                                                 |  12 kB  00:00:06     
(11/14): openssl-1.0.2k-26.el7_9.x86_64.rpm                                                    | 494 kB  00:00:07     
(12/14): zlib-devel-1.2.7-21.el7_9.x86_64.rpm                                                  |  50 kB  00:00:00     
(13/14): zlib-1.2.7-21.el7_9.x86_64.rpm                                                        |  90 kB  00:00:04     
(14/14): openssl-devel-1.0.2k-26.el7_9.x86_64.rpm                                              | 1.5 MB  00:00:06     
----------------------------------------------------------------------------------------------------------------------
总计                                                                                  165 kB/s | 5.0 MB  00:00:30     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : krb5-libs-1.15.1-55.el7_9.x86_64                                                                 1/18 
  正在更新    : libkadm5-1.15.1-55.el7_9.x86_64                                                                  2/18 
  正在更新    : zlib-1.2.7-21.el7_9.x86_64                                                                       3/18 
  正在安装    : zlib-devel-1.2.7-21.el7_9.x86_64                                                                 4/18 
  正在安装    : libcom_err-devel-1.42.9-19.el7.x86_64                                                            5/18 
  正在安装    : pcre-devel-8.32-17.el7.x86_64                                                                    6/18 
  正在安装    : libsepol-devel-2.5-10.el7.x86_64                                                                 7/18 
  正在安装    : libselinux-devel-2.5-15.el7.x86_64                                                               8/18 
  正在安装    : libverto-devel-0.2.5-4.el7.x86_64                                                                9/18 
  正在安装    : keyutils-libs-devel-1.5.8-3.el7.x86_64                                                          10/18 
  正在安装    : krb5-devel-1.15.1-55.el7_9.x86_64                                                               11/18 
  正在安装    : 1:openssl-devel-1.0.2k-26.el7_9.x86_64                                                          12/18 
  正在安装    : 1:openssl-1.0.2k-26.el7_9.x86_64                                                                13/18 
  正在更新    : krb5-workstation-1.15.1-55.el7_9.x86_64                                                         14/18 
  清理        : krb5-workstation-1.15.1-50.el7.x86_64                                                           15/18 
  清理        : libkadm5-1.15.1-50.el7.x86_64                                                                   16/18 
  清理        : krb5-libs-1.15.1-50.el7.x86_64                                                                  17/18 
  清理        : zlib-1.2.7-18.el7.x86_64                                                                        18/18 
  验证中      : 1:openssl-devel-1.0.2k-26.el7_9.x86_64                                                           1/18 
  验证中      : libselinux-devel-2.5-15.el7.x86_64                                                               2/18 
  验证中      : keyutils-libs-devel-1.5.8-3.el7.x86_64                                                           3/18 
  验证中      : libverto-devel-0.2.5-4.el7.x86_64                                                                4/18 
  验证中      : libkadm5-1.15.1-55.el7_9.x86_64                                                                  5/18 
  验证中      : krb5-libs-1.15.1-55.el7_9.x86_64                                                                 6/18 
  验证中      : krb5-workstation-1.15.1-55.el7_9.x86_64                                                          7/18 
  验证中      : krb5-devel-1.15.1-55.el7_9.x86_64                                                                8/18 
  验证中      : libsepol-devel-2.5-10.el7.x86_64                                                                 9/18 
  验证中      : pcre-devel-8.32-17.el7.x86_64                                                                   10/18 
  验证中      : libcom_err-devel-1.42.9-19.el7.x86_64                                                           11/18 
  验证中      : zlib-devel-1.2.7-21.el7_9.x86_64                                                                12/18 
  验证中      : zlib-1.2.7-21.el7_9.x86_64                                                                      13/18 
  验证中      : 1:openssl-1.0.2k-26.el7_9.x86_64                                                                14/18 
  验证中      : zlib-1.2.7-18.el7.x86_64                                                                        15/18 
  验证中      : krb5-workstation-1.15.1-50.el7.x86_64                                                           16/18 
  验证中      : krb5-libs-1.15.1-50.el7.x86_64                                                                  17/18 
  验证中      : libkadm5-1.15.1-50.el7.x86_64                                                                   18/18 

已安装:
  openssl.x86_64 1:1.0.2k-26.el7_9                       openssl-devel.x86_64 1:1.0.2k-26.el7_9                      

作为依赖被安装:
  keyutils-libs-devel.x86_64 0:1.5.8-3.el7                    krb5-devel.x86_64 0:1.15.1-55.el7_9                    
  libcom_err-devel.x86_64 0:1.42.9-19.el7                     libselinux-devel.x86_64 0:2.5-15.el7                   
  libsepol-devel.x86_64 0:2.5-10.el7                          libverto-devel.x86_64 0:0.2.5-4.el7                    
  pcre-devel.x86_64 0:8.32-17.el7                             zlib-devel.x86_64 0:1.2.7-21.el7_9                     

作为依赖被升级:
  krb5-libs.x86_64 0:1.15.1-55.el7_9   krb5-workstation.x86_64 0:1.15.1-55.el7_9   libkadm5.x86_64 0:1.15.1-55.el7_9  
  zlib.x86_64 0:1.2.7-21.el7_9        

完毕!
[root@k8s-node01 keepalived-2.2.4]# 

8.2 安装libnl libnl-devel

rpm包下载地址:

libnl3: http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/libnl3-3.5.0-1.el8.x86_64.rpm

libnl3-devel:http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/libnl3-devel-3.5.0-1.el8.x86_64.rpm

rpm -ivh libnl3-devel-3.5.0-1.el8.x86_64.rpm

rpm -ivh libnl3-3.5.0-1.el8.x86_64.rpm

[root@whxxh-87 ~/xiaoran]#  rpm -ivh libnl3-devel-3.5.0-1.el8.x86_64.rpm 
warning: libnl3-devel-3.5.0-1.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:libnl3-devel-3.5.0-1.el8         ################################# [100%]

再次编译

[root@k8s-node01 keepalived-2.2.4]#  ./configure --prefix=/usr/local/keepalived
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking whether make sets $(MAKE)... (cached) yes
checking for ranlib... ranlib
checking for grep that handles long lines and -e... /usr/bin/grep
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for strip... strip
checking for ldd... ldd
checking for ar... ar
checking the archiver (ar) interface... ar
checking if using GCC Link Time Optimisation... no
checking msghdr.msg_controllen is size_t... yes
checking diagnostic pragmas in functions... yes
checking diagnostic push/pop pragmas... yes
checking for -Wall... yes
checking for -Wextra... yes
checking for -Wunused... yes
checking for -Wstrict-prototypes... yes
checking for -Wabi... no
checking for -Wabsolute-value... no
checking for -Waddress-of-packed-member... no
checking for -Walloca... yes
checking for -Walloc-larger-than=4096... no
checking for -Walloc-zero... yes
checking for -Warith-conversion... no
checking for -Warray-bounds=2... yes
checking for -Wattribute-alias=2... no
checking for -Wbad-function-cast... yes
checking for -Wc11-c2x-compat... no
checking for -Wcast-align... yes
checking for -Wcast-qual... yes
checking for -Wchkp... yes
checking for -Wdate-time... yes
checking for -Wdisabled-optimization... yes
checking for -Wdouble-promotion... yes
checking for -Wduplicated-branches... yes
checking for -Wduplicated-cond... yes
checking for -Wfloat-conversion... yes
checking for -Wfloat-equal... yes
checking for -Wformat-overflow... yes
checking for -Wformat-security... no
checking for -Wformat-signedness... yes
checking for -Wformat-truncation... yes
checking for -Wframe-larger-than=5120... yes
checking for -Wimplicit-fallthrough=3... yes
checking for -Winit-self... yes
checking for -Winline... yes
checking for -Winvalid-pch... yes
checking for -Wjump-misses-init... yes
checking for -Wlogical-op... yes
checking for -Wmissing-declarations... yes
checking for -Wmissing-field-initializers... yes
checking for -Wmissing-include-dirs... yes
checking for -Wmissing-prototypes... yes
checking for -Wnested-externs... yes
checking for -Wnormalized... yes
checking for -Wnull-dereference... yes
checking for -Wold-style-definition... yes
checking for -Woverlength-strings... yes
checking for -Wpointer-arith... yes
checking for -Wredundant-decls... yes
checking for -Wshadow... yes
checking for -Wshift-overflow=2... yes
checking for -Wstack-protector... yes
checking for -Wstrict-overflow=4... yes
checking for -Wstringop-overflow=2... yes
checking for -Wstringop-truncation... yes
checking for -Wsuggest-attribute=cold... yes
checking for -Wsuggest-attribute=const... no
checking for -Wsuggest-attribute=format... yes
checking for -Wsuggest-attribute=malloc... yes
checking for -Wsuggest-attribute=noreturn... yes
checking for -Wsuggest-attribute=pure... yes
checking for -Wsync-nand... yes
checking for -Wtrampolines... yes
checking for -Wundef... yes
checking for -Wuninitialized... yes
checking for -Wunknown-pragmas... yes
checking for -Wunsafe-loop-optimizations... yes
checking for -Wunsuffixed-float-constants... yes
checking for -Wunused-const-variable=2... yes
checking for -Wunused-macros... no
checking for -Wvariadic-macros... yes
checking for -Wwrite-strings... yes
checking for function __attribute__((error(msg))) support... no
checking for function __attribute__((warn_unused_result)) support... yes
checking for PIE support... yes
checking for -Wformat -Werror=format-security support... yes
checking for -Wp,-D_FORTIFY_SOURCE=2 support... yes
checking for -fexceptions support... yes
checking for -fstack-protector-strong support... yes
checking for --param=ssp-buffer-size=4 support... yes
checking for -grecord-gcc-switches support... yes
checking for -Wl,-z,relro support... yes
checking for -Wl,-z,now support... yes
checking for -O2 support... yes
CFLAGS=-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 -fno-strict-aliasing -fPIE -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -O2
checking for unaligned memory access... yes
checking for unaligned memory access causes warnings... no
checking for clock_gettime() requires -lrt... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for vfork.h... no
checking for arpa/inet.h... yes
checking for fcntl.h... yes
checking for limits.h... yes
checking for netdb.h... yes
checking for netinet/in.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for sys/ioctl.h... yes
checking for sys/param.h... yes
checking for sys/prctl.h... yes
checking for sys/socket.h... yes
checking for sys/time.h... yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking linux/errqueue.h needs sys/time.h... no
checking for asm/types.h... yes
checking for linux/ethtool.h... yes
checking for linux/icmpv6.h... yes
checking for linux/if_ether.h... yes
checking for linux/if_packet.h... yes
checking for linux/ip.h... yes
checking for linux/sockios.h... yes
checking for linux/types.h... yes
checking for linux/fib_rules.h... yes
checking for linux/if_addr.h... yes
checking for linux/if_link.h... yes
checking for linux/if_arp.h... yes
checking for _Bool... yes
checking for stdbool.h that conforms to C99... yes
checking for inline... inline
checking for int64_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for an ANSI C-conforming const... yes
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for dup2... yes
checking for dup3... yes
checking for getcwd... yes
checking for gettimeofday... yes
checking for malloc... yes
checking for memmove... yes
checking for memset... yes
checking for realloc... yes
checking for select... yes
checking for setenv... yes
checking for socket... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strdup... yes
checking for strerror... yes
checking for strpbrk... yes
checking for strstr... yes
checking for strtol... yes
checking for strtoul... yes
checking for uname... yes
checking for vsyslog... yes
checking for memfd_create... yes
checking for gcc options needed to detect all undeclared functions... none needed
checking whether O_TMPFILE is declared... yes
checking whether ETHERTYPE_IPV6 is declared... yes
checking whether IPV6_MULTICAST_ALL is declared... no
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for openssl/md5.h... yes
checking for openssl/evp.h... yes
checking for SSL_CTX_new in -lssl... yes
checking for EVP_DigestInit_ex in -lcrypto... yes
checking for EVP_MD_CTX_new in -lcrypto... yes
checking SSL_set_tlsext_host_name() - may be a definition... yes
checking for SSL_CTX_set_verify_depth... yes
checking for SSL_set0_rbio... yes
checking for SSL_set0_wbio... yes
checking for OPENSSL_init_crypto... yes
checking for TLS_method... yes
checking for ERR_get_error_all... no
checking whether IPV4_DEVCONF_ARP_IGNORE is declared... yes
checking whether IPV4_DEVCONF_ACCEPT_LOCAL is declared... yes
checking whether IPV4_DEVCONF_RP_FILTER is declared... yes
checking whether IPV4_DEVCONF_ARPFILTER is declared... yes
checking for linux/rtnetlink.h... yes
checking for nl_socket_alloc in -lnl-3... yes
checking for genl_connect in -lnl-genl-3... yes
checking for netlink/netlink.h... yes
checking for netlink/genl/ctrl.h... yes
checking for netlink/genl/genl.h... yes
checking for magic_open in -lmagic... no
checking whether RTA_ENCAP is declared... yes
checking whether RTA_EXPIRES is declared... yes
checking whether RTA_NEWDST is declared... yes
checking whether RTA_PREF is declared... yes
checking whether FRA_SUPPRESS_PREFIXLEN is declared... yes
checking whether FRA_SUPPRESS_IFGROUP is declared... yes
checking whether FRA_TUN_ID is declared... yes
checking whether RTAX_CC_ALGO is declared... yes
checking whether RTAX_QUICKACK is declared... yes
checking whether RTEXT_FILTER_SKIP_STATS is declared... yes
checking whether FRA_L3MDEV is declared... yes
checking whether FRA_UID_RANGE is declared... yes
checking whether RTAX_FASTOPEN_NO_COOKIE is declared... yes
checking whether RTA_VIA is declared... yes
checking whether FRA_PROTOCOL is declared... yes
checking whether FRA_IP_PROTO is declared... yes
checking whether FRA_SPORT_RANGE is declared... yes
checking whether FRA_DPORT_RANGE is declared... yes
checking whether RTA_TTL_PROPAGATE is declared... yes
checking whether IFA_FLAGS is declared... yes
checking whether LWTUNNEL_ENCAP_MPLS is declared... yes
checking whether LWTUNNEL_ENCAP_ILA is declared... yes
checking for libiptc/libip6tc.h... no
checking whether NFTA_TABLE_MAX is declared... yes
configure: WARNING: libnftnl missing
configure: WARNING: libmnl missing
checking for linux/if.h and net/if.h namespace collision... yes
checking for linux/if_ether.h then netinet/in.h then linux/if.h namespace collision... no
checking for linux/if_ether.h then netinet/if_ether.h namespace collision... no
checking for libiptc/libiptc.h linux/if.h and net/if.h namespace collision... yes
checking whether IPVS_DEST_ATTR_ADDR_FAMILY is declared... yes
checking whether IPVS_DAEMON_ATTR_SYNC_MAXLEN is declared... yes
checking whether IPVS_DAEMON_ATTR_MCAST_GROUP is declared... yes
checking whether IPVS_DAEMON_ATTR_MCAST_GROUP6 is declared... yes
checking whether IPVS_DAEMON_ATTR_MCAST_PORT is declared... yes
checking whether IPVS_DAEMON_ATTR_MCAST_TTL is declared... yes
checking whether IPVS_SVC_ATTR_STATS64 is declared... yes
checking whether IPVS_DEST_ATTR_STATS64 is declared... yes
checking whether IPVS_DEST_ATTR_TUN_TYPE is declared... no
checking whether IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM is declared... no
checking whether IP_VS_CONN_F_TUNNEL_TYPE_GRE is declared... no
checking whether IFLA_IPVLAN_MODE is declared... yes
checking whether IPVLAN_MODE_L3S is declared... yes
checking whether IFLA_IPVLAN_FLAGS is declared... yes
checking whether GLOB_BRACE is declared... yes
checking whether GLOB_ALTDIRFUNC is declared... yes
checking for timegm()... yes
checking whether IFLA_INET6_ADDR_GEN_MODE is declared... yes
checking whether IFLA_VRF_MAX is declared... yes
checking whether SO_MARK is declared... yes
checking for sphinx-build... No
checking for rpm... Yes
checking for rpmbuild... Yes

checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating keepalived/Makefile
config.status: creating lib/Makefile
config.status: creating keepalived/core/Makefile
config.status: creating keepalived.spec
config.status: creating Dockerfile
config.status: creating keepalived/check/Makefile
config.status: creating keepalived/vrrp/Makefile
config.status: creating keepalived/bfd/Makefile
config.status: creating doc/Makefile
config.status: creating bin_install/Makefile
config.status: creating keepalived/dbus/Makefile
config.status: creating keepalived/etc/Makefile
config.status: creating keepalived/etc/init/Makefile
config.status: creating keepalived/etc/init.d/Makefile
config.status: creating keepalived/etc/sysconfig/Makefile
config.status: creating keepalived/etc/keepalived/Makefile
config.status: creating keepalived/trackers/Makefile
config.status: creating doc/man/man8/Makefile
config.status: creating doc/man/man5/Makefile
config.status: creating doc/man/man1/Makefile
config.status: creating lib/config.h
config.status: creating lib/config_warnings.h
config.status: lib/config_warnings.h is unchanged
config.status: executing depfiles commands

Keepalived configuration
------------------------
Keepalived version       : 2.2.8
Compiler                 : gcc gcc (GCC) 8.3.1 20191121 (Anolis 8.3.1-5.0.1)
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 -fno-strict-aliasing -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 -lssl -lcrypto -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 NetworkManager       : No
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
[root@k8s-node01 keepalived-2.2.4]#  

  • 3
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
安装部署keepalived的步骤如下: 1. 首先,准备一个centos7.7-x86操作系统环境,并将keepalived安装包上传到指定目录,比如/kp/keepalived。 2. 使用以下命令进行编译安装: ``` ./configure --prefix=/data/keepalived --sysconf=/etc #### 引用[.reference_title] - *1* [linux安装部署keepalived,利用keepalived多台nginx虚拟IP浮动](https://download.csdn.net/download/weixin_38639747/14052657)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [keepalived安装部署](https://blog.csdn.net/huanglm_OneWholeLife/article/details/124530257)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Keepalived安装部署](https://blog.csdn.net/weixin_44218180/article/details/120535998)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值