Chinaunix首页 | 论坛 | 博客
  • 博客访问: 534482
  • 博文数量: 184
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 2490
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-09 11:34
文章分类

全部博文(184)

文章存档

2011年(1)

2010年(2)

2009年(12)

2008年(169)

我的朋友

分类: LINUX

2009-04-15 20:37:49

安装perl相关组件
  安装Perl组件是这里最麻烦的地方,一个是因为要求的组件比较多,另一个则是它对其它组件的依赖信较强.也许有人说可以通过自动的方式来进行安装,我也有尝试过,但却总是有组件安装不成功(如MIME-Tools),而且非常耗时间.还不如手动安装来得讯速,可以按 介绍的方法将相关的组件下载下来,然后按照下面的方法顺序安装.
  在安装perl组件到第42个时(GD- SecurityImage)会要求用户安装PerlImageMagick的组件,而ImageMagick则需要下面这些软件的支持,这些软件在第一篇文章中没有给出,所以在这里给出,呵呵,希望没有影响大家的安装.否则可能在显示验证码的时候出现错误.
ghostscript ImageMagick相关
tiff ftp://ftp.remotesensing.org/libtiff ImageMagick相关
PerlMagick-6.32 ~jcristy/PerlMagick-6.32/Magick.pm PerlMagick模块
  1:安装ghostscript
[root@redhat tmp]# tar zxvf ghostscript-8.54.tar.gz
[root@redhat tmp]# cd ghostscript-8.54
[root@redhat ghostscript-8.54]# ./configure
[root@redhat ghostscript-8.54]# make
[root@redhat ghostscript-8.54]# make install
  2:安装tiff
[root@redhat tmp]# tar zxvf tiff-3.8.2.tar.gz
[root@redhat tmp]# cd tiff-3.8.2
[root@redhat tiff-3.8.2]# ./configure
[root@redhat tiff-3.8.2]# make
[root@redhat tiff-3.8.2]# make install
  3:安装html2ps
[root@redhat tmp]# tar zxvf html2ps-1.0b5.tar.gz
[root@redhat tmp]# cd html2ps-1.0b5
[root@redhat html2ps-1.0b5]# chmod +x install
[root@redhat html2ps-1.0b5]# ./install
  4:安装jasper
[root@redhat tmp]# unzip jasper-1.701.0.zip
[root@redhat tmp]# cd jasper-1.701.0
[root@redhat jasper-1.701.0]# ./configure --disable-opengl --disable-libjpeg
[root@redhat jasper-1.701.0]# make
[root@redhat jasper-1.701.0]# make install
  5:安装ImageMagick
[root@redhat ImageMagick-6.3.7]# ln -sv /usr/local/png/include/* /usr/include
create symbolic link `/usr/include/libpng12' to `/usr/local/png/include/libpng12'
create symbolic link `/usr/include/pngconf.h' to `/usr/local/png/include/pngconf.h'
create symbolic link `/usr/include/png.h' to `/usr/local/png/include/png.h'
[root@redhat ImageMagick-6.3.7]# ln -sv /usr/local/jpeg/include/* /usr/include
[root@redhat tmp]# tar zxvf ImageMagick-6.3.7-9.tar.gz
[root@redhat tmp]# cd ImageMagick-6.3.7
[root@redhat ImageMagick-6.3.7]# ./configure --without-fpx --without-jbig \
--without-rsvg --without-lcms
[root@redhat ImageMagick-6.3.7]# make
[root@redhat ImageMagick-6.3.7]# make install

//安装Perl的第一个组件,请按顺序安装
tar zxvf BerkeleyDB-0.32.tar.gz
1
cd BerkeleyDB-0.32
perl Makefile.PL
make
make install
cd ..
tar zxvf Compress-Raw-Zlib-2.008.tar.gz
2
cd Compress-Raw-Zlib-2.008
perl Makefile.PL
make
make install
cd ..
tar zxvf IO-Compress-Base-2.008.tar.gz
3
cd IO-Compress-Base-2.008
perl Makefile.PL
make
make install
cd ..
tar zxvf IO-Compress-Zlib-2.008.tar.gz 4
cd IO-Compress-Zlib-2.008
perl Makefile.PL
make
make install
cd ..
tar zxvf Compress-Zlib-2.008.tar.gz 05
tar zxvf IO-Zlib-1.08.tar.gz 06
tar zxvf Array-Compare-1.14.tar.gz 07
tar zxvf Sub-Uplevel-0.18.tar.gz 08
tar zxvf Test-Simple-0.74.tar.gz 09
tar zxvf Test-Exception-0.26.tar.gz 10
tar zxvf Tree-DAG_Node-1.06.tar.gz 11
tar zxvf Test-Warn-0.10.tar.gz 12
tar zxvf Net-SSLeay-1.32.tar.gz 13
tar zxvf IO-Socket-SSL-1.12.tar.gz 14
tar zxvf IO-stringy-2.110.tar.gz 15
tar zxvf Algorithm-Diff-1.1902.tar.gz 16
tar zxvf Text-Diff-0.35.tar.gz 17
tar zxvf Archive-Tar-1.38.tar.gz 18
tar zxvf Archive-Zip-1.23.tar.gz 19
tar zxvf DBI-1.601.tar.gz 20
tar zxvf DBD-mysql-3.0008.tar.gz 21
tar zxvf Socket6-0.19.tar.gz 22
tar zxvf IO-Socket-INET6-2.51.tar.gz 23
tar zxvf IP-Country-2.23.tar.gz 24
tar zxvf File-Temp-0.20.tar.gz 25
tar zxvf NetAddr-IP-4.007.tar.gz 26
tar zxvf Net-CIDR-Lite-0.20.tar.gz 27
tar zxvf Net-IP-1.25.tar.gz 28
tar zxvf Net-Ident-1.20.tar.gz 29
tar zxvf Digest-SHA-5.45.tar.gz 30
tar zxvf Digest-SHA1-2.11.tar.gz 31
tar zxvf Digest-HMAC-1.01.tar.gz 32
tar zxvf Net-DNS-0.61.tar.gz 33
tar zxvf version-0.74.tar.gz 34
tar zxvf Net-DNS-Resolver-Programmable-v0z 35
tar zxvf HTML-Tagset-3.10.tar.gz 36
tar zxvf HTML-Parser-3.56.tar.gz 37
tar zxvf ExtUtils-CBuilder-0.21.tar.gz 38
tar zxvf Encode-Detect-1.00.tar.gz 39
tar zxvf ExtUtils-ParseXS-2.18.tar.gz 40
tar zxvf Error-0.17011.tar.gz 41
tar zxvf GD-2.35.tar.gz 42
tar zxvf PerlMagick-6.32.tar.gz 42.1
tar zxvf GD-SecurityImage-1.64.tar.gz 43
tar zxvf GD-SecurityImage-Utils-1.02.tar. 44
tar zxvf Unix-Syslog-1.0.tar.gz 45
tar zxvf Sys-Hostname-Long-1.4.tar.gz 46
tar zxvf Regexp-Common-2.120.tar.gz 47
tar zxvf URI-1.35.tar.gz 48
tar zxvf Mail-SPF-v2.005.tar.gz 49
tar zxvf Mail-SPF-Query-1.999.1.tar.gz 50
tar zxvf TimeDate-1.16.tar.gz 51
tar zxvf Pod-Escapes-1.04.tar.gz
52
tar zxvf Pod-Simple-3.05.tar.gz 53
tar zxvf Test-Pod-1.26.tar.gz 54
tar zxvf MailTools-2.02.tar.gz 55
tar zxvf Crypt-OpenSSL-Random-0.04.tar.gz 56
tar zxvf Crypt-OpenSSL-RSA-0.25.tar.gz 57
tar zxvf Mail-DKIM-0.29.tar.gz 58
tar zxvf Mail-DomainKeys-1.0.tar.gz 59
tar zxvf MIME-tools-5.425.tar.gz 60
tar zxvf libwww-perl-5.808.tar.gz 61
tar zxvf Mail-SpamAssassin-3.2.3.tar.gz 62
tar zxvf Convert-TNEF-0.17.tar.gz 63
tar zxvf Convert-UUlib-1.09.tar.gz 64
tar zxvf Net-Server-0.97.tar.gz 65
tar zxvf Time-HiRes-1.9711.tar.gz 66
tar zxvf Time-HiRes-1.9711.tar.gz 67
tar zxvf Log-Log4perl-1.14.tar.gz 68
//其它组件的安装方式类同,只有特殊处理时下面会给出说明
  在安装到perl模块的第21个时(DBD-mysql),请先安装Socket6(新增加),其安装方法与上面类同.在安装到第41个时(GD),其交互选项较多,特说明如下.
[root@redhat GD-2.35]# ln -sv /usr/local/jpeg/lib/* /usr/lib
create symbolic link `/usr/lib/libjpeg.a' to `/usr/local/jpeg/lib/libjpeg.a'
create symbolic link `/usr/lib/libjpeg.la' to `/usr/local/jpeg/lib/libjpeg.la'
create symbolic link `/usr/lib/libjpeg.so' to `/usr/local/jpeg/lib/libjpeg.so'
ln: `/usr/lib/libjpeg.so.62': File exists
ln: `/usr/lib/libjpeg.so.62.0.0': File exists
[root@redhat GD-2.35]# perl Makefile.PL
Where is libgd installed? [/usr/lib] /usr/local/gd/lib
Please choose the features that match how libgd was built:
Build JPEG support? [y]
Build PNG support? [y]
Build FreeType support? [y]
Build GIF support? [y]
Build support for animated GIFs? [y]
Build XPM support? [y]

If you experience compile problems, please check the @INC, @LIBPATH and @LIBS
arrays defined in Makefile.PL and manually adjust, if necessary.

Checking if your kit is complete...
Looks good
Writing Makefile for GD

  而在安装完了42(GD)后,请不要先急着安装43(GD-SecurityImage),请先安装新增加的42.1(PerlMagick),方法同上.如果Magick安装不成功,也可以通过rpm的方式来安装,在系统自带的光盘中有,方法如下:
[root@redhat tmp]# rpm -ivh ImageMagick-6.0.7.1-5.i386.rpm
warning: ImageMagick-6.0.7.1-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:ImageMagick ########################################### [100%]
/sbin/ldconfig: /usr/local/mysql/lib/libmysqlclient_r.so.15 is not a symbolic link

/sbin/ldconfig: /usr/local/mysql/lib/libndbclient.so.2 is not a symbolic link

/sbin/ldconfig: /usr/local/mysql/lib/libmysqlclient.so.15 is not a symbolic link

[root@redhat tmp]# rpm -ivh ImageMagick-perl-6.0.7.1-5.i386.rpm
warning: ImageMagick-perl-6.0.7.1-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:ImageMagick-perl ########################################### [100%]

安装amavisd
  1:安装
[root@redhat tmp]# tar zxvf amavisd-new-2.5.2.tar.gz
[root@redhat tmp]#
cd amavisd-new-2.5.2
[root@redhat amavisd-new-2.5.2]# mkdir -p /var/amavis /var/amavis/tmp /var/amavis/var /var/amavis/db
[root@redhat amavisd-new-2.5.2]# chown -R amavis:amavis /var/amavis
[root@redhat amavisd-new-2.5.2]#
chmod -R 750 /var/amavis
[root@redhat amavisd-new-2.5.2]# cp amavisd /usr/local/sbin/
[root@redhat amavisd-new-2.5.2]#
chown root /usr/local/sbin/amavisd
[root@redhat amavisd-new-2.5.2]# chmod 755 /usr/local/sbin/amavisd
[root@redhat amavisd-new-2.5.2]#
cp amavisd.conf /etc/
[root@redhat amavisd-new-2.5.2]#
chown root /etc/amavisd.conf
[root@redhat amavisd-new-2.5.2]#
chmod 644 /etc/amavisd.conf
[root@redhat amavisd-new-2.5.2]#
mkdir /var/virusmails
[root@redhat amavisd-new-2.5.2]#
chown amavis:amavis /var/virusmails
[root@redhat amavisd-new-2.5.2]# chmod 750 /var/virusmails
[root@redhat amavisd-new-2.5.2]#
  2:配置amavisd.conf文件
//因该文件内容较多,这里只列出比较重要的选项,完整的文件将会在附件中给出
[root@redhat tmp]# vi /etc/amavisd.conf
$max_servers=8;
$daemon_user = 'amavis';
$daemon_group = 'amavis';
$mydomain = 'test.com';
$db_home = "$MYHOME/db";
$inet_socket_port = 10024;
$sa_tag_level_deflt = -100;
$sa_tag2_level_deflt = 6.3;
$sa_kill_level_deflt = $sa_tag2_level_deflt;
$virus_admin = "
virusalert@$mydomain";
$sa_spam_subject_tag = '***SPAM*** ';
$notify_method = $forward_method;
$forward_method = 'smtp:127.0.0.1:10025';
$final_virus_destiny = D_DISCARD;
$final_banned_destiny = D_DISCARD;
$final_spam_destiny = D_PASS;
$virus_admin = "postmaster\@$mydomain"; # notifications recip.
$mailfrom_notify_admin = "postmaster\@$mydomain"; # notifications sender
$mailfrom_notify_recip = "postmaster\@$mydomain"; # notifications sender
$mailfrom_notify_spamadmin = "postmaster\@$mydomain"; # notifications sender
$mailfrom_to_quarantine = ''; # null return path; uses original sender if undef
['ClamAV-clamd',
&ask_daemon, ["CONTSCAN {}n", "/var/run/clamav/clamd.socket"],
qr/bOK$/, qr/bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
  3:测试启动
[root@redhat amavisd-new-2.5.2]# /usr/local/sbin/amavisd debug
//如果出现以下的错误,则需重新编译64(Convert-UUlib)
Problem in Amavis::Unpackers code: Can't locate Convert/UUlib.pm in @INC
  4:测试启动spamassassin
//更改/etc/mail/spammassassin/local.cf中的值为下面的参数
required_hits 10.0
rewrite_subject 1
required_score 5.0
rewrite_header Subject *****SPAM*****
report_safe 1
use_bayes 1
bayes_auto_learn 1
skip_rbl_checks 1
use_razor2 0
use_pyzor 0
ok_locales all
[root@linux ~]#
spamassassin -d --lint
[root@linux ~]#
/usr/bin/spamd -d
[26002] warn: server socket setup failed, retry 1: spamd: could not create INET socket on
[26002] warn: server socket setup failed, retry 2: spamd: could not create INET socket on
[26002] error: spamd: could not create INET socket on 127.0.0.1:783: Address already in use
spamd: could not create INET socket on 127.0.0.1:783: Address already in use
[root@linux ~]#
echo "/usr/bin/spamd -d" >> /etc/rc.local
[root@linux ~]#
  5:启动amavis并测试postfix ,正常情况下应出现下面的提示
[root@redhat amavisd-new-2.5.2]# /usr/local/sbin/amavisd
[root@redhat amavisd-new-2.5.2]# postfix start
postfix/postfix-script: starting the Postfix mail system
[root@redhat amavisd-new-2.5.2]# telnet localhost 10024
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 [127.0.0.1] ESMTP amavisd-new service ready
EHLO test.com
250-[127.0.0.1]
250-VRFY
250-PIPELINING
250-SIZE
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 XFORWARD NAME ADDR PROTO HELO

//测试smtp及sasl功能,正常情况应如下示
[root@redhat etc]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 Welcome to our redhat.test.com ESMTP,Warning: Version not Available!
EHLO test.com
250-redhat.test.com
250-PIPELINING
250-SIZE 1433600
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN //注意要显示这两行
250-AUTH=LOGIN PLAIN

250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

//如果上述没有显示,且/var/log/maillog文件中有下面的提示,请按下面的方法
//排除
Jan 8 13:59:19 redhat postfix/smtpd[32315]: fatal: open database /etc/aliases.d
No such file or directory
[root@redhat etc]# postfix stop
[root@redhat amavisd-new-2.5.2]#
cd /etc/
[root@redhat etc]# postalias aliases
[root@redhat etc]# postfix start
  6:增加Chinese_rules.cf支持
  Chinese_rules.cf是教育科研网的反垃圾邮件小组对大量垃圾邮件和正常邮件进行分析后得出的一个关键字/分数规则集,用于处理中文(简体)垃圾邮件还是比较有效的。这里我们通过如下命令增加到系统,而且由于该规则每周更新一次,为了达到最好效果,最好在crontab里增加自动更新的内容,输入:
[root@redhat etc]# wget -N -P /usr/share/spamassassin
[root@redhat etc]#
/usr/bin/crontab -e
0 0 1 * * wget -N -P /usr/share/spamassassin ;
 /usr/local/sbin/amavisd stop;/usr/local/sbin/amavisd start

  该完成大半了吧,还有一篇文章的内容应就可以使用了,如果大家在安装中有遇到一些问题,欢迎拿出来一起讨论.
阅读(971) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~