#============================install 组件================================================
cd /opt
rpm -ivh arc-5.21o-1.el5.rf.i386.rpm
rpm -ivh arj-3.10-0.1.i386.rpm
rpm -ivh freeze-2.5.0-1.2.el5.rf.i386.rpm
rpm -ivh unarj-2.63-0.a.2.el5.rf.i386.rpm
rpm -ivh unrar-3.7.4-1.el5.rf.i386.rpm
rpm -ivh unzoo-4.4-2.i386.rpm
rpm -ivh zoo-2.10-2.2.el5.rf.i386.rpm
rpm -ivh nomarch-1.4-1.el5.rf.i386.rpm
cd /opt
rpm -ivh arc-5.21o-1.el5.rf.i386.rpm
rpm -ivh arj-3.10-0.1.i386.rpm
rpm -ivh freeze-2.5.0-1.2.el5.rf.i386.rpm
rpm -ivh unarj-2.63-0.a.2.el5.rf.i386.rpm
rpm -ivh unrar-3.7.4-1.el5.rf.i386.rpm
rpm -ivh unzoo-4.4-2.i386.rpm
rpm -ivh zoo-2.10-2.2.el5.rf.i386.rpm
rpm -ivh nomarch-1.4-1.el5.rf.i386.rpm
#============================install compress ===========================================
cd /opt
mkdir compress
tar -zxvf compress-4.0.1.tar.gz -C /opt/compress
make;make install
cd /opt
mkdir compress
tar -zxvf compress-4.0.1.tar.gz -C /opt/compress
make;make install
#============================install Clamav =============================================
cd /opt
groupadd clamav
useradd -s /sbin/nologin -c "Amavis User" -d /var/amavis amavis
useradd -g clamav -s /sbin/nologin -d /dev/null clamav
tar -zxvf clamav-0.91.2.tar.gz
cd clamav-0.91.2
./configure
make
make install
mkdir /var/log/clamav
mkdir /var/run/clamav
chown clamav.clamav /var/run/clamav
chown clamav.clamav /var/log/clamav
cd /opt
groupadd clamav
useradd -s /sbin/nologin -c "Amavis User" -d /var/amavis amavis
useradd -g clamav -s /sbin/nologin -d /dev/null clamav
tar -zxvf clamav-0.91.2.tar.gz
cd clamav-0.91.2
./configure
make
make install
mkdir /var/log/clamav
mkdir /var/run/clamav
chown clamav.clamav /var/run/clamav
chown clamav.clamav /var/log/clamav
# 编辑clamd.conf配置文件(详情见《防病毒、防垃圾邮件相关配置文件.txt》)
mv /usr/local/etc/clamd.conf /usr/local/etc/clamd.conf.bak
cp /opt/virus/clamd.conf /usr/local/etc/clamd.conf
mv /usr/local/etc/clamd.conf /usr/local/etc/clamd.conf.bak
cp /opt/virus/clamd.conf /usr/local/etc/clamd.conf
# 启动 clamd 程序
/usr/local/sbin/clamd
/usr/local/sbin/clamd
# 编辑freshclam.conf配置文件(详情见《防病毒、防垃圾邮件相关配置文件.txt》)
mv /usr/local/etc/freshclam.conf /usr/local/etc/freshclam.conf.bak
cp /opt/virus/freshclam.conf /usr/local/etc/freshclam.conf
mv /usr/local/etc/freshclam.conf /usr/local/etc/freshclam.conf.bak
cp /opt/virus/freshclam.conf /usr/local/etc/freshclam.conf
chown amavis /var/log/clamav
chown amavis /usr/local/share/clamav
chown amavis /usr/local/share/clamav
# 执行 Clamavs病毒库升级
/usr/local/bin/freshclam
/usr/local/bin/freshclam
# 建立clamd的启动脚本
cp /opt/virus/clamd /etc/rc.d/init.d/clamd
chmod 755 /etc/rc.d/init.d/clamd
chkconfig --add clamd
chkconfig --level 2345 clamd on
cp /opt/virus/clamd /etc/rc.d/init.d/clamd
chmod 755 /etc/rc.d/init.d/clamd
chkconfig --add clamd
chkconfig --level 2345 clamd on
#===========================Perl相关套件的安装===================================
ln -sv /usr/local/ssl/lib/libcrypto.so /usr/local/lib/
ln -sv /usr/local/ssl/lib/libcrypto.so /usr/lib/
cd /opt/perl
tar -zxvf Digest-MD5-2.36.tar.gz
cd Digest-MD5-2.36
export LC_ALL=C
perl Makefile.PL
make
make install
ln -sv /usr/local/ssl/lib/libcrypto.so /usr/local/lib/
ln -sv /usr/local/ssl/lib/libcrypto.so /usr/lib/
cd /opt/perl
tar -zxvf Digest-MD5-2.36.tar.gz
cd Digest-MD5-2.36
export LC_ALL=C
perl Makefile.PL
make
make install
cd /opt/perl
tar -zxvf Time-HiRes-1.9715.tar.gz
cd Time-HiRes-1.9715
perl Makefile.PL
make
make install
tar -zxvf Time-HiRes-1.9715.tar.gz
cd Time-HiRes-1.9715
perl Makefile.PL
make
make install
perl -MCPAN -e shell
install Archive::Tar
install Archive::Zip
install Compress::Zlib
install Convert::TNEF
install Convert::UUlib
install MIME::Base64
install MIME::Parser
install Mail::Internet
install Net::Server
install Net::SMTP
install Digest::MD5
install IO::Stringy
install Time::HiRes
install Unix::Syslog
install BerkeleyDB
install Digest::SHA1
install DBI
install DB_File
install Net::DNS
install IP::Country
exit
install Archive::Tar
install Archive::Zip
install Compress::Zlib
install Convert::TNEF
install Convert::UUlib
install MIME::Base64
install MIME::Parser
install Mail::Internet
install Net::Server
install Net::SMTP
install Digest::MD5
install IO::Stringy
install Time::HiRes
install Unix::Syslog
install BerkeleyDB
install Digest::SHA1
install DBI
install DB_File
install Net::DNS
install IP::Country
exit
#须手动安装Net::DNS
cd /opt/perl
tar -zxvf Net-DNS-0.63.tar.gz
cd cd Net-DNS-0.63
perl Makefile.PL
make;make install
cd /opt/perl
tar -zxvf Net-DNS-0.63.tar.gz
cd cd Net-DNS-0.63
perl Makefile.PL
make;make install
#============ 可选安装项 ======================
perl -MCPAN -e shell
install HTML::Parser
install Mail::SPF
install Mail::SPF::Query
install Mail::SpamAssassin::Plugin::Razor2
install IO::Socket::INET6
install IO::Socket
exit
perl -MCPAN -e shell
install HTML::Parser
install Mail::SPF
install Mail::SPF::Query
install Mail::SpamAssassin::Plugin::Razor2
install IO::Socket::INET6
install IO::Socket
exit
cd /opt/perl
tar -zxvf Net-Ident-1.20.tar.gz
cd Net-Ident-1.20
perl Makefile.PL
make;make install
tar -zxvf Net-Ident-1.20.tar.gz
cd Net-Ident-1.20
perl Makefile.PL
make;make install
cd /opt/perl
tar -zxvf Crypt-OpenSSL-Random-0.04.tar.gz
cd Crypt-OpenSSL-Random-0.04
perl Makefile.PL
make;make install
tar -zxvf Crypt-OpenSSL-Random-0.04.tar.gz
cd Crypt-OpenSSL-Random-0.04
perl Makefile.PL
make;make install
# 不选择make test
perl -MCPAN -e shell
install Crypt::OpenSSL::RSA
install Mail::DomainKeys
install Mail::DKIM
install LWP::UserAgent
install HTTP::Date
install Encode::Detect
install Mail::SpamAssassin
exit
perl -MCPAN -e shell
install Crypt::OpenSSL::RSA
install Mail::DomainKeys
install Mail::DKIM
install LWP::UserAgent
install HTTP::Date
install Encode::Detect
install Mail::SpamAssassin
exit
cd /opt/perl
tar -zxvf Mail-ClamAV-0.22.tar.gz
cd Mail-ClamAV-0.22
perl Makefile.PL
make;make install
tar -zxvf Mail-ClamAV-0.22.tar.gz
cd Mail-ClamAV-0.22
perl Makefile.PL
make;make install
#============================安装与设定Amavisd-new=======================================
cd /opt
gpasswd -a clamav amavis
usermod -G amavis clamav
tar -zxvf amavisd-new-2.5.2.tar.gz
mkdir /var/amavis/tmp /var/amavis/var /var/amavis/db /var/amavis/home
chown -R amavis:amavis /var/amavis
chmod -R 750 /var/amavis
cd amavisd-new-2.5.2
cp amavisd /usr/local/sbin/
chown root /usr/local/sbin/amavisd
chmod 755 /usr/local/sbin/amavisd
cp amavisd.conf /etc/
chown root /etc/amavisd.conf
chmod 644 /etc/amavisd.conf
cp amavisd_init.sh /etc/init.d/amavisd
chmod 744 /etc/init.d/amavisd
chkconfig --add amavisd
chkconfig amavisd on
cd /opt
gpasswd -a clamav amavis
usermod -G amavis clamav
tar -zxvf amavisd-new-2.5.2.tar.gz
mkdir /var/amavis/tmp /var/amavis/var /var/amavis/db /var/amavis/home
chown -R amavis:amavis /var/amavis
chmod -R 750 /var/amavis
cd amavisd-new-2.5.2
cp amavisd /usr/local/sbin/
chown root /usr/local/sbin/amavisd
chmod 755 /usr/local/sbin/amavisd
cp amavisd.conf /etc/
chown root /etc/amavisd.conf
chmod 644 /etc/amavisd.conf
cp amavisd_init.sh /etc/init.d/amavisd
chmod 744 /etc/init.d/amavisd
chkconfig --add amavisd
chkconfig amavisd on
#编辑amavisd(详情见《防病毒、防垃圾邮件相关配置文件.txt》)
mv /etc/rc.d/init.d/avamisd /etc/rc.d/init.d/avamisd.bak
cp /opt/virus/avamisd /etc/rc.d/init.d/avamisd
mv /etc/rc.d/init.d/avamisd /etc/rc.d/init.d/avamisd.bak
cp /opt/virus/avamisd /etc/rc.d/init.d/avamisd
mkdir /var/virusmails
chown amavis:amavis /var/virusmails
chmod 750 /var/virusmails
chown amavis:amavis /var/virusmails
chmod 750 /var/virusmails
#编辑amavisd.conf(详情见《防病毒、防垃圾邮件相关配置文件.txt》)
mv /etc/amavisd.conf /etc/amavisd.conf.bak
cp /opt/virus/amavisd.conf /etc/amavisd.conf
mv /etc/amavisd.conf /etc/amavisd.conf.bak
cp /opt/virus/amavisd.conf /etc/amavisd.conf
#调试
#/usr/local/sbin/amavisd -u amavis debug
#/usr/local/sbin/amavisd -u amavis debug
#启动 clamd 和 amavis
/usr/local/sbin/clamd
/usr/local/sbin/amavisd –u amavis start
/usr/local/sbin/clamd
/usr/local/sbin/amavisd –u amavis start
#配置Postfix与Amavisd-new,实现过滤病毒邮件(详情见《防病毒、防垃圾邮件相关配置文件.txt》)
mv /etc/postfix/master.cf /etc/postfix/master.cf-4
cp /opt/virus/master.cf /etc/postfix/master.cf
mv /etc/postfix/main.cf /etc/postfix/main.cf-4
cp /opt/virus/main.cf /etc/postfix/main.cf
mv /etc/postfix/master.cf /etc/postfix/master.cf-4
cp /opt/virus/master.cf /etc/postfix/master.cf
mv /etc/postfix/main.cf /etc/postfix/main.cf-4
cp /opt/virus/main.cf /etc/postfix/main.cf
/usr/local/postfix/sbin/postfix reload
本文转自king_819 51CTO博客,原文链接:http://blog.51cto.com/kerry/103882,如需转载请自行联系原作者