设置hostname
1 | echo "mail.example.com" > /etc/hostname |
MySQL安装及配置
1 | # 安装mysql |
postfix安装
1 | # 安装过程中需要选择Postfix的类型,请选择Internet Site: |
修改postfix配置文件
1 | # 生成postfix配置 |
Dovecot安装及配置
Dovecot安装
1 | # 安装 |
Dovecot的配置
需要修改的配置文件有:
- /etc/dovecot/dovecot.conf Dovecot的主配置文件
- /etc/dovecot/conf.d/10-mail.conf Dovecot将要操作的磁盘路径相关配置信息
- /etc/dovecot/conf.d/10-auth.conf 用户验证相关配置信息
- /etc/dovecot/conf.d/auth-sql.conf.ext SQL-Type验证相关配置信息
- /etc/dovecot/dovecot-sql.conf.ext Dovecot与数据库连接相关配置信息
- /etc/dovecot/conf.d/10-master.conf Dovecot本地socket相关配置信息
- /etc/dovecot/conf.d/10-ssl.conf 关于SSL的相关配置信息
1 | # 修改 /etc/dovecot/dovecot.conf |
修改/etc/dovecot/conf.d/10-master.conf文件
找到文件中的service lmtp并将其修改如下:1
2
3
4
5
6
7
8
9
10
11
12
13
14service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
}
# Create inet listener only if you can't use the above UNIX socket
#inet_listener lmtp {
#Avoid making LMTP visible for the entire internet
#address =
#port =
#}
}
找到文件中service auth并将其内容修改如下:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27service auth {
# auth_socket_path points to this userdb socket by default. It's typically
# used by dovecot-lda, doveadm, possibly imap process, etc. Its default
# permissions make it readable only by root, but you may need to relax these
# permissions. Users that have access to this socket are able to get a list
# of all usernames and get results of everyone's userdb lookups.
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
#group =
}
# Postfix smtp-auth
#unix_listener /var/spool/postfix/private/auth {
# mode = 0666
#}
# Auth process is run as this user.
user = dovecot
}
找到文件中service auth-worker内容并修改如下:1
2
3
4
5
6service auth-worker {
# Auth worker process is run as root by default, so that it can access
# /etc/shadow. If this isn't necessary, the user should be changed to
# $default_internal_user.
user = vmail
}
重新启动Dovecot服务:1
service dovecot restart