系统升级,有3台服务器安装了mongodb服务,已经采用了集群方式搭建。现在需要借助keepalived工具,将虚拟ip自动映射到集群里主节点所在服务器的ip上。
接手一台redhat8的服务器,要给它安装keepalived,已经安装了openssl,可是执行第一步configure时总是报错:
!!!Openssl is not properly installed on your system.!!!
!!!Can not include OpenSSL headers files.
网上大多说是还需要安装openssl-devel,可是我通过yum去安装,根本就没有openssl-devel。专门下载这个rpm包来安装,又提示缺少一大堆依赖(我才不要去下载一个个依赖然后一个个的去安装)。
我从这里下载了epel8的rpm包,安装后,通过yum search openssl-devel仍然找不到,倒是却可以找到openssl3和openssl3-devel, 如下所示:
可是没卵用,把这两个都安装了,配置keepalived还是报同样的错误。
rpm ivh epel-release-8-22.el8.noarch.rpm
yum repolist enabled | grep epel
sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
epel:Extra Package For Exterprise Linux,企业级Linux扩展软件包
一开始的报错不是提示checking for openssl/ssl.h,找不到这个文件,于是我就尝试创建软链
ln -s /usr/include/openssl3/openssl/opensslconf.h /usr/include/openssl/opensslconf.h
ln -s /usr/include/openssl3/openssl/configuration.h /usr/include/openssl/configuration.h
ln -s /usr/include/openssl3/openssl/ssl.h /usr/include/openssl/ssl.h
仍然无效。
本文为翟码农个人博客Linux分类下的原创文章,转载请注明出处:http://www.zhai14.com/blog/always-pop-the-error-of-openssl-when-installing-keepalived.html
下载阿里云centos8的镜像配置文件:
cd /etc/yum.repos.d
wget http://mirrors.aliyun.com/repo/Centos-8.repo
将原本的配置重命名(意思就是不用它)
mv rhel.repo rhel.repo.bak
这个时候我再用yum search去查openssl-devel,结果真的就找到了。
安装openssl-devel提示缺少如下依赖:libverto libverto-devel krb5-devel,通过yum一条命令就可以全部安装了:
yum -y install libverto libverto-devel krb5-devel libnl3-devel
libnl3-devel是keepalived软件包里INSTALL安装说明文件指定要装的,没有装这个,就无法实现虚拟ip映射的功能。
接下来编译安装keepalived就很顺利了:
useradd -s /sbin/nologin keepalived_script
./configure --with-prefix=/usr/local/keepalived
make && make install