/usr/sbin/zabbix_agentd: error while loading shared libraries: libcurl.so.4

Problem Description: the following error is reported when starting ZABBIX agent:

[root@vm-172-16-1-113 ~]# systemctl start zabbix-agent
Job for zabbix-agent.service failed because the control process exited with error code. See "systemctl status zabbix-agent.service" and "journalctl -xe" for details.
[root@vm-172-16-1-113 ~]# journalctl -xe
-- Subject: Unit zabbix-agent.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has begun starting up.
Sep 08 21:02:51 vm-172-16-1-113 zabbix_agentd[15221]: /usr/sbin/zabbix_agentd: error while loading shared libraries: libcurl.so.4:
Sep 08 21:02:51 vm-172-16-1-113 systemd[1]: zabbix-agent.service: control process exited, code=exited status=127
Sep 08 21:02:51 vm-172-16-1-113 systemd[1]: Failed to start Zabbix Agent.
-- Subject: Unit zabbix-agent.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has failed.
-- 
-- The result is failed.
Sep 08 21:02:51 vm-172-16-1-113 systemd[1]: Unit zabbix-agent.service entered failed state.
Sep 08 21:02:51 vm-172-16-1-113 systemd[1]: zabbix-agent.service failed.
Sep 08 21:02:51 vm-172-16-1-113 polkitd[3455]: Unregistered Authentication Agent for unix-process:15210:141884514 (system bus name
Sep 08 21:03:01 vm-172-16-1-113 systemd[1]: zabbix-agent.service holdoff time over, scheduling restart.
Sep 08 21:03:01 vm-172-16-1-113 systemd[1]: Stopped Zabbix Agent.
-- Subject: Unit zabbix-agent.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has finished shutting down.
Sep 08 21:03:01 vm-172-16-1-113 systemd[1]: Starting Zabbix Agent...
-- Subject: Unit zabbix-agent.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has begun starting up.
Sep 08 21:03:01 vm-172-16-1-113 zabbix_agentd[15230]: /usr/sbin/zabbix_agentd: error while loading shared libraries: libcurl.so.4:
Sep 08 21:03:01 vm-172-16-1-113 systemd[1]: zabbix-agent.service: control process exited, code=exited status=127
Sep 08 21:03:01 vm-172-16-1-113 systemd[1]: Failed to start Zabbix Agent.
-- Subject: Unit zabbix-agent.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has failed.
-- 
-- The result is failed.
Sep 08 21:03:01 vm-172-16-1-113 systemd[1]: Unit zabbix-agent.service entered failed state.
Sep 08 21:03:01 vm-172-16-1-113 systemd[1]: zabbix-agent.service failed

The keyword is /usr/SBIN/ZABBIX_ agentd: error while loading shared libraries: libcurl.so.4

Indeed, the libcurl installation is as follows. It is found that it is still not possible

[root@vm-172-16-1-113 ~]# yum -y install libcurl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package libcurl.x86_64 0:7.29.0-51.el7 will be updated
--> Processing Dependency: libcurl = 7.29.0-51.el7 for package: curl-7.29.0-51.el7.x86_64
---> Package libcurl.x86_64 0:7.29.0-59.el7_9.1 will be an update
--> Processing Dependency: libssh2(x86-64) >= 1.8.0 for package: libcurl-7.29.0-59.el7_9.1.x86_64
--> Running transaction check
---> Package curl.x86_64 0:7.29.0-51.el7 will be updated
---> Package curl.x86_64 0:7.29.0-59.el7_9.1 will be an update
---> Package libssh2.x86_64 0:1.4.3-12.el7 will be updated
---> Package libssh2.x86_64 0:1.8.0-4.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
 Package                     Arch                       Version                                 Repository                   Size
==================================================================================================================================
Updating:
 libcurl                     x86_64                     7.29.0-59.el7_9.1                       updates                     223 k
Updating for dependencies:
 curl                        x86_64                     7.29.0-59.el7_9.1                       updates                     271 k
 libssh2                     x86_64                     1.8.0-4.el7                             base                         88 k

Transaction Summary
==================================================================================================================================
Upgrade  1 Package (+2 Dependent packages)

Total download size: 582 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): libcurl-7.29.0-59.el7_9.1.x86_64.rpm                                                                | 223 kB  00:00:00     
(2/3): curl-7.29.0-59.el7_9.1.x86_64.rpm                                                                   | 271 kB  00:00:00     
(3/3): libssh2-1.8.0-4.el7.x86_64.rpm                                                                      |  88 kB  00:00:00     
----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                             3.4 MB/s | 582 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libssh2-1.8.0-4.el7.x86_64                                                                                     1/6 
  Updating   : libcurl-7.29.0-59.el7_9.1.x86_64                                                                               2/6 
  Updating   : curl-7.29.0-59.el7_9.1.x86_64                                                                                  3/6 
  Cleanup    : curl-7.29.0-51.el7.x86_64                                                                                      4/6 
  Cleanup    : libcurl-7.29.0-51.el7.x86_64                                                                                   5/6 
  Cleanup    : libssh2-1.4.3-12.el7.x86_64                                                                                    6/6 
  Verifying  : curl-7.29.0-59.el7_9.1.x86_64                                                                                  1/6 
  Verifying  : libssh2-1.8.0-4.el7.x86_64                                                                                     2/6 
  Verifying  : libcurl-7.29.0-59.el7_9.1.x86_64                                                                               3/6 
  Verifying  : libssh2-1.4.3-12.el7.x86_64                                                                                    4/6 
  Verifying  : libcurl-7.29.0-51.el7.x86_64                                                                                   5/6 
  Verifying  : curl-7.29.0-51.el7.x86_64                                                                                      6/6 

Updated:
  libcurl.x86_64 0:7.29.0-59.el7_9.1                                                                                              

Dependency Updated:
  curl.x86_64 0:7.29.0-59.el7_9.1                                   libssh2.x86_64 0:1.8.0-4.el7                                  

Complete!
[root@vm-172-16-1-113 ~]# systemctl start zabbix-agent
Job for zabbix-agent.service failed because the control process exited with error code. See "systemctl status zabbix-agent.service" and "journalctl -xe" for details.
[root@vm-172-16-1-113 ~]# journalctl -xe
-- Unit zabbix-agent.service has begun starting up.
Sep 08 21:03:52 vm-172-16-1-113 zabbix_agentd[15278]: /usr/sbin/zabbix_agentd: error while loading shared libraries: libcurl.so.4:
Sep 08 21:03:52 vm-172-16-1-113 systemd[1]: zabbix-agent.service: control process exited, code=exited status=127
Sep 08 21:03:52 vm-172-16-1-113 systemd[1]: Failed to start Zabbix Agent.
-- Subject: Unit zabbix-agent.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has failed.
-- 
-- The result is failed.
Sep 08 21:03:52 vm-172-16-1-113 systemd[1]: Unit zabbix-agent.service entered failed state.
Sep 08 21:03:52 vm-172-16-1-113 systemd[1]: zabbix-agent.service failed.
Sep 08 21:03:54 vm-172-16-1-113 yum[15277]: Updated: libssh2-1.8.0-4.el7.x86_64
Sep 08 21:03:54 vm-172-16-1-113 yum[15277]: Updated: libcurl-7.29.0-59.el7_9.1.x86_64
Sep 08 21:03:55 vm-172-16-1-113 yum[15277]: Updated: curl-7.29.0-59.el7_9.1.x86_64
Sep 08 21:03:58 vm-172-16-1-113 polkitd[3455]: Registered Authentication Agent for unix-process:15291:141892032 (system bus name :
Sep 08 21:04:02 vm-172-16-1-113 systemd[1]: zabbix-agent.service holdoff time over, scheduling restart.
Sep 08 21:04:02 vm-172-16-1-113 systemd[1]: Stopped Zabbix Agent.
-- Subject: Unit zabbix-agent.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has finished shutting down.
Sep 08 21:04:02 vm-172-16-1-113 systemd[1]: Starting Zabbix Agent...
-- Subject: Unit zabbix-agent.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has begun starting up.
Sep 08 21:04:02 vm-172-16-1-113 zabbix_agentd[15300]: /usr/sbin/zabbix_agentd: error while loading shared libraries: libcurl.so.4:
Sep 08 21:04:02 vm-172-16-1-113 systemd[1]: zabbix-agent.service: control process exited, code=exited status=127
Sep 08 21:04:02 vm-172-16-1-113 systemd[1]: Failed to start Zabbix Agent.
-- Subject: Unit zabbix-agent.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-agent.service has failed.
-- 
-- The result is failed.
Sep 08 21:04:02 vm-172-16-1-113 systemd[1]: Unit zabbix-agent.service entered failed state.
Sep 08 21:04:02 vm-172-16-1-113 systemd[1]: zabbix-agent.service failed.
Sep 08 21:04:02 vm-172-16-1-113 polkitd[3455]: Unregistered Authentication Agent for unix-process:15291:141892032 (system bus name

See if libcurl. So. 4 does exist. It seems that the system does not recognize it

[root@vm-172-16-1-113 ~]# ls /usr/lib64/libcurl.so.4
/usr/lib64/libcurl.so.4

Join ld.so.conf and try ldconfig

[root@vm-172-16-1-113 ~]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf

[root@vm-172-16-1-113 ~]# echo '/usr/lib64' >> /etc/ld.so.conf.d/zabbix.conf
[root@vm-172-16-1-113 ~]# ldconfig

Starting ZABBIX again still doesn’t work

Take another look at SELinux

I looked around because of it

Set setenforce 0
temporarily, and then you can start it

Read More: