免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
郵件系統(tǒng)安裝配置(postfix + dovecot)

安裝準(zhǔn)備與說明

服務(wù)器操作系統(tǒng):Linux (centos 6.2)

postfix 、dovecot 版本:直接使用 yum 安裝即可。

postfix 根目錄:/etc/postfix

dovecot 根目錄:/etc/dovecot

 

假設(shè)你的郵箱使用域名為:mailtest.cn 需要對該域名進(jìn)行解析操作(增加 mx 解析記錄)

 

假設(shè)服務(wù)器IP:123.123.123.123(備注:外網(wǎng)IP)

 

需要開放的端口:25、110、143

 

mysql數(shù)據(jù)庫相關(guān)信息

 

數(shù)據(jù)庫host:127.0.0.1(根據(jù)msql所在服務(wù)器實(shí)際IP填寫,此處只是舉例)

數(shù)據(jù)庫端口: 3306 (必須是 3306)

數(shù)據(jù)庫名稱:mailserver

數(shù)據(jù)庫用戶: root

數(shù)據(jù)庫密碼: 123456

 

解析操作:為域名mailtest.cn 新增一條 mx 解析記錄,并且該記錄指向IP:123.123.123.123

 

postfix 僅提供 smtp 服務(wù),不提供 pop3 和 imap 服務(wù),主要是用發(fā)送和接收郵件的(接收到的郵件后,一般轉(zhuǎn)交 dovecot 處理,dovecot 負(fù)責(zé)將 postfix 轉(zhuǎn)發(fā)過來的郵件保存到服務(wù)器硬盤上)

 

dovecot 僅提供 pop3 和 imap 服務(wù),不提供 smtp 服務(wù)(Foxmail之類的郵箱客戶端,都是通過pop3 和 imap 來收發(fā)郵件的。發(fā)郵件時,dovecot 會將郵件轉(zhuǎn)交給 postfix 來發(fā)送)

 

綜上,postfix 用來發(fā)郵件,dovecot 用來收郵件

 ( 重要!) postfix發(fā)送郵件的日志文件:/var/log/maillog

 

基本配置步驟

1主機(jī)名hostname配置(必須)

1.1 修改主機(jī)名:

[root@a ~] vi /etc/sysconfig/network

 

修改 HOSTNAME=mx.mailtest.cn 并保存,然后重啟服務(wù)器。如果沒有重啟服務(wù)器,更改主機(jī)名不會生效

1.2檢測主機(jī)名

[root@root ~] hostname

mail.devstore.cn

 

1.3開放防火墻中的 25、110、143 端口

 

[root@root ~] /sbin/iptables -I INPUT -p tcp --dport 25-j ACCEPT

 

[root@root ~] /sbin/iptables -I INPUT -p tcp --dport 110-j ACCEPT

 

[root@root ~] /sbin/iptables -I INPUT -p tcp --dport 143-j ACCEPT

 

[root@root ~] service iptables save

 

[root@root ~] service iptables restart

 

2. SELinux設(shè)置

2.1查看SELinux狀態(tài)

 

[root@root ~] /usr/sbin/sestatus -v       

 

( 查看SELinux是否開啟。如果不是顯示:    SELinux status: disabled    則代表著SELinux處于開啟狀態(tài)  )

 

2.2關(guān)閉SELinux的操作:

[root@root ~] vi /etc/selinux/config

將 SELINUX=enforcing 改為 SELINUX=disabled ,然后重啟機(jī)器(必須重啟,修改才能生效)。重啟后再查看一次狀態(tài),看看SELinux是否已經(jīng)關(guān)閉

 

3 安裝postfix

centos 6.2 默認(rèn)已經(jīng)安裝了 postfix ( postfix根目錄:/etc/postfix)

3.1 postfix狀態(tài)查看

[root@root ~] service postfix status

 

master (pid 4366) 正在運(yùn)行...

 

3.2查看系統(tǒng) MTA

[root@root ~] alternatives --display mta 查看系統(tǒng) MTA:郵件傳送端,即常說的郵件服務(wù)器是否為postfix

mta - 狀態(tài)是自動。

鏈接目前指向/usr/sbin/sendmail.postfix

/usr/sbin/sendmail.postfix - 優(yōu)先度 30

mta-mailq/usr/bin/mailq.postfix

mta-newaliases/usr/bin/newaliases.postfix

mta-pam/etc/pam.d/smtp.postfix

mta-rmail/usr/bin/rmail.postfix

mta-sendmail/usr/lib/sendmail.postfix

mta-mailqman/usr/share/man/man1/mailq.postfix.1.gz

mta-newaliasesman/usr/share/man/man1/newaliases.postfix.1.gz

mta-sendmailman/usr/share/man/man1/sendmail.postfix.1.gz

mta-aliasesman/usr/share/man/man5/aliases.postfix.5.gz

當(dāng)前"最佳"版本是/usr/sbin/sendmail.postfix。

 

sendmail.postfix說明當(dāng)前 MTA的確就是 postfix

 

4安裝postfix和dovecot插件

 

[root@root ~] yum -y install postfix* dovecot*

 

5 用戶管理

創(chuàng)建 vmail 用戶

[root@root ~] groupadd -g 2000 vmail       ( 指定新建用戶組vmailID2000  )

[root@root ~] useradd -g vmail -u 2000 vmail -d/var/vmail       (指定新建用戶vmailID2000,用戶根目錄為/var/vmail  )

[root@root ~] chown -R vmail:dovecot /etc/dovecot

[root@root ~] chmod -R o-rwx /etc/dovecot

 

6創(chuàng)建數(shù)據(jù)表

6.1mailserver數(shù)據(jù)庫需要新建1張表。表結(jié)構(gòu)參照如下:

CREATE TABLE `tb_user_email` (

  `id` bigint(20)NOT NULL AUTO_INCREMENT,

  `user_id`bigint(20) NOT NULL,

  `username`varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT '用戶郵箱名',

  `domain`varchar(255) CHARACTER SET utf8 NOT NULL COMMENT '用戶的郵箱域名',

  `password`varchar(255) CHARACTER SET utf8 NOT NULL,

  `home`varchar(255) CHARACTER SET utf8 DEFAULT NULL,

  `uid` int(11)DEFAULT NULL,

  `gid` int(11)DEFAULT NULL,

  `active` char(1)CHARACTER SET utf8 NOT NULL DEFAULT 'Y',

  `create_time`datetime NOT NULL COMMENT '創(chuàng)建時間',

  `create_user_id`bigint(20) DEFAULT NULL COMMENT '創(chuàng)建用戶id',

 `last_update_time` datetime DEFAULT NULL COMMENT '最后一次修改時間',

 `last_update_user_id` bigint(20) DEFAULT NULL COMMENT '最后一次修改的用戶id',

  `curr_type`int(5) NOT NULL DEFAULT '1' COMMENT '當(dāng)前狀態(tài)',

  `source`varchar(100) CHARACTER SET utf8 DEFAULT NULL,

  `destination`varchar(100) CHARACTER SET utf8 DEFAULT NULL,

  `type` int(5) NOTNULL COMMENT '郵箱類型 1iClap個人郵箱 2私有域名郵箱',

  PRIMARY KEY(`id`),

  KEY `user_id`(`user_id`) USING BTREE

) ENGINE=InnoDB AUTO_INCREMENT=632 DEFAULT CHARSET=utf8COLLATE=utf8_unicode_ci;

 

6.2表結(jié)構(gòu)需要額外說明的列:

active: 賬號是否“激活”狀態(tài),默認(rèn)為Y

domain:postfix會檢查接收到的郵件域名是否合法,及@后面的字符串

 

6.3關(guān)于表中密碼列 password 的值的說明

e10adc3949ba59abbe56e057f20f883e  是 123456 的MD5加密后的值

25f9e794323b453885f5181f1b624d0b  是 123456789 的MD5加密后的值

 

7為 postfix 配置<用戶賬號、域名>驗(yàn)證功能

7.1新建 /etc/postfix/mysql-virtual-mailbox-domains.cf  文件

hosts = 127.0.0.1

user = root

password = 123456

dbname = mailserver

query = SELECT 1 FROM tb_user_email  WHERE domain='%s'

# %s代表:域名

 

7.2新建 /etc/postfix/mysql-virtual-mailbox-maps.cf  文件

hosts = 127.0.0.1

user = root

password = 123456

dbname = mailserver

query = SELECT 1 FROM tb_user_email  WHERE username='%u'

# %u  代表:用戶賬號

 

7.3新建  /etc/postfix/mysql-virtual-alias-maps.cf  文件

hosts = 42.51.172.27

user = root

password = devdb

dbname = dev_store

query = SELECT destination FROMuser_enterprise_email  WHERE source='%s'

# %s  代表:域名

 

后續(xù)會有測試命令可以測試以上配置是否正確

 

配置 postfix + smtp 服務(wù)

1修改/etc/postfix/main.cf 文件(注意,以下配置內(nèi)容中,等于號 = 的左右 都必須有 空格):

[root@root ~] cd /etc/postfix/

[root@root postfix] vi main.cf

 

myhostname = mail.devstore.cn    #Mail服務(wù)器域名,EHLO名稱。郵箱名稱 ( xxx@mail.devstore.cn )  (主機(jī)名hostname的值必須和這個相同,否則會報錯的)

 

mydomain = devstore.cn   #郵箱域名 (xxx@devstore.cn )。必要的時候,你也可以設(shè)置成 mydomain =mail.devstore.cn ( xxx@mail.devstore.cn )

 

myorigin = $mydomain

 

inet_interfaces = all   #如果 inet_interfaces= localhost,則郵箱不接收外網(wǎng)的郵件,只接受內(nèi)網(wǎng)的郵件。inet_interfaces= all 則郵箱會接收外網(wǎng)的郵件

 

mydestination = localhost    #本地郵件域名,直接接收

 

mynetworks = 127.0.0.0/8     #116.255.217.0/28,127.0.0.0/8    #允許轉(zhuǎn)發(fā)的來源IP,該值設(shè)置后,mynetworks_style參數(shù)將被忽略掉

 

relay_domains = $mydestination

 

virtual_transport = lmtp:unix:private/dovecot-lmtp       (這個配置非常重要,是psotfix將接收到的郵件轉(zhuǎn)交給 dovecot處理的關(guān)鍵配置 )

 

virtual_mailbox_maps =mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf       (下面這3個文件就是調(diào)用剛才新創(chuàng)建的那3個文件來連接mysql數(shù)據(jù)庫的  )

 

virtual_alias_maps =mysql:/etc/postfix/mysql-virtual-alias-maps.cf

virtual_mailbox_domains =mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf

 

smtpd_sasl_type = dovecot

smtpd_sasl_path = private/auth

smtpd_sasl_auth_enable = yes

smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated, reject_unauth_destination, permit

broken_sasl_auth_clients = yes

 

#限制每一封郵件最大容量為 20M

#message_size_limit = 20480000

#限制postfix最大并發(fā)連接數(shù)

#default_process_limit = 100

 

修改好文件后,保存并退出。然后重啟psotfixservice postfixrestart

 

 

配置 dovecot + pop3 +imap

配置 dovecot 需要修改以下 8 個文件 ( dovecot根目錄:/etc/dovecot ):

/etc/dovecot/dovecot.conf                        Dovecot的主配置文件

/etc/dovecot/conf.d/10-auth.conf                 用戶驗(yàn)證相關(guān)配置信息

/etc/dovecot/conf.d/10-mail.conf                   Dovecot將要操作的磁盤路徑相關(guān)配置信息

/etc/dovecot/conf.d/10-master.conf                 Dovecot本地socket相關(guān)配置信息

/etc/dovecot/conf.d/10-ssl.conf                    關(guān)于SSL的相關(guān)配置信息

/etc/dovecot/conf.d/20-pop3.conf                  關(guān)于POP3的相關(guān)配置信息

/etc/dovecot/conf.d/auth-sql.conf.ext                 SQL-Type驗(yàn)證相關(guān)配置信息

/etc/dovecot/dovecot-sql.conf.ext            Dovecot與數(shù)據(jù)庫連接相關(guān)配置信息。example文件位置:/usr/share/doc/dovecot-2.0.9/example-config/

 

1 [root@root dovecot] vi/etc/dovecot/dovecot.conf
[root@root dovecot] vi /etc/dovecot/dovecot.conf

protocols = imap pop3 lmtp

 

2 [root@root dovecot] vi /etc/dovecot/conf.d/10-auth.conf

disable_plaintext_auth = no

auth_mechanisms = plain login

 

#禁止系統(tǒng)用戶登錄 ( !include auth-system.conf.ext前面加個 # )

#!include auth-system.conf.ext

 

#啟用mysql中的用戶 (  #!include auth-sql.conf.ext前面的 #號刪除掉 )

!include auth-sql.conf.ext

 

3 [root@root dovecot] vi/etc/dovecot/conf.d/10-mail.conf

mail_location = maildir:/var/vmail/%d/%n

mail_privileged_group = vmail

 

# namespace inbox 會因?yàn)?/span>dovecot的版本不同而有所改變

# Error: user xxx@mail.devstore.cn: Initializationfailed: namespace configuration error: inbox=yes namespace missing

# 如果系統(tǒng)日志/var/log/maillog中報上面的錯誤,則加入以下內(nèi)容

namespace inbox {

inbox = yes

}

 

4 [root@root dovecot] vi/etc/dovecot/conf.d/10-master.conf

#-------------------------------------------------------------可選操作 begin-----------------------------------------------------------------------------------

#通過將端口設(shè)置為0,以禁用非SSL加密的IMAPPOP3協(xié)議

service imap-login {

inet_listener imap {

port = 0

}

...

}

 

service pop3-login {

inet_listener pop3 {

port = 0

}

...

}

#-------------------------------------------------------------可選操作 end-----------------------------------------------------------------------------------

 

# 這個配置非常重要,是用來接收psotfix轉(zhuǎn)交過來的郵件的關(guān)鍵配置

 

service lmtp {

unix_listener /var/spool/postfix/private/dovecot-lmtp {

mode = 0600

user = postfix

group = postfix

}

 

#inet_listener lmtp {

#Avoid making LMTP visible for the entire internet

#address =

#port =

#}

 

service auth {

unix_listener /var/spool/postfix/private/auth {

mode = 0666

user = postfix

group = postfix

}

 

unix_listener auth-userdb {

mode = 0600

user = vmail

#group =

}

 

# Auth process is run as this user.

user = dovecot

}

 

service auth-worker {

user = vmail

}

 

5 [root@root dovecot] vi/etc/dovecot/conf.d/10-ssl.conf

ssl = no

 

6 [root@root dovecot] vi /etc/dovecot/conf.d/20-pop3.conf

pop3_uidl_format = %08Xu%08Xv

pop3_client_workarounds = outlook-no-nuls oe-ns-eoh

 

7 [root@root dovecot] vi/etc/dovecot/conf.d/auth-sql.conf.ext

passdb {

driver = sql

args = /etc/dovecot/dovecot-sql.conf.ext

}

 

#userdb {

# driver = sql

# args = /etc/dovecot/dovecot-sql.conf.ext

#}

 

userdb {

driver = static

args = uid=vmail gid=vmail home=/var/vmail/%d/%n

#注意這里的 home需要和 mail_location配置的值相同 ( mail_location10-mail.conf文件中 )

}

 

8 [root@root dovecot] vi /etc/dovecot/dovecot-sql.conf.ext      

(dovecot-sql.conf.ext文件所在位置:/usr/share/doc/dovecot-2.0.9/example-config/dovecot-sql.conf.ext,請先下載此文件后,再執(zhí)行編輯vi命令)

driver = mysql

connect = host=172.10.2.162 dbname=mailserver user=rootpassword=123456

default_pass_scheme = MD5    #  (default_pass_scheme是指用戶的密碼的加密方式:對應(yīng)users表中password列的值 )

 

#default_pass_scheme = PLAIN  #明文,不加密

 

#PLAIN: Password is in plaintext.

#CRYPT: Traditional DES-crypted password in /etc/passwd(e.g. "pass" = vpvKh.SaNbR6s)

#Dovecot uses libc's crypt() function, which means thatCRYPT is usually able to recognize MD5-CRYPT and possibly also other passwordschemes. Please see the notes below regarding glibc's crypt() and SHA-256/512support.

#The traditional DES-crypt scheme only uses the first 8characters of the password, the rest are ignored. Other schemes may have otherpassword length limitations (if they limit the password length at all).

#MD5-CRYPT: MD5 based salted password hash nowadayscommonly used in /etc/shadow. (e.g. "pass" =$1$ozdpg0V0$0fb643pVsPtHVPX8mCZYW/)

#MD5: Alias for MD5-CRYPT. Dovecot versions earlier thanv1.0.rc16 need to use this instead of MD5-CRYPT. This name is deprecatedbecause MD5-CRYPT isn't an actual MD5 hash.

#PLAIN-MD5: An actual MD5 hash of the password. (e.g."pass" = 1a1dc91c907325c69271ddf0c944bc72)

 

上面 8個文件修改完成后:

重啟 dovecot
[root@root postfix] service dovecot restart

 

重啟 postfix
[root@root dovecot] service postfix restart

 

到此為止,postfix和dovecot都配置好了,并且啟用了 smtp、pop3、imap 服務(wù)

 

[root@root dovecot] cat /var/log/maillog      查看日志.

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
在 Ubuntu 12.04 上安裝和配置郵件服務(wù) | vpsee.com
CentOS6.4+LAMP+Postfix+Dovecot+Postfixadmin+Roundcubemail 打造企業(yè)級郵件服務(wù)器 (1)
Ubuntu 12.04安裝配置Postfix dovecot cyrus sasl(mysql虛擬用戶)
使用postfix與dovecot在RHEL6下架設(shè)SSL的IMAP服務(wù)器
The Perfect Server - Fedora 12 x86_64 [ISPConfig 2] - Page 4 | HowtoForge - Linux Howtos and Tutorials
爛泥:Postfix郵件服務(wù)器搭建之軟件安裝與配置
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服