1.安装依赖
yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
2.下载安装包
官网地址: https://www.keepalived.org/download.html
3.解压
tar -xzvf keepalived-2.0.17.tar.gz
4.切换目录
cd keepalived-2.0.17
5.配置安装
./configure --prefix=/usr/local/keepalived
6.编译
make && make install
7.配置服务
mkdir /etc/keepalived
cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
ln -s /usr/local/keepalived/sbin/keepalived /sbin/
常用命令
1.systemctl start keepalived.service 启动
2.systemctl restart keepalived.service 重启
3.systemctl stop keepalived.service 关闭
4.systemctl enable keepalived.service 设置开机自动启动
5.systemctl disable keepalived.service 取消开机自动启动