十、安装amavisd-new-2.6.1(是一个连接MTA和内容检测工具)
1、依赖关系的解决
以下为官方声明所必须的软件包列表,你可以采用类同安装Spamassassin一节中的perl模块的安装方法进行安装
Archive::Zip (Archive-Zip-x.xx) (1.14 or later should be used!)
Compress::Zlib (Compress-Zlib-x.xx) (1.35 or later)
Convert::TNEF (Convert-TNEF-x.xx)
Convert::UUlib (Convert-UUlib-x.xxx) (1.08 or later, stick to new versions!)
MIME::Base64 (MIME-Base64-x.xx)
MIME::Parser (MIME-Tools-x.xxxx) (latest version from CPAN - currently 5.420)
Mail::Internet (MailTools-1.58 or later have workarounds for Perl 5.8.0 bugs)
Net::Server (Net-Server-x.xx) (version 0.88 finally does setuid right)
Digest::MD5 (Digest-MD5-x.xx) (2.22 or later)
IO::Stringy (IO-stringy-x.xxx)
Time::HiRes (Time-HiRes-x.xx) (use 1.49 or later, older can cause problems)
Unix::Syslog (Unix-Syslog-x.xxx)
BerkeleyDB
Crypt::OpenSSL::RSA
Mail::DKIM::Verifier
2、安装amavisd-new-2.6.1
(1)创建运行时目录,并赋予amavis用户(前文中所建)
#mkdir -pv /var/amavis/{tmp,var,db,home}
#chown -R amavis:amavis /var/amavis
#chmod -R 777 /var/amavis
(2)解压amavisd
#tar zxvf amavisd-new-2.6.1.tar.gz
#cd amavisd-new-2.6.1
(3)拷贝服务端至$PATH中指定的目录,推荐拷贝至/usr/local/sbin:
#cp amavisd /usr/local/sbin/
#chown root /usr/local/sbin/amavisd
#chmod 755 /usr/local/sbin/amavisd
(4)拷贝主配置文件至/etc,并修改相应的权限:
#cp amavisd.conf /etc
#chown root:amavis /etc/amavisd.conf
#chmod 640 /etc/amavisd.conf
(5)创建amavisd运行中所需要的隔离区域:
#mkdir -v /var/virusmails
#chown amavis:amavis /var/virusmails/
#chmod 777 /var/virusmails/
3、编辑主配置文件
(1)#vi /etc/amavisd.conf
确保您的如下选项的值如下文所示:
$daemon_user = 'amavis';
$daemon_group = 'amavis';
$mydomain = 'lixin.org'; //
此处可更改为您集体的域
$virus_admin = "postmaster\@$mydomain";
$mailfrom_notify_admin = "postmaster\@$mydomain";
$mailfrom_notify_recip = "postmaster\@$mydomain";
$mailfrom_notify_spamadmin = "postmaster\@$mydomain";
$mailfrom_to_quarantine = '';
virus_admin_maps => ["postmaster\@$mydomain"] //
指定报告病毒和垃圾邮件时发送系统邮件的用户身份
spam_admin_maps => ["postmaster\@$mydomain"]
DetectPUA yes //
去掉前面的注释
启用ClamAV,(大概在第363行)去掉如下行前的注释符:
#['ClamAV-clamd',
# \&ask_daemon, ["CONTSCAN {}\n", "
/var/run/clamav/clamd
"],
# qr/\bOK$/, qr/\bFOUND$/,
# qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
# ['Mail::ClamAV', \&ask_clamav, "*", [0], [1], qr/^INFECTED: (.+)/],
并将如上行中的/var/run/clamav/clamd
修改为:
/var/run/clamav/clamd.socket
(364行
)
4. 安装配置BerkeleyDB(可以不装,建议安装)
(1)安装
#tar zxvf db-4.5.20.tar.gz
#cd db-4.5.20/build_unix
#../dist/configure --prefix=/usr/local/BerkeleyDB
#make
#make install
(2)配置
修改相应的头文件指向
#mv /usr/include/db4/ /usr/inculde/db4.OFF
#rm /usr/include/db_cxx.h
#rm /usr/include/db.h
#rm /usr/include/db_185.h
#ln -sv /usr/local/BerkeleyDB/include /usr/include/db4
#ln -sv /usr/local/BerkeleyDB/include/db.h /usr/include/db.h
#ln -sv /usr/local/BerkeleyDB/include/db_cxx.h /usr/include/db_cxx.h
配置库文件搜索路径
echo "/usr/local/BerkeleyDB/lib" >> /etc/ld.so.conf
ldconfig �Cv
5、测试启动amavisd
您也可以按如下命令调试启动
/usr/local/sbin/amavisd debug
6、将amavisd注册为系统服务
(1)#cd /srv/amavisd-new-2.6.1
#cp amavisd_init.sh /etc/init.d/amavisd
#chmod +x /etc/init.d/amavisd
(2)
修改执行路径
#vi /etc/rc.d/init.d/amavisd
prog="/usr/local/sbin/amavisd"
(3)
注册服务并启动
#chkconfig --add amavisd
#chkconfig --levels 35 amavisd on
#service amavisd start