一、环境介绍

系统版本:Centos7.8

zabbix版本:zabbix_server (Zabbix) 5.0.21

二、问题现象

在安装zabbix过程中,使用systemctl start ​zabbix​-agent命令启动zabbix-agent服务时一直提示:

Job for zabbix-agent.service failed because a configured resource limit was exceeded. See
"systemctl status zabbix-agent.service" and "journalctl -xe" for details.

根据提示用“journalctl -xe” 命令查看报错日志:

zabbix_server[12859]: Starting zabbix_server: /usr/local/zabbix/sbin/zabbix_server: 
error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory
三、解决思路

看到报错信息之后在去网上看到创建软链接也无法解决,终于看到一个博主分析到应该是openssl 版本有问题,于是我检查了下本地系统安装的openssl版本解决报错libssl.so.1.1: cannot open shared object file: No such file or directory_安装zabbix报错,是1.0.2k版本的不是1.1.1版本,就根据他的思路去解决。

解释:

Centos7 默认提供的 openssl 版本是 1.0.2 的,某些 php 扩展或者其他软件依赖 1.1 以上版本,如果过低的话就会报错 libssl.so.1.1: cannot open shared object file: No such file or directory,也有执行 openssl version 时报错和上面一致,这是由于 openssl 库的位置不正确或未安装 1.1 以上版本的问题,想要升级 openssl 版本则需要手动进行编译,报错解决方式很简单,安装正确即可。

1. 下载 openssl

从​​腾讯云的镜像​​​​下载最新的代码包,也可以到​​openssl 官网​​下载​

解决报错libssl.so.1.1: cannot open shared object file: No such file or directory_zabbix-agent无法启动_02

解决报错libssl.so.1.1: cannot open shared object file: No such file or directory_安装zabbix报错_03

2、下载安装包上传到centos系统中,可以放到根目录下执行编译

解决报错libssl.so.1.1: cannot open shared object file: No such file or directory_zabbix-agent无法启动_04

tar -xvf openssl-1.1.1m.tar.gz
cd openssl-1.1.1m
./config shared --openssldir=/usr/local/openssl --prefix=/usr/local/openssl
make && make install

编译完成后,使用 ​openssl version​ 来查看一下当前 openssl 版本号时,你会发现还是 1.0.2,所以这里需要做一些额外的配置工作

3、​配置

echo "/usr/local/lib64/" >> /etc/ld.so.conf
ldconfig

再次使用 ​openssl version​ 验证版本就可以了,如果不行,可以尝试下面的方式,依次执行(先备份老版本,再从新版本安装位置创建软连接),注意openssl安装路径,使用find / -name openssl*查看,替换到下面的执行命令上

解决报错libssl.so.1.1: cannot open shared object file: No such file or directory_安装zabbix报错_05

mv /usr/bin/openssl /usr/bin/openssl.old
mv /usr/lib64/openssl /usr/lib64/openssl.old
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
ldconfig -v

安装完成之后就启动zabbix-agent服务,还是启动不了就用journalctl -xe命令查看具体报错日志,根据报错安装相应的软件