环境:Centos 7.2
软件:clamav第一步:Clamav下载
wget http://www.clamav.net/downloads/production/clamav-0.99.2.tar.gz
第二步:创建clamav用户和组
groupadd clamav useradd -g clamav clamav
第三步:编译安装
tar xf clamav-0.99.2.tar.gzcd clamav-0.99.2./configure --prefix=/usr/local/clamav && make && make install
第四步:配置
mkdir /usr/local/clamav/logs (日志存放目录)touch /usr/local/clamav/logs/clamd.logtouch /usr/local/clamav/logs/freshclam.logmkdir /usr/local/clamav/updata (clanav 病毒库目录)chown -R root.clamav /usr/local/clamav/chown -R clamav.clamav /usr/local/clamav/updata/chown clamav.clamav /usr/local/clamav/logs/clamd.logchown clamav.clamav /usr/local/clamav/logs/freshclam.logcd /usr/local/clamav/etccp clamd.conf.sample clamd.confcp freshclam.conf.sample freshclam.confvi clamd.conf#Example 注释掉这一行.LogFile /usr/local/clamav/logs/clamd.log PidFile /usr/local/clamav/updata/clamd.pid DatabaseDirectory /usr/local/clamav/updatavi freshclam.conf#Example 注释掉这一行.DatabaseDirectory /usr/local/clamav/updataUpdateLogFile /usr/local/clamav/logs/freshclam.logPidFile /usr/local/clamav/updata/freshclam.pid
第五步:升级病毒库
/usr/local/clamav/bin/freshclam
这个过程很久,大概半个小时,等吧。可以开启screen来进行
/usr/local/clamav/bin/clamscan --remove (查杀当前目录并删除感染的文件)
第六步:计划任务实际生产环境应用一般使用计划任务,让服务器每天晚上定时跟新和定时杀毒。保存杀毒日志,我的crontab文件如下
yum install crontabs -y/sbin/service crond start //启动服务/sbin/service crond stop //关闭服务/sbin/service crond restart //重启服务/sbin/service crond reload //重新载入配置chkconfig crond on //开机启动 centos6systemctl enable crond.service //开机启动 centos7crontab -e1 3 * /usr/local/clamav/bin/freshclam 30 3 * /usr/local/clamav/bin/clamscan --infected -r / --remove -l /var/log/clamscan.log