十一 安装ClamAV
抗病毒使用软件是clamav,安装时一定要用当前的最新版本。垃圾邮件过滤可使用一个名为SpamAssassin的perl模块。通过采用amavisd-new这个容器,可以把clamav和SpamAssassin整合起来。
1. 安装
#useradd clamav
# useradd amavis
#./configure --prefix=/usr/local/clamav --with-dbdir=/usr/local/share/clamav
#make
#make check
#make install
#mkdir /usr/local/clamav/var
#mkdir /usr/local/clamav/var/log
#mkdir /usr/local/clamav/var/run
#chown -R amavis:amavis /usr/local/clamav/var
# chown -R amavis:amavis /usr/local/share/clamav
2. 配置
(1)# vim /usr/local/clamav/etc/clamd.conf
更改如下:
LogFile /usr/local/clamav/var/log/clamd.log
LogFileMaxSize 2M
LogSyslog yes
LogVerbose yes
#Change pid file location
PidFile /usr/local/clamav/var/run/clamd.pid
DatabaseDirectory /usr/local/share/clamav
#Set the clamav socket
LocalSocket /usr/local/clamav/var/run/clamd.socket
StreamMaxLength 20M
#Don't run clamd as root
User amavis
ScanMail yes
ScanArchive yes
Clamd.conf中,有"User amavis"这样一行。为什么不用默认的用户clamav而使用amavis呢?这样做的目的是为了与amavis-new结合在一起。
(2)# vim /usr/local/clamav/etc/freshclam.conf
更改如下:
DatabaseDirectory /usr/local/share/clamav
UpdateLogFile /usr/local/clamav/var/log/freshclam.log
LogVerbose yes
LogSyslog yes
DatabaseOwner amavis
DatabaseMirror db.CN.clamav.net
DatabaseMirror database.clamav.net
#Check for updates every two hours. That is the official recommendation
Checks 12
NotifyClamd /usr/local/clamav/etc/clamd.conf
注意:一定要注释掉上面两个文件(clamd.conf和freshclam.conf)中Example那行
启动clamav
# /usr/local/clamav/sbin/clamd
手动更新病毒库
# /usr/local/clamav/bin/freshclam
设置自动更新病毒库
crontab –e
01 01 * * * /usr/local/clamav/bin/freshclam
本文出自 “周天琪” 博客,谢绝转载!