Linux set up Postfix mail server

Linux set up Postfix mail server

Chapter One: experimental environment and objectives

1. Experimental environment

两台局域网计算机,分别有Win7/10系统和Vm虚拟机安装CentOs7系统
CentOs7的IP地址:192.168.81.133;192.168.81.
Win7客户端(测试用),有Xshell或者SecureCRT工具

2. Objectives:

CentOs7下搭建Postfix邮件服务器,配置域名服务远程登录访问,新建用个测试用户(user1,user2),两个用户用telnet命令登录邮件服务器,实现两个用户的邮件互发,并实现局域网内两个计算器的邮件互发

Chapter II: Content Experiments

1.准备工作
2.搭建DNS服务   
3.搭建Postfix服务
4.远程登录访并实现两个用户邮件互发
5.局域网内两台计算机邮件互发

Chapter 3: Experimental Procedure

1. Preparation:

1.1 turn off the firewall and set the boot does not start from

systemctl stop firewalld
systemctl disable firewalld

1.2 Close selinux

setenforce 0

2. set up DNS service

2.1 install the DNS service

yum install bind -y

2.2 modify the configuration file named.conf

vim /etc/named.conf

 

2.3 modify named.rfc1912.zones file, add a forward zone

vim /etc/named.rfc1912.zones

 

2.4 Copy configuration template region

cp -p /var/named/named.localhost /var/named/duiyi.com.zone

2.5 modify the forward zone file

vim /var/named/duiyi.com.zone

 

2.6 Check grammar errors

named-checkconf

2.7 open DNS service, and set the boot from Kai

systemctl start named
systemctl enable named

2.8 Setting domain name server

vim /etc/resolv.conf

 

2.9 analytical verification

nslookup mail.duiyi.com

 

3. To build Postfix service

3.1 Check whether the system has been installed postfix server

rpm -q postfix

 

CentOs7 default postfix service there, and if not, by yum install postfix -y install it

3.2 to see if support cyrus, dovecot function

postconf -a

 

3.3 modify the main configuration file

vim /etc/postfix/main.cf 

amend as below:

75行:myhostname = mail.duiyi.com //本机主机名

83行:mydomain = duiyi.com         //服务器域名

99行:myorigin = $mydomain         //初始域名

113行:inet_interfaces = 192.168.81.133,127.0.0.1 //监听接口

119行:inet_protocols = ipv4       //监听网络版本,可以不改

164行:mydestination = myhostname,mydomain    //目标域

419 home_mailbox = Maildir/          //邮件目录,在用户家目录下

3.4 check whether the configuration file has a syntax error

postfix check

3.4 open Postfix service, and set the boot from Kai

systemctl start postfix
systemctl enable postfix

3.5 Create a test user sentmsg and recvmsg, and set password

useradd sentmsg
passwd sentmsg
useradd recvmsg
passwd recvmsg

 

3.6 Check whether the user has been created (Figure)

ls /home

 

4. Interview and implement remote login two users send each other e-mail

4.1 modify DNS Win7 / 10 to CentOs server address: 192.168.81.133

 

 

4.1 Enable Telnet on Win7 / 10, allowed as a client

控制面板->程序->程序和功能->启动或关闭Windows功能->Telnet客户端  勾选并确定

 

4.2 Open Xshell or SecureCRT and other remote tools (cmd window also, but the character encoding to be modified to utf-8), user login sentmsg in Xshell

telnet [email protected]

 

4.3 Xshell New tab, user login recvmsg

telnet [email protected]

 

4.4 sentmsg user sends a message to the user recvmsg

 

4.5 recvmsg view the message

 

As appears figure shows two users can send and receive e-mail

The two computers within the LAN send each message

5.1 Basic configuration described above do on another computer, the opening

Guess you like

Origin www.cnblogs.com/MessiXiaoMo3334/p/10964296.html