编译安装keepalived1.2.7

编译安装keepalived1.2.7

   张吉吉     2019年12月17日 02:26     1786    

(1)安装Keepalived

keepalived安装包地址:

http://www.keepalived.org/software/keepalived-1.2.7.tar.gz

tar -zxvf keepalived-1.2.7.tar.gz

下载解压后编译配置

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

--with-kernel-dir

这是一个相当重要的参数,他不是讲keepalived编译进内核当中,而是实现利用kernel源码中的include文件。此参数要在keepalived和lvs配合使用中才有重要意义。

编译配置需要确保一下几项为Yes状态:

Use IPVS Framework : Yes 

IPVS sync daemon support : Yes 

IPVS use libnl : Yes 

Use VRRP Framework : Yes

然后就可以编译安装了:

make && make install

 

(2)在keepalived1.2.7的版本中拷贝以下目录

因为没有使用keepalived的默认路径安装(默认是/usr/local),安装完成之后,需要做一些工作

cp /usr/local/keepalived/sbin/keepalived /usr/sbin/

#复制keepalived启动文件到默认路径,也可以通过设置环境变量的path实现

cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/

#复制服务启动脚本到,以便可以通过service控制keepalived服务

cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/

#复制keepalived服务脚本到默认的地址,也通过修改init.d/keepalived文件中的相应配置实现

mkdir -p /etc/keepalived/

cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/

vi /etc/keepalived/keepalived.conf

#复制默认配置文件到默认路径,其实也可以在/etc/init.d/keepalived中设置路径

mkdir -p /usr/local/keepalived/var/log

#创建日志目录

 

(3)在keepalived1.4.0中拷贝以下目录

因为没有使用keepalived的默认路径安装(默认是/usr/local),安装完成之后,需要做一些工作

cp /usr/local/keepalived/sbin/keepalived /usr/sbin/

#复制keepalived启动文件到默认路径,也可以通过设置环境变量的path实现

cp /usr/local/src/keepalived-1.4.0/keepalived/etc/init.d/keepalived /etc/init.d/keepalived

#复制服务启动脚本到,以便可以通过service控制keepalived服务

cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/

在这个文件中添加自己需要的参数,一般都需要加上‘-f 配置文件位置’

#复制keepalived服务脚本到默认的地址,也通过修改init.d/keepalived文件中的相应配置实现

mkdir -p /etc/keepalived/

cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/

vi /etc/keepalived/keepalived.conf

#复制默认配置文件到默认路径,其实也可以在/etc/init.d/keepalived中设置路径

mkdir-p/usr/local/keepalived/var/log

#创建日志目录

 

(4)启动

chkconfig --add keepalived

chkconfig keepalived on

service keepalived start

#开机启动服务


文章评论

0

其他文章