Centos 部署安装keepalived

一:环境部署前准备:

1.1相关软件以及系统

系统要求:Centos 6.6 (64位)

相关中间件:Keepalived:1.2.15 

1.2检查keepalived所需要的依赖包是否已经安装

# rpm -qa | grep popt       //(安装keepalived需要popt支持)

# rpm -qa | grep openssl     //(安装keepalived需要openssl支持)

注意:如不知道keepalived需要哪些依赖包,可到下载后的源码解压目录下查看INSTALL 文件内容,安装需要的依赖包,源码安装任何一个软件都要养成查看源码包文档的习惯,比如INSTALL,README,doc等文档,可以获得很多有用的信息

1.3如若没有安装以上依赖包,可使用yum安装相关依赖包,如下

# yum install openssl  openssl-devel  popt popt-devel

 

二:源码编译安装keepalived:

2.1下载keepalived源码包并解压

# wget http://www.keepalived.org/software/keepalived-1.2.15.tar.gz

# tar zxvf keepalived-1.2.15.tar.gz -C /usr/local/src

2.2编译安装keepalived

# cd /usr/local/src/keepalived-1.2.15/

# ./configure \

--prefix=/usr/local/keepalived \

--sbindir=/usr/local/keepalived/sbin  

# make

# make install

2.3对keepalived进行相关优化

<---拷贝keepalived相关启动命令--->

# cp /usr/local/keepalived/sbin/keepalived /usr/sbin/

# cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/

<---将keepalived启动脚本添加到系统服务--->

# cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/

# chkconfig --add keepalived

# chkconfig --level 2345 keepalived on

<---创建keepalived相关配置文件--->

# mkdir -p /etc/keepalived

# cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived

备注说明:

1. keepalived安装完成后,安装目录为:/usr/lccal/keepalived, 配置文件路径为:/etc/keepalive/

2. 安装完成后,需要将启动脚本复制到/etc/ini.d/下

3.注意一定要执行述上的相关操作,不然有可能导致keepalived服务起不来

 

三:启动keepalived服务

# service keepalived start

如果keepalived已经启动,这时我们就可以查看以下命令查看启动情况:

# service keepalived status  

# ps aux | grep keepalived

 

到这里,keepalived部署基本OK,如需要部署lvs参照相关文档即可!

你可能感兴趣的:(Linux下服务安装)