环境: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.gz cd clamav-0.99.2 ./configure --prefix=/usr/local/clamav && make && make install
第四步:配置
mkdir /usr/local/clamav/logs (日志存放目录) touch /usr/local/clamav/logs/clamd.log touch /usr/local/clamav/logs/freshclam.log mkdir /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.log chown clamav.clamav /usr/local/clamav/logs/freshclam.log cd /usr/local/clamav/etc cp clamd.conf.sample clamd.conf cp freshclam.conf.sample freshclam.conf vi clamd.conf #Example 注释掉这一行. LogFile /usr/local/clamav/logs/clamd.log PidFile /usr/local/clamav/updata/clamd.pid DatabaseDirectory /usr/local/clamav/updata vi freshclam.conf #Example 注释掉这一行. DatabaseDirectory /usr/local/clamav/updata UpdateLogFile /usr/local/clamav/logs/freshclam.log PidFile /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 //开机启动 centos6 systemctl enable crond.service //开机启动 centos7 crontab -e 1 3 * /usr/local/clamav/bin/freshclam 30 3 * /usr/local/clamav/bin/clamscan --infected -r / --remove -l /var/log/clamscan.log
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。