您好,登录后才能下订单哦!
使用源码先安装keepalived 1.2.6
cd/usr/local/src
wget http://www.keepalived.org/software/keepalived-1.2.6.tar.gz
tarzxf keepalived-1.2.6.tar.gz
cdkeepalived-1.2.6
./configure--prefix=/usr/local/keepalived
make
makeinstall
所设keepalived安装到/usr/local/keepalived,则所有配置文件均位于此目录之下。我一直没搞明白一个问题,Linux默认总是将程序安装到/usr/local目录下,所有程序共享了/usr/local/sbin目录。这对一些人的操作习惯是有影响的。为何不考虑使用每个软件一个独立的目录呢?
1. 建立服务启动脚本,以便使用service命令控制之
cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/keepalived
chmod+x /etc/init.d/keepalived
因为我们使用非默认路径(/usr/local)安装keepalived, 故需要修改几处路径,以保证keepalived能正常启动, 需要修改的文件如下:
2. 修改/etc/init.d/keepalived,寻找大约15行左右的./etc/sysconfig/keepalived, 修改为:
. /usr/local/keepalived/etc/sysconfig/keepalived, 即指向正确的文件位置
同时在上述行下添加以下内容(将keepavlied主程序所在路径导入到环境变量PATH中):
PATH="$PATH:/usr/local/keepalived/sbin"
exportPATH
3. 修改/usr/local/keepalived/etc/sysconfig/keepalived文件,设置正确的服务启动参数
KEEPALIVED_OPTIONS="-D -f/usr/local/keepalived/etc/keepalived/keepalived.conf"
4. 经过以上修改,keepalived基本安装即可完成,启动测试之:
service keepalived restart
5. 切勿忘记将此服务设置为开机启动
chkconfigkeepalived on
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。