1, postfix configure the host server's hostname
[root @ LLH ~] # hostnamectl the SET-hostname mail.open.com
[root @ mail ~] #
Add DNS
2, environment ready - configured DNS server
[root @ mail ~] # yum install -y bind
give be a backup master profile
cp /etc/named.conf{,.bak}
edit the main configuration file:
[the root @ mail ~] # /etc/named.conf Vim
checks syntax error:
[ root @ mail ~] # named- checkconf
edit from the file Zone
[root @ mail ~] # vim /etc/named.rfc1912.zones
replicate DNS template:
[root @ mail ~] # cd / var / named
[root @ mail named] # cp -a named.loopback open.com.zone
editor Analysis file:
[root @ mail named] # vim open.com.zone
start the service;
[root @ mail named] # systemctl restart named
[root @ mail named] # systemctl enable named
test:
3 Configure the Postfix mail server
Default server exists postfix:
[the root @ mail ~] # RPM -q postfix
postfix-2.10.1-6.el7.x86_64
backup master configuration file:
[the root mail @ ~] {# CP /etc/postfix/main.cf , .bak}
modify the configuration file:
[the root mail @ ~] Vim /etc/postfix/main.cf #
75 myhostname = mail.open.com
83 open.com mydomain =
99 = $ mydomain Myorigin
1 16 inet_interfaces = 192.l68. 154.140
164 is #mydestination =
mydomain, localhost
166 mydestination =
mydomain, localhost,
mydomain, www.
myd omain
263 mynetworks = 192.168.154.0/24, 127.0.0.0/8
295 relay_domains = $mydestination
418 home_mailbox = Maildir/
Start postfix service:
[root @ mail ~] # systemctl enable postfix --now
[root @ mail ~] # IS-systemctl the Active postfix.service
the Active
[root @ mail ~] #
create a test user:
copy a telnet session installation package Mail transfer :( note if it is temporary mount the CD file, modify the host name after the restart to take effect, you need to install the mount when here again, otherwise the installation error)
[root @ mail ~] # yum -y install the Telnet
[root @ mail ~ ] # the Telnet localhost 25 // send mail using the SMTP (25 / TCP)
Trying :: 1 ...
Connected to localhost.
Escape Character IS '^]'.
220 mail.open.com ESMTP Postfix
the HELO bob // tell the client to the server address
250 mail.open.com
mail from: sender address [email protected] //
250 2.1.0 Ok
RCPT to: // [email protected] recipient address
250 2.1.5 Ok
the Data // server to inform start transferring data of
354 End data with.
subject: "my mail" // message header
want to go to school - the message body //
// end of the message content.
250 2.0.0 Ok: Queued AS 760BB6111659
the Quit // exit end of this session
221 2.0.0 Bye
Connection Closed by Foreign . host
check if the mail is sent successfully:
view the contents of the file:
4, configured to receive a mail server Dovecot
Install dovecot package:
[root @ mail ~] # yum -y install dovecot
configure dovecot
to enable the most basic Devocot service, the need for file backup /etc/dovecot/dovecot.conf
[root @ mail ~] # cp / etc / dovecot /dovecot.conf {, .bak}
modify the configuration file:
[the root mail @ ~] Vim /etc/dovecot/dovecot.conf #
24 Protocols POP3 IMAP LMTP =
30 * = the listen
48 login_trusted_networks = 192.168.154.0/24
modify / etc / dovecot / conf.d / 10- mail.conf profile
[the root @ mail ~] # Vim /etc/dovecot/conf.d/10-mail.conf
mail_location = Maildir: ~ / Maildir
start service:
[the root @ ~ mail] # systemctl Start Dovecot
[the root @ mail ~] # systemctl Dovecot iS-Active
Active
POP3 protocol for receiving test
[the root @ mail ~] # Telnet localhost 110 // POP3 port 110 / tcp
... ::. 1 the Trying
Telnet: Connect to address ::. 1: Connection refused The
the Trying 127.0.0.1 ...
. Connected to localhost
. The Escape Character IS '^]'
. + READY Dovecot the OK
User Bob to authenticate the user //
+ the OK
Pass // Bob authentication password
. + the OK Logged in
List view messages //
+ the OK messages 1:
1 409
.
RETR 1 // receive and view the first message
after Bob receive a message, the message is no longer stored in a new inside, but in the current cur