操作系统版本信息
CentOS Linux release 7.4.1708 (Core)
ClamAV 简单介绍
yum安装ClamAV
主要步骤如下:
-
(1)安装:yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-
(2)安装ClamAV:yum install -y clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-cladv-devel clamav-lib clamav-server-systemd
-
(3)更改配置文件:/etc/freshclam.conf和/etc/clamd.d/scan.conf中移除“Example”字符
sed -i -e "s/^Example/#Example/" /etc/freshclam.conf
sed -i -e "s/^Example/#Example/" /etc/clamd.d/scan.conf
-
(4)运行freshclam手动更新数据库:freshclam
顺便一提,freshclam命令通过文件/etc/cron.d/clamav-update的cron作业运行的。该文件内容是:
cat /etc/cron.d/clamav-update
## Adjust this line...
MAILTO=root
## It is ok to execute it as root; freshclam drops privileges and becomes
## user 'clamupdate' as soon as possible
0 */3 * * * root /usr/share/clamav/freshclam-sleep
但默认情况下是禁止了自动更新功能,需要移除文件/etc/sysconfig/freshclam最后一行的配置才能启用
-
(5)定义服务器类型(本地或者TCP)
在这里定义为使用本地socket,将文件vim /etc/clamd.d/scan.conf中的这一行前面的注释符号去掉:
#LocalSocket /var/run/clamd.scan/clamd.sock to LocalSocket /var/run/clamd.scan/clamd.sock保存退出~
启动ClamAV
软连接启动项
ln -s '/usr/lib/systemd/system/clamd@scan.service' '/etc/systemd/system/multi-user.target.wants/clamd@scan.service'
启动并检查服务状态
systemctl start clamd@scan
systemctl status clamd@scan
开机自启动
systemctl enable clamd@scan
Tips
如果在手动更新病毒库的时候遇到错误:Update failed. Your network may be down or none of the mirrors listed in freshclam.conf is working.
再手动更新一次病毒库: freshclam
ClamAV简单使用
参考文档