设为首页 收藏本站
查看: 2298|回复: 0

[经验分享] lvs+keepalived离线安装包安装

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-9-2 11:13:24 | 显示全部楼层 |阅读模式
一、ipvsadm安装1,安装环境centos7.0内核3.10.0-327.el7.x86_64 。需安装gcc
1
[iyunv@localhost ~]# yum -y install gcc



未避免安装过程安全其他依赖,可在安装系统时选择如下几个组件:
wKioL1fH0HzgZfZ0AAA-DJ2pRLw484.jpg
wKiom1fH0H3Aax07AABjkkVw6rE348.jpg
2,下载ipvsadm安装包(下载1.27版本)https://kernel.org/pub/linux/utils/kernel/ipvsadm/
3,解压、编译、安装
1
2
3
[iyunv@localhost ~]# tar -Jxvf ipvsadm-1.27.tar.xz
[iyunv@localhost ~]# cd ipvsadm-1.27
[iyunv@localhost ipvsadm-1.27]# make && make install



4,可能出现如下错误:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[iyunv@localhost ipvsadm-1.27]# make &make install
[1] 14264
make -C libipvs
make -C libipvs
make[1]: Entering directory`/root/ipvsadm-1.27/libipvs'
gcc -Wall -Wunused -Wstrict-prototypes -g-fPIC -DLIBIPVS_USE_NL  -DHAVE_NET_IP_VS_H  -c -olibipvs.o libipvs.c
make[1]: Entering directory`/root/ipvsadm-1.27/libipvs'
gcc -Wall -Wunused -Wstrict-prototypes -g-fPIC -DLIBIPVS_USE_NL  -DHAVE_NET_IP_VS_H  -c -olibipvs.o libipvs.c
In file included from libipvs.h:13:0,
                 from libipvs.c:23:
ip_vs.h:15:29: fatal error:netlink/netlink.h: No such file or directory
#include <netlink/netlink.h>
                            ^
compilation terminated.
In file included from libipvs.h:13:0,
                 from libipvs.c:23:
ip_vs.h:15:29: fatal error:netlink/netlink.h: No such file or directory
#include <netlink/netlink.h>
                             ^
compilation terminated.
make[1]: *** [libipvs.o] Error 1
make[1]: Leaving directory`/root/ipvsadm-1.27/libipvs'
make: *** [libs] Error 2
make[1]: *** [libipvs.o] Error 1
make[1]: Leaving directory`/root/ipvsadm-1.27/libipvs'
make: *** [libs] Error 2
[1]+ Exit 2                  make



解决方法是安装如下软件:
1
2
[iyunv@localhost ipvsadm-1.27]# yum installpopt-static
[iyunv@localhost ipvsadm-1.27]# yum installlibnl* libpopt*




二、keepalived安装1)软件下载(下载1.2.13版本)http://www.keepalived.org/software/
2)解压、配置、编译、安装
1
2
3
4
[iyunv@localhost ~]# tar -zxvf keepalived-1.2.13\ \(1\).tar.gz
[iyunv@localhost ~]# cd keepalived-1.2.13
[iyunv@localhost keepalived-1.2.13]#./configure --prefix=/usr/local/keepalived
[iyunv@localhost keepalived-1.2.13]# make && make install



3)编译时可能会出现如下错误1
1
2
3
configure: error:
  !!!OpenSSL is not properly installed on your system. !!!
  !!!Can not include OpenSSL headers files.            !!!



解决方法:
1
[iyunv@localhost keepalived-1.2.13]# yuminstall -y openssl openssl-devel




4)编译过程可能会出现如下错误2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[iyunv@localhost keepalived-1.2.13]# make
make -C lib || exit 1;
make[1]: Entering directory`/root/keepalived-1.2.13/lib'
gcc -g -O2 -DFALLBACK_LIBNL1 -I. -Wall-Wunused -Wstrict-prototypes -D_WITHOUT_SNMP_ -c command.c
make[1]: Leaving directory`/root/keepalived-1.2.13/lib'
make -C keepalived
make[1]: Entering directory`/root/keepalived-1.2.13/keepalived'
make[2]: Entering directory`/root/keepalived-1.2.13/keepalived/core'
gcc -g -O2 -DFALLBACK_LIBNL1  -I/usr/src/linux/include -I/usr/src/linux/include-I../include -I../../lib -Wall -Wunused -Wstrict-prototypes -D_KRNL_2_6_-D_WITH_LVS_ -D_WITH_VRRP_ -D_WITHOUT_SNMP_ -D_WITH_SO_MARK_  -c main.c
gcc -g -O2 -DFALLBACK_LIBNL1  -I/usr/src/linux/include-I/usr/src/linux/include -I../include -I../../lib -Wall -Wunused-Wstrict-prototypes -D_KRNL_2_6_ -D_WITH_LVS_ -D_WITH_VRRP_ -D_WITHOUT_SNMP_-D_WITH_SO_MARK_  -c smtp.c
In file included from/usr/include/linux/if_addr.h:4:0,
                 from../include/vrrp_ipaddress.h:33,
                 from ../include/vrrp.h:31,
                 from ../include/smtp.h:34,
                 from smtp.c:27:
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
/usr/src/linux/include/linux/linkage.h:7:25:fatal error: asm/linkage.h: No such file or directory
#include <asm/linkage.h>
                         ^
compilation terminated.
make[2]: *** [smtp.o] Error 1
make[2]: Leaving directory`/root/keepalived-1.2.13/keepalived/core'
make[1]: *** [all] Error 1
make[1]: Leaving directory`/root/keepalived-1.2.13/keepalived'
make: *** [all] Error 2



解决方法:
去掉如下符号链接(之前配置符号链接ln -s /usr/src/kernels/3.10.0-229.el7.x86_64/ /usr/src/linux)
1
[iyunv@localhost keepalived-1.2.13]# rm -rf /usr/src/linux



5)配置
1
2
3
4
5
[iyunv@localhost keepalived]#cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
[iyunv@localhost keepalived]#cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
[iyunv@localhost keepalived]#mkdir /etc/keepalived
[iyunv@localhost keepalived]#cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
[iyunv@localhost keepalived]#cp /usr/local/keepalived/sbin/keepalived /usr/sbin/



6)修改配置文件/etc/keepalived/keepalived.conf
7)启动服务并开启开机自启动
1
2
3
[iyunv@localhost keepalived]# service keepalived
Usage: /etc/init.d/keepalived{start|stop|reload|restart|condrestart|status}
[iyunv@localhost keepalived]# chkconfig keepalived on



8)启动可能出现如下错误3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[iyunv@localhost ~]# service keepalived status
keepalived.service - SYSV:Start and stop Keepalived
  Loaded: loaded (/etc/rc.d/init.d/keepalived)
  Active: failed (Result: exit-code) since Wed 2016-08-31 07:22:19 EDT;5min ago
    Docs: man:systemd-sysv-generator(8)
Process: 2405 ExecStart=/etc/rc.d/init.d/keepalived start (code=exited,status=1/FAILURE)

Aug 31 07:22:19 localhost.localdomainsystemd[1]: Starting SYSV: Start and stop Keepalived...
Aug 31 07:22:19 localhost.localdomainkeepalived[2405]: Starting keepalived: /bin/bash: keepalived: command not found
Aug 31 07:22:19 localhost.localdomainkeepalived[2405]: [FAILED]
Aug 31 07:22:19 localhost.localdomainsystemd[1]: keepalived.service: control process exited, code=exited status=1
Aug 31 07:22:19 localhost.localdomainsystemd[1]: Failed to start SYSV: Start and stop Keepalived.
Aug 31 07:22:19 localhost.localdomainsystemd[1]: Unit keepalived.service entered failed state.
Aug 31 07:22:19 localhost.localdomainsystemd[1]: keepalived.service failed.



解决方法:
1
[iyunv@localhost ~]# ln -s/usr/local/keepalived/sbin/keepalived /usr/sbin/



其中/usr/local/keepalived/为软件安装目录。



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-266658-1-1.html 上篇帖子: lvs+keepalived自定义健康检查脚本(MISC_CHECK用法) 下篇帖子: LVS的DR模式配置 离线
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表