当前位置:Linux教程 - Linux - 如何安装Cyrus IMAP服务器

如何安装Cyrus IMAP服务器

本文文件旨在提供在 Linux 系统中安装 Cyrus IMAP 服务器的一些帮助.
1. 介绍:
感谢 Bob Anderson ([email protected]) 和 Jorge Paramo ([email protected]), 他们在我使用 linux 的历程中给了我许多帮助.
什么是 IMAP 以及为什么要使用它?
IMAP( 互联网邮件访问协议 ) 提供了一种访问远程服务器上的电子邮件或 BBS 邮件的方法. IMAP 普遍被认为是 POP ( 邮局协议 ) 邮件的替代者. IMAP 允许用户从不同的机子上访问他们的电子邮件而不用下载那些邮件. 这种邮件的访问方式更加有效, 而且对终端用户来说有更多的好处.
可以在下面的网址下找到更详细的资料:
[1]http://www.imap.org/whatisIMAP.html
IMAP 和 POP 的比较可参见:
[2]http://www.imap.org/imap.vs.pop.brief.html
为什么要用 Cyrus 服务器?
Cyrus 被设计成在一台不允许一般用户登录的服务器上运行. Cyrus 也被认为是 Unix 上的两个最普遍的 IMAP 服务器之一. 另一个是华盛顿大学的 IMAP 服务器.
[3]ftp://ftp.cac.washington.edu/imap/imap.tar.Z
2. 我的系统之细节
我已经成功地在分别运行 Linux Kernel 2.1.79 和 2.0.33 的 486DX66 和 Pentium 两台机子上安装了 Cyrus 系统. 这两台机器是基于 Slackware 3.4 的.
3. Tcl 的安装
在安装 Cyrus 之前先确认你已经在自己的机子上安装了 Tcl, 否则你将无法使用 Cyrus Admin Tool (cyradm).
你可以在下面的网址找到最新 tcl 的资源:
[4]ftp://ftp.sunlabs.com/pub/tcl/
在安装之后, 确认在目录 /usr/local/lib/ 下存在 libtcl.a 文件. Tcl 8.0 使用的是 libtcl8.0.a, 你应当用下面的命令为它建立一个软连接:
# ln -s libtcl8.0.a libtcl.a
4. makedepend 安装
在你的系统中检查是否有 makedepend 命令. 如果没有也不用担心, Cyrus 资源中就有. ( 在我安装的 Slackware 3.4 中就没有 makedepend 命令. )
为了安装 makedepend , 先解压 Cyrus 的分发版, 然后进入 makedepend 目录, 输入下面的命令:
./configure
make
cp ./makedepend /usr/local/bin/makedepend
5. Cyrus 的安装
请小心地按照 Cyrus 分发版中的注意事项进行安装. 你可以在下面的网址中找到这些注意事项的一个拷贝:
[5]http://andrew2.andrew.cmu.edu/cyrus/imapd/install.html
关于某些安装步骤的一些提示:
如果你用的是 Slackware 3.4 ( 使用 影子口令 ), 你应当这样配置 :
./configure --with-login=unix_pwcheck
并直接这样 make 就可以:
make depend
make all CFLAGS=-O
第一步: 当加入 cyrus 用户时, 我将用户信息加锁, 以最小化可能的安全漏洞.
第三步: 我不单单是拷贝一个 /etc/syslog.conf , 而且编辑它们.
第九步: 在 linux 下, 确认象下面那样激活 pwcheck , 否则服务器便不会正确地工作:
umask 0;/usr/cyrus/bin/pwcheck &
umask 022
然后把下面的代码加到激活脚本中:
if [ -f /usr/cyrus/bin/pwcheck ]; then
echo -n ""Starting pwcheck for imap""
umask 0;/usr/cyrus/bin/pwcheck &
umask 022
fi
我将这些代码加入到我的 /etc/rc.d/rc.local 中, 它们运行正常. 第十二步: 当编辑 /etc/inetd.conf 的时候, 记得将 TCP 包 包含进去,如下:
imap stream tcp nowait cyrus /usr/sbin/tcpd /usr/cyrus/bin/imapd
还有当你编辑完成后, 不要忘了给 inetd 发送-HUP信号:
# ps ax | grep inetd
61 ? S 0:00 /usr/sbin/inetd
# kill -HUP 61
6. Sendmail 的设定
如果你没有 sendmail 的源码, 现在就下载吧. 除了运行 IMAP 外, 你还可以用它来做许多有趣的事, 比如设置反垃圾邮件的特性等等.
下面是我的 mc 文件. 除非在 /etc/sendmail.cN 文件中有用户名的入口, 否则它将把邮件转移给 IMAP. 它允许像 root 那样的系统用户把他们的邮件保存在缓冲池里; 然而, 一般的用户账号缺省地将使用 IMAP. 不要简单的拷贝下面的代码, 因为 sendmail 会因为用的是空格而不是制表符而出错:
divert(-1)
#
# (C) Copyright 1995 by Carnegie Mellon University
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of CMU not be
# used in advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
#
# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
# CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
#
# Contributed to Berkeley by John Gardiner Myers .
#
# This sample mc file is for a site that uses the Cyrus IMAP server
# exclusively for local mail.
#

divert(0)dnl
VERSIONID(``@(#)cyrusproto.mc 8.3 (Carnegie Mellon) @(#)cyrusproto.mc 8.3)
OSTYPE(linux)
define(``confBIND_OPTS,``-DNSRCH -DEFNAMES)
FEATURE(nouucp)
FEATURE(nocanonify)
FEATURE(always_add_domain)
MAILER(smtp)
MAILER(local)
MAILER(cyrus)

define(``confLOCAL_MAILER,``cyrus)

LOCAL_RULE_0
R$=N $: $#local $: $1
R$=N < @ $=w . > $: $#local $: $1
Rbb + $+ < @ $=w . > $#cyrusbb $: $1

LOCAL_CONFIG
FN /etc/sendmail.cN

# end of mc file
在生成 /etc/sendmail.cf 文件后, 创建一个叫 /etc/sendmail.cN 的文件, 将不打算用 IMAP 发送功能的用户帐号写入其中:
root
majordom
stan
mothra
在安装完 Sendmail 8.8.8 之后我还安装了 mail.local 作为给其它用户账号使用的本地发信程序. 下面是生成 mail.local 的诀窍. 先进入 sendmail 安装点下的 mail.local 的目录, 然后执行以下操作:
cp Makefile Makefile.orig
cp Makefile.dist Makefile
make
cp mail.local /bin/mail.local
chmod 4555 /bin/mail.local
执行完之后, 重启 sendmail.
还有不要忘了关掉 Cyrus 安装指南.
7. 设置信箱
确认要按照 IMAP 服务器的测试进行, 如果一切顺利, 就继续设置其它一些信箱.
8. 不承诺
不作任何担保, 也没有金钱回报, 请自己承担使用的风险.
9. 资源
必要的安装包.
Cyrus 的主页:
[6]http://andrew2.andrew.cmu.edu/cyrus/imapd/
最新的 Cyrus 版本可以从下面的地点下载:
[7]ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
Tcl 的主页:
[8]http://sunscript.sun.com/
最新的 Tcl 资源可以从下面的地点下载:
[9]ftp://ftp.sunlabs.com/pub/tcl/
Sendmail 的主页:
[10]http://www.sendmail.org/
最新的 Sendmail 版本可以从下面的地点下载:
[11]ftp://ftp.sendmail.org/ucb/src/sendmail/
参考资料:
1. http://www.imap.org/whatisIMAP.html
2. http://www.imap.org/imap.vs.pop.brief.html
3. ftp://ftp.cac.washington.edu/imap/imap.tar.Z
4. ftp://ftp.sunlabs.com/pub/tcl/
5. http://andrew2.andrew.cmu.edu/cyrus/imapd/install.html
6. http://andrew2.andrew.cmu.edu/cyrus/imapd/
7. ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
8. http://sunscript.sun.com/
9. ftp://ftp.sunlabs.com/pub/tcl/
10. http://www.sendmail.org/
11. ftp://ftp.sendmail.org/ucb/src/sendmail/