邮件服务器搭建 Centos+Postfix+Dovecot+Roundcube
2015-02-06 16:57
686 查看
1、安装postfix
yum remove sendmail
yum install postfix
1.1、修改postfix配置
vim /etc/postfix/main.cf,在文件最后加上如下配置
myhostname = m.wepu.org #本机名
mydomain = m.wepu.org #本机域名
inet_interfaces = all #监听来自所有网络端口
#配置postfix转发认证,添加如下配置
(以下内容来自/usr/share/doc/postfix-2.6.6/README-Postfix-SASL-RedHat.txt文件,)
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination
1.2 启动postfix
service postfix start
2.安装sasl验证
yum search cyrus-sasl
确保安装以下的包
cyrus-sasl-lib-2.1.23-13.el6_3.1.x86_64
cyrus-sasl-plain-2.1.23-13.el6_3.1.x86_64
cyrus-sasl-lib-2.1.23-13.el6_3.1.i686
cyrus-sasl-2.1.23-13.el6_3.1.x86_64
yum install cyrus-sasl.x86_64
重启saslauthd服务
service saslauthd restart
确保添加开机启动 chkconfig saslauthd on
如果不启动该服务,认证会出现问题,直接导致gerrit邮件发送不成功
3、安装dovecot
yum install -y dovecot
vim /etc/dovecot/conf.d/10-ssl.conf
#ssl_cert = </etc/pki/dovecot/certs/dovecot.pem #屏蔽
#ssl_key = </etc/pki/dovecot/private/dovecot.pem #屏蔽
#并在文件最后加上
ssl = no
disable_plaintext_auth = no
auth_mechanisms = plain login
mail_location = mbox:~/mail:INBOX=/var/mail/%u #设置收件位置
vim /etc/dovecot/dovecot.conf 在文件最后加上如下配置
protocols = imap pop3 #启动imap pop3服务
4、安装roundcubemail(webmail)
下载roundcubemail 从官方wangzhan下载文件 (http://roundcube.net/download/)
tar zxvf roundcubemail-1.0.4.tar.gz
mv roundcubemail-1.0.4 /var/www/html/mail
chwon apache:apache -R /var/www/html/mail
cd /var/www/html/mail/config
cp config.inc.php.sample config.inc.php
编辑配置文件
vim config.inc.php
$config['db_dsnw'] = 'mysql://root:ws20130620@localhost/roundcubemail';
$config['default_host'] = 'm.wepu.org';
创建数据库
mysql
> CREATE DATABASE roundcubemail ;
> GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost IDENTIFIED BY 'password';
执行脚本
mysql roundcubemail < SQL/mysql.initial.sql
重启httpd服务器
service httpd restart
5. 新建邮件用户
useradd admin
passwd admin
mkdir -p /home/admin/mail/.imap/INBOX # 创建用户的本地邮箱
chown admin:admin -R /home/admin/
true > /var/spool/mail/admin #清空以下邮箱,否则可能出现ERR Mailbox isn't a valid mbox file错误
6. 登录WebMail:http://IP/mail/
附加:
通过脚本添加用户
新建addmail.sh脚本 以下为脚本(运行 ./addmail.sh wepu 则添加邮箱地址wepu@m.wepu.org 密码wp20150113)
#!/bin/sh
#read -p mail: mail
#echo $mail
useradd $1
mkdir -p /home/$1/mail/.imap/INBOX
chown $1
1
-R /home/$1/
sed -i '$d' /etc/shadow
echo "$1:\$6\$B8sYsXSy\$NDQd0F/xXQ3JFSgO4e3pTR2sozxfoN2.zPrk/qxVjfCjc8yjqD8vM96IlK7UgOGSY5/o.hIpCtmgHC8KKfadT0:16456:0:99999:7:::"
>> /etc/shadow
yum remove sendmail
yum install postfix
1.1、修改postfix配置
vim /etc/postfix/main.cf,在文件最后加上如下配置
myhostname = m.wepu.org #本机名
mydomain = m.wepu.org #本机域名
inet_interfaces = all #监听来自所有网络端口
#配置postfix转发认证,添加如下配置
(以下内容来自/usr/share/doc/postfix-2.6.6/README-Postfix-SASL-RedHat.txt文件,)
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination
1.2 启动postfix
service postfix start
2.安装sasl验证
yum search cyrus-sasl
确保安装以下的包
cyrus-sasl-lib-2.1.23-13.el6_3.1.x86_64
cyrus-sasl-plain-2.1.23-13.el6_3.1.x86_64
cyrus-sasl-lib-2.1.23-13.el6_3.1.i686
cyrus-sasl-2.1.23-13.el6_3.1.x86_64
yum install cyrus-sasl.x86_64
重启saslauthd服务
service saslauthd restart
确保添加开机启动 chkconfig saslauthd on
如果不启动该服务,认证会出现问题,直接导致gerrit邮件发送不成功
3、安装dovecot
yum install -y dovecot
vim /etc/dovecot/conf.d/10-ssl.conf
#ssl_cert = </etc/pki/dovecot/certs/dovecot.pem #屏蔽
#ssl_key = </etc/pki/dovecot/private/dovecot.pem #屏蔽
#并在文件最后加上
ssl = no
disable_plaintext_auth = no
auth_mechanisms = plain login
mail_location = mbox:~/mail:INBOX=/var/mail/%u #设置收件位置
vim /etc/dovecot/dovecot.conf 在文件最后加上如下配置
protocols = imap pop3 #启动imap pop3服务
4、安装roundcubemail(webmail)
下载roundcubemail 从官方wangzhan下载文件 (http://roundcube.net/download/)
tar zxvf roundcubemail-1.0.4.tar.gz
mv roundcubemail-1.0.4 /var/www/html/mail
chwon apache:apache -R /var/www/html/mail
cd /var/www/html/mail/config
cp config.inc.php.sample config.inc.php
编辑配置文件
vim config.inc.php
$config['db_dsnw'] = 'mysql://root:ws20130620@localhost/roundcubemail';
$config['default_host'] = 'm.wepu.org';
创建数据库
mysql
> CREATE DATABASE roundcubemail ;
> GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost IDENTIFIED BY 'password';
执行脚本
mysql roundcubemail < SQL/mysql.initial.sql
重启httpd服务器
service httpd restart
5. 新建邮件用户
useradd admin
passwd admin
mkdir -p /home/admin/mail/.imap/INBOX # 创建用户的本地邮箱
chown admin:admin -R /home/admin/
true > /var/spool/mail/admin #清空以下邮箱,否则可能出现ERR Mailbox isn't a valid mbox file错误
6. 登录WebMail:http://IP/mail/
附加:
通过脚本添加用户
新建addmail.sh脚本 以下为脚本(运行 ./addmail.sh wepu 则添加邮箱地址wepu@m.wepu.org 密码wp20150113)
#!/bin/sh
#read -p mail: mail
#echo $mail
useradd $1
mkdir -p /home/$1/mail/.imap/INBOX
chown $1
1
-R /home/$1/
sed -i '$d' /etc/shadow
echo "$1:\$6\$B8sYsXSy\$NDQd0F/xXQ3JFSgO4e3pTR2sozxfoN2.zPrk/qxVjfCjc8yjqD8vM96IlK7UgOGSY5/o.hIpCtmgHC8KKfadT0:16456:0:99999:7:::"
>> /etc/shadow
相关文章推荐
- Centos6 Postfix+Dovecot+Postfixadmin+Roundcube 搭建Webmail邮件系统
- Centos7下postfix+Dovecot+cyrus-sasl搭建个人局域网邮件服务器(测试使用)
- 搭建邮件服务器 Postfix + Dovecot (CentOS)
- CentOS 5.5 x64上使用Postfix + Dovecot + MySQL搭建邮件服务器
- CentOS6.5上简易搭建Postfix、Dovecot、Sasl、OPenwebmail局域网邮件服务器以及DNS服务器
- CentOS6.4+LAMP+Postfix+Dovecot+Postfixadmin+Roundcubemail 打造企业级邮件服务器 (1)
- CentOS6.4+LAMP+Postfix+Dovecot+Postfixadmin+Roundcubemail 打造企业级邮件服务器 (2)
- RHEL6.4 postfix+dovecot搭建邮件服务器
- Postfix+Dovecot邮件服务器配置指南,Postfix使用Dovecot认证,配置环境CentOS5.5
- 阿里云CentOS Linux服务器上用postfix搭建邮件服务器
- LAMP+Postfix+Dovecot+SquirrelMail邮件服务器搭建
- 阿里云CentOS Linux服务器上用postfix搭建邮件服务器
- 邮件服务器安装--Postfix + Dovecot + Squirrelmail--CentOS 6.4
- Postfix+Cyrus-SASL+dovecot搭建POP3/SMTP邮件服务器
- CentOS 64位下安装Postfix+Dovecot 配置邮件服务器笔记
- CentOS下的Postfix邮件服务器搭建
- [转]阿里云CentOS Linux服务器上用postfix搭建邮件服务器
- Postfix+Cyrus-SASL+dovecot搭建POP3/SMTP邮件服务器
- postfix+dovecot搭建邮件服务器
- postfix+mysql+extmail+dovecot虚拟域名邮件服务器搭建