POSTFIX邮局系统搭建全过程 (二)

 

4、  安装courier-authlib

(1)       首先需要安装expect

yum install expect

(2)       安装courier-authlib

#groupadd -g 1000 vmail

#useradd -g 1000 -u 1000 -M -s /sbin/nologin vmail

# tar -jxvf courier-authlib-0.62.4.tar.bz2

# cd courier-authlib-0.62.4

#./configure --prefix=/usr/local/courier-authlib --without-stdheaderdir --sysconfdir=/etc  --without-authuserdb --without-authpam --without-authldap --without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql --without-authcustom --with-authmysql --with-mysql-libs=/usr/local/mysql/lib/mysql --with-mysql-includes=/usr/local/mysql/inculde/mysql --with-redhat --with-mailuser=vmail  --with-mailgroup=vmail

# make && make install

# make install-migrate

# make install-configure

更新lib库文件搜索路径

# echo "/usr/local/courier-authlib/lib/courier-authlib/">>/etc/ld.so.conf

# ldconfig

(3)       修改配置文件

# vi /etc/authlib/authdaemonrc

authmodulelist="authmysql"

authmodulelistorig="authmysql"

daemons=10

DEBUG_LOGIN=2


# vi  /etc/authlib/authmysqlrc

修改以下内容

MYSQL_SERVER            localhost

MYSQL_USERNAME          extmail

MYSQL_PASSWORD          extmail

MYSQL_SOCKET            /tmp/mysql.sock 

MYSQL_PORT              3306

MYSQL_DATABASE          extmail

MYSQL_USER_TABLE        mailbox

MYSQL_CRYPT_PWFIELD     password

MYSQL_UID_FIELD         "1000"

MYSQL_GID_FIELD         "1000"

MYSQL_LOGIN_FIELD       username

MYSQL_HOME_FIELD  concat("/var/mailbox/",homedir)

MYSQL_MAILDIR_FIELD     concat("/var/mailbox/",maildir)

MYSQL_QUOTA_FIELD    concat(quota,"S")

                  

(4)       启动及加入到自动运行队列

# cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib

# chmod 755 /etc/rc.d/init.d/courier-authlib

# chkconfig --add courier-authlib

# chkconfig courier-authlib on

# service courier-authlib start

# chmod a+x /usr/local/courier-authlib/var/spool/authdaemon

 

5、 安装courier-imap

(1)       安装courier-imap

# tar -jxvf courier-imap-4.8.0.tar.bz2 

# cd courier-imap-4.8.0

# ./configure --prefix=/usr/local/courier-imap --with-redhat --enable-unicode --disable-root-check --with-trashquota --without-ipv6 COURIERAUTHCONFIG="/usr/local/courier-authlib/bin/courierauthconfig"

# make && make install

# make install-configure

(2)       编辑配置文件启用pop3imap

# vi /usr/local/courier-imap/etc/pop3d

修改POP3DSTART=NO

POP3DSTART=YES

# vi /usr/local/courier-imap/etc/imapd

修改IMAPDSTART=NO

IMAPDSTART=YES

(3)       启动及加入自动运行队列

# cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imapd

# chmod 755 /etc/rc.d/init.d/courier-imapd

# chkconfig --add courier-imapd

# chkconfig courier-imapd on

# service courier-imapd start

6、  安装cyrus-sasl

(1)       先卸载本机自带的sasl

# rpm -qa |grep cyrus-sasl |xargs rpm -e --nodeps

# rm -rf /usr/lib/sasl

# rm -rf /usr/lib/sasl2

(2)       安装cyrus-sasl

# tar -zxvf cyrus-sasl-2.1.22.tar.gz

# cd cyrus-sasl-2.1.22

# ./configure  --enable-plain  --enable-cram  --enable-digest --enable-login  --enable-sql --disable-anon  --disable-ntlm --disable-gssapi  --disable-krb4 --disable-otp --disable-srp --disable-srp-setpass --with-mysql=/usr/local/mysql --with-mysql-includes=/usr/local/mysql/include/mysql --with-mysql-libs=/usr/local/mysql/lib/mysql --with-authdaemond=/usr/local/courier-authlib/var/spool/authdaemon/socket

# make && make install

(3)       共享链接库

# ln -sv /usr/local/lib/sasl2  /usr/lib/sasl2

# echo "/usr/local/lib">>/etc/ld.so.conf

# ldconfig

(4)       建立smtpd用户认证的配置文件

# vi /usr/local/lib/sasl2/smtpd.conf

pwcheck_method: saslauthd

mech_list: plain login

log_level:3

authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

(5)       创建运行时需要的目录

# mkdir -pv /var/state/saslauthd   

(6)       启动并测试

# /usr/local/sbin/saslauthd -a shadow pam

# /usr/local/sbin/testsaslauthd -u root -p xxttest  // xxttest  root的密码

(7)       开机自动启动

# echo "/usr/local/sbin/saslauthd -a shadow pam">>/etc/rc.local

 


注意前面要保留两个空格,不然会有问题

你可能感兴趣的:(系统,搭建)