8、安装 courier-authlib(要用新版本,否则下一步出错)
[root @ root] # tar jxvfcourier-authlib-0.58.tar.bz2
[root @ root] # cdcourier-authlib-0.58
[root @ ]#./configure --prefix=/usr/local/courier-authlib --sysconfdir=/etc --without-authpam --without-authldap--without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql--with-authmysql --with-mysql-libs=/usr/local/mysql/lib/mysql--with-mysql-includes=/usr/local/mysql/inculde/mysql --with-redhatCFLAGS="-march=i686 -O2 -fexpensive-optimizations"CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"--with-authmysql=/usr/local/mysql/lib/mysql
[root @ ] # make
[root @ ] # make install
[root @ ] # chmod 755/usr/local/courier-authlib/var/spool/authdaemon
[root @ ] # cp/usr/localcourier-authlib/etc/authdaemonrc.dist /usr/localcourier-authlib/etc/authdaemonrc
# cp/usr/localcourier-authlib/etc/authmysqlrc.dist /usr/localcourier-authlib/etc/authmysqlrc
修改/etc/authdaemonrc 文件
[root @ ] # vi/usr/localcourier-authlib/etc/authlib/authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
编辑/etc/authmysqlrc 为以下内容,其中2525,2525 为postfix 用户的UID和GID。
[root @ ] # vi/usr/localcourier-authlib/etc/authlib/authdaemonrc
MYSQL_SERVER localhost
MYSQL_PORT 3306 (指定你的mysql监听的端口,这里使用默认的3306)
MYSQL_USERNAME extmail (这时为后文要用的数据库的所有者的用户名)
MYSQL_PASSWORD extmail (密码)
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD '2525'
MYSQL_GID_FIELD '2525'
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat('/var/mailbox/',homedir)
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD concat('/var/mailbox/',maildir)
注:这个文件中不能出现空格,或者会出现 FAQ 中的示例4 中的错误。
设置 courier-authlib 自启动
[root @ ] # cp courier-authlib.sysvinit/etc/init.d/courier-authlib
[root @ ] # chmod 755/etc/init.d/courier-authlib
[root @ ] # chkconfig —addcourier-authlib
[root @ ] # chkconfig —level 2345courier-authlib on
[root @ ] #echo"/usr/local/courier-authlib/lib/courier-authlib">> /etc/ld.so.conf
[root @ ] # ldconfig
[root @ ] # service courier-authlibstart (启动服务)
9、安装Courier-IMAP
[root @ root] # tar jxvf courier-imap-4.1.3.tar.bz2
[root @ root] # cd courier-imap-4.1.3
[root @ ]#./configure --prefix=/usr/local/imap --with-redhat --enable-unicode --disable-root-check --with-trashquota CPPFLAGS='-I/usr/local/ssl/include/openssl -I/usr/local/courier-uthlib/include' LDFLAGS='-L/usr/local/courier-authlib/lib/courier-authlib' COURIERAUTHCONFIG='/usr/local/courier-authlib/bin/courierauthconfig'CFLAGS='-I/usr/local/courier-authlib/include'
[root @ ] # make
[root @ ] # make install
[root @ ] # cp/usr/local/imap/etc/imapd.dist /usr/local/imap/etc/imapd
[root @ ] # cp/usr/local/imap/etc/imapd-ssl.dist/usr/local/imap/etc/imapd-ssl
[root @ ] # cp/usr/local/imap/etc/pop3d.dist /usr/local/imap/etc/pop3d
[root @ ] # cp/usr/local/imap/etc/pop3d-ssl.dist/usr/local/map/etc/pop3d-ssl
配置Courier-IMAP,为用户提供pop3服务:
[root @ testcourier-imap-4.1.3] # vi/usr/local/imap/etc/pop3d
POP3DSTART=YES
注:如果你想为用户提供IMAP服务,则需在"/usr/local/imap/etc/imapd"文件中设置"IMAPDSTART=yes";其它类同;
新建虚拟用户邮箱所在的目录,并将其权限赋予postfix用户:
[root @ testcourier-imap-4.1.3] # mkdir –p/var/mailbox
[root @ testcourier-imap-4.1.3] #chown –Rpostfix /var/mailbox
[root @ testcourier-imap-4.1.3] # cpcourier-imap.sysvinit /etc/rc.d/init.d/courier-imapd
[root @ testcourier-imap-4.1.3] # chmod 755/etc/rc.d/init.d/imapd
[root @ testcourier-imap-4.1.3] # chkconfig—addimapd
[root @ testcourier-imap-4.1.3] # chkconfig—level 2345 imapd on
[root @ testcourier-imap-4.1.3] # servicecourier-imapd start
接下来重新配置SMTP 认证,编辑 /usr/local/lib/sasl2/smtpd.conf ,确保其为以下内容:
[root @ testcourier-imap-4.1.3] # vi/usr/locla/lib/sasl2/smtpdconf
pwcheck_method: authdaemond
log_level: 3
mech_list:PLAIN LOGIN
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket