一,官方网站
https://www.clamav.net/
如图:
二,安装
1,开启epel仓库
[root@blog ~]# yum install -y epel-release
2,安装clamav
[root@blog ~]# yum install clamav
说明:病毒库数据较大,200多M,安装时需要等待较长时间
安装完成后查看clamav的版本:
[root@blog ~]# clamscan -V
ClamAV 1.0.6/27256/Thu Apr 25 16:27:19 2024
3, 安装病毒库升级命令:
[root@blog ~]# yum install clamav-freshclam
安装后查看freshclam版本:
[root@blog ~]# freshclam --version
ClamAV 1.0.6/27256/Thu Apr 25 16:27:19 2024
说明:1.0.6是程序版本
27256 是daily.cvd病毒库版本
三,使用
1,手动更新病毒库
[root@blog ~]# freshclam
freshclam 会显示当前的病毒库版本:
[root@blog ~]# freshclam
ClamAV update process started at Mon Aug 26 13:11:34 2024
daily.cvd database is up-to-date (version: 27378, sigs: 2065918, f-level: 90, builder: raynman)
main.cvd database is up-to-date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
bytecode.cvd database is up-to-date (version: 335, sigs: 86, f-level: 90, builder: raynman)
2,启动病毒库自动更新服务
查看状态
root@blog ~]# systemctl status clamav-freshclam.service
○ clamav-freshclam.service - ClamAV virus database updaterLoaded: loaded (;;file://blog/usr/lib/systemd/system/clamav-freshclam.service/usr/lib/systemd/system/clamav-freshclam.service;;; disabled; preset: disabled)Active: inactive (dead)Docs: ;;man:freshclam(1)man:freshclam(1);;;;man:freshclam.conf(5)man:freshclam.conf(5);;;;https://docs.clamav.net/https://docs.clamav.net/;;
启动服务:
[root@blog ~]# systemctl start clamav-freshclam.service
3,手动查杀某个目录
[root@blog ~]# clamscan -r /var
4,定时查杀:把下面的命令放到crontab中即可
[root@blog ~]# clamscan --infected --recursive /home --move=/tmp/clamav -l /var/log/clamscan.log
--infected: 只打印被感染的文件
--recursive: 递归扫描子目录
--move=: 移动被感染文件到指定目录
-l /var/log/clamscan.log: 把结果保存到日志文件
日志内容:
[root@blog ~]# more /var/log/clamscan_2024-08-26.log------------------------------------------------------------------------------------------------------------------------------------------------------------------------- SCAN SUMMARY -----------
Known viruses: 8697733
Engine version: 1.0.6
Scanned directories: 653
Scanned files: 2648
Infected files: 0
Data scanned: 935.55 MB
Data read: 1362.55 MB (ratio 0.69:1)
Time: 150.350 sec (2 m 30 s)
Start Date: 2024:08:26 13:54:57
End Date: 2024:08:26 13:57:27
四,说明:
1,病毒库的存储位置:
默认所在目录:
[root@blog ~]# ll -h /var/lib/clamav/
total 224M
-rw-r--r-- 1 clamupdate clamupdate 283K Apr 8 07:58 bytecode.cvd
-rw-r--r-- 1 clamupdate clamupdate 62M Aug 26 12:54 daily.cvd
-rw-r--r-- 1 clamupdate clamupdate 69 Aug 26 12:52 freshclam.dat
-rw-r--r-- 1 clamupdate clamupdate 163M Sep 22 2021 main.cvd