linux下对clamav杀毒软件的安装和配置
下载安装
首先安装zlib库:
# yum install zlib zlib-devel //安装可忽略
下载安装clamav源码包
clamav管网:http://www.clamav.net/downloads
# wget http://www.clamav.net/downloads/production/clamav-0.99.2.tar.gz // 下载源码包
# tar -zxf clamav-0.99.2.tar.gz //解压
# cd clamav-0.99.2
# ./configure --prefix=/usr/local/clamav
#make
#make install
添加用户组和组成员
# groupadd clamav
# useradd -g clamav 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/etc/clamd.conf.sample /usr/local/clamav/etc/clamd.conf
# cp /usr/local/clamav/etc/freshclam.conf.sample /usr/local/clamav/etc/freshclam.conf
编辑这两个配置文件内容
# vim /usr/local/clamav/etc/clamd.conf
#Example //注释掉这一行
LogFile /usr/local/clamav/logs/clamd.log
PidFile /usr/local/clamav/updata/clamd.pid
DatabaseDirectory /usr/local/clamav/updata
# vim /usr/local/clamav/etc/freshclam.conf
#Example //注释掉这一行
DatabaseDirectory /usr/local/clamav/updata
UpdateLogFile /usr/local/clamav/logs/freshclam.log
PidFile /usr/local/clamav/updata/freshclam.pid
执行
更新病毒库
# /user/local/clamav/bin/freshclam
杀毒扫描
# /user/local/clamav/bin/clamscan //当前目录下的文件
# /user/local/clamav/bin/clamscan -r //当前目录下的文件和目录
# /user/local/clamav/binclamscan dir //查杀目录
# /user/local/clamav/binclamscan -r dir //查杀目录dir下的所有目录和文件
# /user/local/clamav/binclamscan --help //帮助
自动定时更新和杀毒
一般使用计划任务,让服务器每天定时更新和定时杀毒,保存杀毒日志。设置crontab
1 3 * * * /usr/local/clamav/bin/freshclam --quiet
20 3 * * * /usr/local/clamav/bin/clamscan -r /home --remove -l /var/log/clamscan.log