码迷,mamicode.com
首页 > 其他好文 > 详细

编译安装LVS和Keepalived-2.0.9

时间:2020-05-25 15:37:44      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:grep   lease   lse   编译   message   com   编译安装   var   keepalive   

操作系统Centos7,关闭selinux,关闭防火墙

1、备份和修改基础仓库到163
yum install wget -y && cd /etc/yum.repos.d/ && mv CentOS-Base.repo CentOS-Base.repo.back
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

2、安装epel仓库和修改epel仓库地址到阿里云
yum install epel-release -y
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

3、安装开发环境
yum group list
yum group install Development Tools -y

4、下载lvs源码包
wget -O /usr/local/src/ipvsadm-1.26.tar.gz http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.26.tar.gz
yum install ipvsadm -y #(推荐安装方法,这种方法版本比较高)

5、下载keepalived源码包
wget -O /usr/local/src/keepalived-2.0.19.tar.gz https://www.keepalived.org/software/keepalived-2.0.19.tar.gz

6、安装依赖环境
yum -y install libnl-devel popt-devel popt-static openssl-devel libnfnetlink-devel

7、编译安装lvs
tar zxf /usr/local/src/ipvsadm-1.26.tar.gz -C /usr/local/src
cd /usr/local/src/ipvsadm-1.26
make && make install
(yum 安装不需要编译)

8、测试ipvsadm 和检测lvs 的ip_vs
ipvsadm -L -n
lsmod | grep ip_vs

9、编译安装keepalived
tar zxf /usr/local/src/keepalived-2.0.19.tar.gz -C /usr/local/src
cd /usr/local/src/keepalived-2.0.19
./configure --prefix=/usr/local/keepalived
make && make install
mkdir /etc/keepalived
cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
cp /usr/local/src/keepalived-2.0.19/keepalived/etc/init.d/keepalived /etc/init.d/
cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
cp /usr/local/keepalived/sbin/keepalived /usr/sbin/

测试keepalived
/etc/init.d/keepalived start
ps axu|grep keepalived
tail -f /var/log/message

编译安装LVS和Keepalived-2.0.9

标签:grep   lease   lse   编译   message   com   编译安装   var   keepalive   

原文地址:https://blog.51cto.com/iuiely/2498192

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!