CentOS7安装使⽤Clamav⽅法
Clamav杀毒软件安装及使⽤操作⼿册
1检查安装环境
在安装Clamav之前要安装⼏个包,gcc、openssl、zlib否则安装⽆法通过。以下是连接互联⽹的安装⽅式。
1.1安装Gcc
#yum install gcc -y
#yum install gcc-c++
1.2安装Openssl
#yum install openssl
#yum install openssl-devel
1.3安装Zlib
1. wget下载zlib源码包
#wget www.doczj/doc/7361d51d82d049649b6648d7c1c708a1294a0a59.html /zlib-1.2.
2.解压lib-1.2.
# tar xvzf zlib-1.2.
3.进⼊zlib-1.2.11⽬录,执⾏ ./configure脚本
#cd zlib-1.2.11/
#./configure
#make
#make install
zlib安装完成。
2安装Clamav
2.1下载安装Clamav
1. wget下载Clamav源码包。
#wget www.doczj/doc/7361d51d82d049649b6648d7c1c708a1294a0a59.html /downloads/production/clamav-0.101. 2.解压#tar -zxf clamav-0.101.
3.进⼊clamav-0.101.1⽬录,执⾏ ./configure脚本
#cd clamav-0.101.1
#./configure --prefix=/usr/local/clamav
#make
#make install
4.添加⽤户组和组成员
#groupadd clamav
#useradd -g clamav clamav
2.2配置Clamav
1.创建⽇志⽬录和病毒库⽬录
#mkdir /usr/local/clamav/logs
#mkdir /usr/local/clamav/updata
2.创建⽇志⽂件
#touch /usr/local/clamav/logs/clamd.log
#touch /usr/local/clamav/logs/freshclam.log
3.⽂件授权
#chown clamav:clamav /usr/local/clamav/logs/clamd.log
#chown clamav:clamav /usr/local/clamav/logs/freshclam.log
#chown clamav:clamav /usr/local/clamav/updata
4.修改配置⽂件
#cp /usr/local/clamav/f.sample /usr/local/clamav/f
#cp /usr/local/clamav/f.sample /usr/local/clamav/f 5.编辑f vim /usr/local/clamav/f
#Example//注释掉这⼀⾏
#添加以下内容
LogFile /usr/local/clamav/logs/clamd.log
centos vim命令PidFile /usr/local/clamav/updata/clamd.pid
DatabaseDirectory /usr/local/clamav/updata
6.编辑f
#vim /usr/local/clamav/f
#Example//注释掉这⼀⾏
#添加以下内容
DatabaseDirectory /usr/local/clamav/updata
UpdateLogFile /usr/local/clamav/logs/freshclam.log
PidFile /usr/local/clamav/updata/freshclam.pid
2.3使⽤Clamav
1.更新病毒库
#/usr/local/clamav/bin/freshclam
如果⽆法在线更新需要⼿动更新。
官⽹下载最新的三个main.cvd | daily.cvd | bytecode.cvd ⽂件
保存到本地,上传到Linux并放置到/usr/local/clamav/updata⽬录运⾏/usr/local/clamav/bin/freshclam升级#/usr/local/clamav/bin/freshclam
完成更新,可以杀毒扫描。
2.杀毒扫描
扫描参数:
-
r 递归扫描⼦⽬录
-i 只显⽰发现的病毒⽂件
–no-summary 不显⽰统计信息
使⽤⽅法:
帮助
#/usr/local/clamav/bin/clamscan --help
默认扫描当前⽬录下的⽂件,并显⽰扫描结果统计信息
#/usr/local/clamav/bin/clamscan
扫描当前⽬录下的所有⽬录和⽂件,并显⽰结果统计信息
#/usr/local/clamav/bin/clamscan -r
扫描data⽬录下的所有⽬录和⽂件,并显⽰结果统计信息
#/usr/local/clamav/bin/clamscan -r /data
扫描data⽬录下的所有⽬录和⽂件,只显⽰有问题的扫描结果
#/usr/local/clamav/bin/clamscan -r --bell -i /data
扫描data⽬录下的所有⽬录和⽂件,不显⽰统计信息
#/usr/local/clamav/bin/clamscan --no-summary -ri /data
3. 杀毒测试
从www.doczj/doc/7361d51d82d049649b6648d7c1c708a1294a0a59.html 下载⼀个⽤于模拟病毒的⽂件,测试clamav杀毒情况下载病毒测试⽂件# wget www.doczj/doc/7361d51d82d049649b6648d7c1c708a1294a0a59.html
/download/www.doczj/doc/7361d51d82d049649b6648d7c1c708a1294a0a59.html
# ls
anaconda-ks.cfg www.doczj/doc/7361d51d82d049649b6648d7c1c708a1294a0a59.html
# pwd //查看病毒测试⽂件⽬录
/root
扫描并清除病毒
#/usr/local/clamav/bin/clamscan –remove /root
4.⾃动定时更新和杀毒
⼀般使⽤计划任务,让服务器每天定时更新和定时杀毒,保存杀毒⽇志。设置crontab定时任务。
1 3 * * * /usr/local/clamav/bin/freshclam --quiet
20 3 * * * /usr/local/clamav/bin/clamscan -r /home --remove -l /var/log/clamscan
5. Clamav杀毒⽇志和病毒库更新⽇志
⽣成病毒查杀⽇志⽅法
Clamav杀毒默认不⾃动保存到clamd.log⽇志中需要⽤-l保存。
查杀病毒并将查杀结果保存到/usr/local/clamav/logs/clamd.log⽂件
#/usr/local/clamav/bin/clamscan -r -i /home -l /usr/local/clamav/logs/clamd.log
//扫描/home⽬录⽂件并将扫描结果保存到clamd.log⽂件中。
#cat /usr/local/clamav/logs/clamd.log //查看杀毒⽇志
病毒库更新⽇志
cat /usr/local/clamav/logs/ freshclam.log
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论