邮件系统服务器搭建记录(三)(Postfix+Cyrus-sasl+Courier-authlib+Dovecot+ExtMail+MySQL)
7. 编译安装courier-authlib可以配置postfix使用虚拟用户和虚拟域,而这些信息通常会使用mysql数据库进行管理。因此postfix需要访问mysql数据库。本文使用courier-authlib,该软件调用cyrus-sasl库文件,与mysql进行通信, 帮助postfix验证虚拟用户的合法性。
在编译安装courier-authlib之前,要先安装courier-unicode,避免在对courier-authlib配置时出现如下错误:
1
configure: error: The Courier Unicode Library 1.2 appears not to be installed. You may need to install a separate development subpackage, in addition to the main package
访问The Courier Mail Server(http://www.courier-mta.org/authlib/)下载courier-unicode安装包并上传到服务器,解压并进行编译安装:
1
2
3
4
# tar -xvf courier-unicode-1.1.tar.bz2
# cd courier-unicode-1.1
# ./configure
# make && make install
注:在make && make install这一步执行后,如果提示如下错误:
1
2
3
4
./libtool: line 1125: g++: command not found
make: *** Error 1
make: Leaving directory `/root/courier-unicode-1.1'
make: *** Error 2
请安装gcc+和gcc-c++:
1
# yum install gcc+ gcc-c++
1
2
3
4
5
如果提示如下错误:
/usr/bin/install: cannot stat `.libs/libcourier-unicode.so.1.0.0': No such file or directory
make: *** Error 1
make: Leaving directory `/root/courier-unicode-1.1'
make: *** Error 2
注意检查courier-authlib是否已经安装,其版本是否同courier-unicode版本匹配,然后尝试使用低版本的courier-unicode进行编译安装。
成功安装courier-unicode后,访问The Courier Mail Server(http://www.courier-mta.org/authlib/)下载courier-authlib安装包并上传到服务器,解压并进行编译安装:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# cd ../courier-authlib-0.66.1
# ./configure \
--prefix=/usr/local/courier-authlib \
--sysconfdir=/etc \
--without-authpam \ #不启用基于pam的认证方式
--without-authshadow \
--without-authvchkpw \
--without-authpgsql \
--with-authmysql \ #启用基于mysql的认证方式
--with-mysql-libs=/usr/lib64/mysql \ #指定mysql库文件存放位置
--with-redhat \
--with-authmysqlrc=/etc/authmysqlrc \
--with-authdaemonrc=/etc/authdaemonrc \ #指定authdaemonrc配置文件位置
--with-authdaemonvar=/var/spool/authdaemon \ #指定authdaemon.pid和相应套接字存放位置
--with-mailuser=postfix \ #调用courier-authlib的用户名
--with-mailgroup=postfix \ #调用courier-authlib的组名
# make && make install
注:如果在配置courier-authlib时出现错误,请检查是否安装了所依赖的软件包,比如libtool-ltdl/libtool-ltdl-devel、sqlite-devel等。
安装完成后,需要将authdaemon.pid和套接字所在目录的权限修改为755,以保证其他系统用户可以访问PID和套接字文件,才能与courier-authlib的端口进行通信:
1
2
3
# chmod 755 /var/spool/authdaemon/
# ls -ld /var/spool/authdaemon/
drwxr-xr-x. 2 postfix postfix 4096 Dec 28 10:48 /var/spool/authdaemon/
并把2个配置文件复制并进行改名:
1
2
# cp /etc/authdaemonrc.dist /etc/authdaemonrc
# cp /etc/authmysqlrc.dist /etc/authmysqlrc
courier-authlib提供了SysV风格的启动脚本,脚本在安装包下,名称为courier-authlib.sysinit:
1
2
# ls courier-authlib.sysvinit
courier-authlib.sysvinit
复制,+运行权限:
1
2
# cp courier-authlib.sysvinit /etc/init.d/courier-authlib
# chmod /etc/init.d/courier-authlib
接下来,修改/etc/authdaemonrc配置文件的如下内容:
1
2
3
# vi authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
由于暂时没有在Mysql中新建用户库,因此暂不对courier-authlib的与mysql相关的配置文件/etc/authmysqlrc进行配置。
下一节将介绍通过Web服务器 — Apache部署Webmail程序Extmail以及后台管理程序ExtMan,以及通过Extmail的脚本完成Mysql相关库和表结构的建立。
页:
[1]