上一篇文章我们搭建了postfix搭建了SMTP服务器(MTA),SMTP邮件服务器已经ok,但是光发送邮件还满足不了我们的邮件服务器的需求,我们还需要一个能够接受邮件的POP3/IMAP服务器(MUA)
我们使用dovecot构建我们的收件服务器
依赖
- # yum -y install pam-devel
下载
- # wget http://www.dovecot.org/releases/2.0/dovecot-2.0.13.tar.gz
安装
- # useradd -M -s /sbin/nologin dovecot # 创建dovecot的运行账户
- # useradd –M –s /sbin/nologin dovenull
- # tar zxvf dovecot-2.0.13.tar.gz
- # cd dovecot-2.0.13.tar.gz
- # ./configure --sysconfdir=/etc --with-mysql –with-pam
- # make && make install
- # cd doc
- # mkdir /etc/ssl/certs –p
- # mkdir -p /etc/ssl/private
- # sh mkcert.sh
配置
- # cp /usr/local/share/doc/dovecot/example-config/dovecot.conf /etc/dovecot/ # 建立dovecot配置文件
- # cp -r /usr/local/share/doc/dovecot/example-config/conf.d /etc/dovecot/ # 建立dovecot配置文件的需求文件
- # vi /etc/dovecot/dovecot.conf
- 20 protocols = imap pop3 lmtp # 支持邮局协议
- # vi /etc/dovecot/conf.d/10-auth.conf
- 9 disable_plaintext_auth = no#允许明文密码验证
- # vi /etc/dovecot/conf.d/10-ssl.conf
- 6 ssl = no # 禁用s
- # vi /etc/dovecot/conf.d/10-mail.conf
- 24 mail_location = maildir:~/Maildir # 邮件存储格式及位置
- // 创建PAM认证文件
- # vi /etc/pam.d/dovecot
- auth required pam_nologin.so
- auth include system-auth
- account include system-auth
- sesssion include system-auth
- # dovecot # 启动服务
测试:
# telnet localhost 110
出现+Ok Dovecot ready.则正确
还记得我们上一篇发的一个测试邮件吧… 这里我们就收到了
当遇到 -ERR Authentication failed.这个错误时请查看密码是否正确
修改密码 passwd username (linux 命令 usermod 不太好用)
当遇到问题首先要查看之前的postfix和dovecot配置是否正确请仔细检查一一对比
错误总结
1、
错误:
dovecot 启动时 显示 ssl_cert_file:Can't use /etc/ssl/certs/dovecot.pem
解决
// 创建两个文件夹
mkdir –p /etc/ssl/certs/
mkdir –p /etc/ssl/private
进入到源码包解压目录
cd doc
sh mkcert.sh
错误:
telnet 110端口的时候停在Escape character is ‘^]’.
不出现+Ok Dovecot ready.
日志信息:
Aug 4 16:52:35 localhost dovecot: auth: Fatal: Support not compiled in for passdb driver 'pam'
Aug 4 16:52:35 localhost dovecot: master: Error: service(auth): command startup failed, throttling
Aug 4 16:53:17 localhost dovecot: master: Warning: Killed with signal 15 (by pid=17402 uid=0 code=kill)
Aug 4 16:53:18 localhost dovecot: pop3-login: Error: auth: connect(login) failed: Connection refused
Aug 4 16:53:54 localhost dovecot: pop3-login: Disconnected: Shutting down (no auth attempts): rip=127.0.0.1, lip=127.0.0.1, secured
解决:
预编译时加入参数 –with-pam
yum –y install pam-devel
./configure –sysconfdir=/etc –with-pam –with-mysql
make && make install
本文出自 “cold night” 博客,转载请与作者联系!
————————————————————————————————————————————————————————————