yum -y install epel-release
yum -y install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd
如果出现Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again
参考这篇文章:yum错误Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again - 简书
查看 SELinux 状态:
sestatus -v
如果为disabled状态,则需要开启SELinux
vim /etc/selinux/config
设置SELINUX=1,然后重启机器,再次查看SELinux的运行状态。
依次执行下面的命令
setsebool -P antivirus_can_scan_system 1
setsebool -P clamd_use_jit 1
查看运行状态:
getsebool -a | grep antivirus
结果类似下面,则表示成功
antivirus_can_scan_system --> on
antivirus_use_jit --> on
配置clamav
# 从配置文件中删除Example字符串
sed -i -e "s/^Example/#Example/" /etc/clamd.d/scan.conf
#修改 配置文件 将 LocalSocket /var/run/clamd.scan/clamd.sock 放开
vim /etc/clamd.d/scan.conf
#freshclam更新引擎配置文件中删除Example字符串
sed -i -e "s/^Example/#Example/" /etc/freshclam.conf
# 数据库更新
freshclam
#启动 配置开机自启动
systemctl start clamd@scan
systemctl enable clamd@scan
#查看状态
systemctl status clamd@scan