目录
1、安装环境
2、安装keepalived
2.1 上传keepalived安装文件
2.2 解压
2.3 安装keepalived
2.4 加入开机启动:
2.5 配置日志文件
2.6 打开防火墙的通讯地址
1、安装环境
su - root
yum -y install kernel-devel*
yum -y install openssl-*
yum -y install popt-devel
yum -y install lrzsz
yum -y install openssh-clients
yum -y install libnl libnl-devel popt
2、安装keepalived
2.1 上传keepalived安装文件
1、cd /usr/local/src/
2、mkdir keepalived
3、cd keepalived/
4、wget http://www.keepalived.org/software/keepalived-1.2.15.tar.gz 或者 rz 上传
2.2 解压
1、tar -xvf keepalived-1.2.15.tar.gz
2、cd keepalived-1.2.15
2.3 安装keepalived
1、cd keepalived
2、执行配置命令
./configure
3、编译
make
4、安装
make install
5、拷贝执行文件
cp /usr/local/sbin/keepalived /usr/sbin/
6、将init.d文件拷贝到etc下,加入开机启动项
cp /usr/local/etc/rc.d/init.d/keepalived /etc/init.d/keepalived
7、将keepalived文件拷贝到etc下,加入网卡配置
cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
8、创建keepalived文件夹
mkdir -p /etc/keepalived
9、将keepalived配置文件拷贝到etc下
cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf
10、添加可执行权限
chmod +x /etc/init.d/keepalived
2.4 加入开机启动:
chkconfig --add keepalived
chkconfig keepalived on
2.5 配置日志文件
1.将keepalived日志输出到local0:
vi /etc/sysconfig/keepalived
KEEPALIVED_OPTIONS="-D -d -S 0"
2.在/etc/rsyslog.conf里添加:
local0.* /var/log/keepalived.log
3.重新启动keepalived和rsyslog服务:
service rsyslog restart
service keepalived restart
2.6 打开防火墙的通讯地址
iptables -A INPUT -d 224.0.0.18 -j ACCEPT
/etc/rc.d/init.d/iptables save