Keepalived 安装

Keepalived 安装

1、下载

https://www.keepalived.org/download.html

2、上传到linux中,/home/software

3、解压

tar -zxvf keepalived-2.0.18.tar.gz

4、进入到解压后的目录进行configure配置

./configure --prefix=/usr/local/keepalived --sysconf=/etc
  • prefix:Keepalived的安装位置;
  • sysconf:Keepalived的核心配置文件所在位置,固定位置,如果修改会导致启动不了。
  • configure配置过程中可能会出现如下警告信息:
    *** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS.
    
    解决办法:安装libnl/libnl-3依赖,然后重新configure
    yum -y install libnl libnl-devel
    

5、configure配置完成后,开始安装Keepalived

make && make install

至此安装结束!

6、文件位置

通过 whereis keepalived 命令,可以找到keepalived位置
Keepalived 安装

  • /etc/keepalived为核心配置文件的位置;
    Keepalived 安装
  • /usr/local/keepalived为keepalived安装的位置。
    Keepalived 安装

7、Keepalived注册为系统服务

Keepalived的启动是在keepalived/sbin/目录下执行命令./keepalived,启动后关闭只能杀死进程,非常不方便,因此我们可以将Keepalived注册为系统服务,这样就可以方便的开启、关闭和重启。

1、进入到keepalived安装包解压后的文件夹
cd /home/software/keepalived-2.0.18/keepalived/etc/

2、复制服务配置文件
cp init.d/keepalived /etc/init.d/
cp sysconfig/keepalived /etc/sysconfig/

3、重新加载服务配置文件
systemctl daemon-reload

4、注册服务就完成了
启动keepalived:systemctl start keepalived.service
关闭keepalived:systemctl stop keepalived.service
重启keepalived:systemctl restart keepalived.service

Keepalived 安装

上一篇:790. 数的三次方根


下一篇:Harbor私有镜像仓库搭建