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

KeepAlived 安装

时间:2018-11-18 13:11:53      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:www.   环境   dev   软连接   ssl   开机   关于   http   nss   

yum install -y gcc gcc-c++ openssl openssl-devel

目前keepalived最新版本下载:
[root@rhel ~]#wget -c http://www.keepalived.org/software/keepalived-1.2.12.tar.gz
[root@rhel ~]# tar zxvf keepalived-1.2.12.tar.gz
[root@rhel ~]# cd keepalived-1.2.12
安装编译环境:
[root@rhel ~]# yum install -y gcc gcc-c++ openssl openssl-devel
1

[root@rhel keepalived-1.2.12]# ./configure --prefix=/usr/local/keepalived //指定安装路径

[root@rhel keepalived-1.2.12]# make && make install //安装
将keepalived命令软连接到/usr/bin下
[root@rhel keepalived-1.2.12]# ln -s /usr/local/keepalived/sbin/keepalived /usr/bin/keepalived

添加启动脚本且方便用service keepalived start/stop/restart管理(如果没有init.d/keepalived则从源码目录拷贝)
[root@rhel keepalived-1.2.12]# cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/keepalived
[root@rhel keepalived-1.2.12]# chmod 755 /etc/init.d/keepalived //添加执行权限
[root@rhel keepalived-1.2.12]# chkconfig keepalived on //开机启动

修改/etc/init.d/keepalived中的程序路径
# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /etc/sysconfig/keepalived

改为:
# Source configuration file (we set KEEPALIVED_OPTIONS there)
. /usr/local/keepalived/etc/sysconfig/keepalived

默认情况下,keepalived 会读取 /etc/keepalived 下keepalived.conf 文件
如果没有建立这个文件,keepalived也不会报错,但是会发现,所创建的关于keepalived的相关参数根本就没有生效。
[root@rhel keepalived-1.2.12]# mkdir /etc/keepalived
[root@rhel keepalived-1.2.12]# ln -s /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf

启动测试:
[root@rhel keepalived-1.2.12]# service keepalived restart
停止 keepalived: [确定]
启动 keepalived: [确定]

安装完成

service keepalived restart
service keepalived stop
service keepalived start

systemctl start keepalived
systemctl restart keepalived
systemctl stop keepalived

KeepAlived 安装

标签:www.   环境   dev   软连接   ssl   开机   关于   http   nss   

原文地址:https://www.cnblogs.com/littlewrong/p/9977532.html

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