1、keepalived安装

下载离线安装包,下载地址,并把安装包上传到服务器上并解压。

tar -zxvf keepalived-2.2.7.tar.gz

进入安装包中,进行编译及安装

cd /data/keepalived/keepalived-2.2.7

./configure --prefix=/data/keepalived --sysconf=/etc

make

make install

生成以下几个文件,这样keepalived我们就安装好了

2、启动服务

3、异常解决

编译过程中出现以下提示错误,解决办法

1)提示 "!!! OpenSSL is not properly installed on your system. !!!
          !!! Can not include OpenSSL headers files."
     需要安装openssl-devel:

安装包下载

安装命令:

yum -y install openssl-devel或yum install openssl-devel

 2)提示 ”Keepalive popt libraries is required “
    需要安装popt:

     安装包下载

    安装命令:
    ./configure  
     make && make install

3)如果./configure就提示GCC NO

      需要安装gcc

      安装包下载

      安装命令:

     yum -y install openssl-devel或yum install openssl-devel

4)当编译提示如下:

     Keepalived configuration
     ------------------------
     Keepalived version       : 2.2.7
     Compiler                 : gcc
     Compiler flags           : -g -O2
     Extra Lib                : -lpopt -lssl -lcrypto 
     Use IPVS Framework       : No
     IPVS sync daemon support : No
     Use VRRP Framework       : Yes
     Use Debug flags          : No
     这两个出现NO,说明keepalived没有找到内核,可先查看/usr/src/kernels 目录下是否有文件,如没有可先安装kernel-devel ,然后通过如下方式解决:
    方法一:编译时可加入参数 --with-kernel-dir=/usr/src/kernels/3.10.0-327.el7.x86_64/  内核地址
    方法二:由于keepalived编译时默认从/usr/src/linux这个位置找内核,所以可以建立一个链接

    注意修改路径,有时候不同

   1 yum -y install kernel-devel
   2  ./configure --with-kernel-dir=/usr/src/kernels/3.10.0-327.el7.x86_64/
   3 ln -s /usr/src/kernels/3.10.0-327.el7.x86_64/  /usr/src/linux

5)systemctl start keepalived启动异常

   Job for keepalived.service failed because the control process exited with error code. See "systemctl status keepalived.service" and "journalctl -xe" for details.

   解决方案:

   进入:cd /etc/keepalived

   把keepalived.conf.sample改成keepalived.conf

   重新执行启动命令:systemctl start keepalived或./keepalived

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐