1、安装epel源,在命令行下执行yum install epel-release –y,如下图:
2、在安装了EPEL源后,运行下面的命令安装ClamAV,在命令行下执行
yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd –y
如下图
3、在命令行下修改两个配置文件/etc/freshclam.conf和/etc/scan.conf,以移除文件中“Example”字符
# sed -i -e "s/^Example/#Example/" /etc/freshclam.conf
[root@squidnew log]# # sed -i -e "s/^Example/#Example/" /etc/clamd.d/scan.conf
手动更新病毒库,执行命令:freshclam,
如下图
注意:病毒库更新时总是链接失败,无法访问到 默认的镜像地址,遂再次进入freshclam.conf 配置文件,在将DatabaseDirectory /var/lib/clamav这一行将之前的注释#删除,然后在系统中创建此文件目录,在 官网下载最新的三个 ,下载地址如下
main.cvd : http://database.clamav.net/main.cvd
daily.cvd : http://database.clamav.net/daily.cvd
bytecode.cvd : http://database.clamav.net/bytecode.cvd
直接将这三个文件使用迅雷下载,基本上几分钟能下载完(不行就使用旋风),之后将这三个文件保存到/var/lib/clamav路径下,这是再次运行跟新病毒库命令freshclam 会提示病毒库已更新到最近,接下来就可以执行扫描了
安全扫描
对目录进行扫描,-r选项表示包含子目录,如下命令是对/root目录进行扫描在命令行下执行 clamscan -r /
clamscan --infected -r / --remove -l /var/log/clamscan.log
结果如下:
/root/elasticsearch-servicewrapper-master.zip: OK
/root/tomcat.cap: OK
/root/test.sh: OK
/root/1.txt.bak: OK
/root/apache-tomcat-7.0.73.tar.gz: OK
/root/request.txt: OK
/root/jenkins.io.key: OK
/root/.bash_profile: OK
/root/.viminfo: OK
/root/.cshrc: OK
/root/配置免密码访问.txt: OK
/root/.tcshrc: OK
/root/.bash_history: OK
/root/bigdesk-master.zip: OK
/root/read.sh: OK
/root/.mysql_history: OK
/root/fun.sh: OK
/root/.my.cnf: OK
/root/case.sh: OK
/root/.bash_logout: OK
/root/elasticsearch-1.4.4.tar.gz: OK
/root/testfile: OK
/root/zabbix-sender-3.0.4-1.el6.x86_64.rpm: OK
/root/install.sh: OK
/root/zabbix.sh: OK
/root/zabbix-get-3.0.1-2.el6.x86_64.rpm: OK
/root/zookeeper-3.4.5.tar.gz: OK
/root/anaconda-ks.cfg: OK
/root/.bashrc: OK
/root/ping.sh: OK
/root/.mysql_secret: OK
/root/192.168.3.13: OK
/root/startzk.sh: OK
/root/zabbix-agent-3.0.4-1.el6.x86_64.rpm: OK
/root/p1.py: OK
/root/if.sh: OK
/root/jdk-7u80-linux-x64.gz: OK
/root/zookeeper.out: OK
/root/pingtest.sh: OK----------- SCAN SUMMARY -----------
Known viruses: 5943094
Engine version: 0.99.1
Scanned directories: 1
Scanned files: 39
Infected files: 0
Data scanned: 92.54 MB
Data read: 210.36 MB (ratio 0.44:1)
Time: 94.219 sec (1 m 34 s)