如何在Ubuntu 20.04上安装和配置Postfix

本教程详细介绍了如何在Ubuntu 20.04服务器上安装和配置Postfix邮件传输代理,包括安装过程、配置选项的选择以及测试邮件客户端的过程。此外,还提到了必要的先决条件,如非root用户和UFW防火墙的配置。通过本指南,读者将能够快速搭建起具有基本邮件功能的Postfix服务器。
摘要由CSDN通过智能技术生成

A previous version of this tutorial was written by Justin Ellingwood

本教程的先前版本由Justin Ellingwood撰写

介绍 (Introduction)

Postfix is a popular open-source Mail Transfer Agent (MTA) that can be used to route and deliver email on a Linux system. It is estimated that around 25% of public mail servers on the internet run Postfix.

Postfix是一种流行的开源邮件传输代理 (MTA),可用于在Linux系统上路由和传递电子邮件。 据估计,互联网上大约25%的公共邮件服务器运行Postfix。

In this guide, you’ll learn how to install and configure Postfix on an Ubuntu 20.04 server. Then, you’ll test that Postfix is able to correctly route mail by installing s-nail, a Mail User Agent (MUA), also known as an email client.

在本指南中,您将学习如何在Ubuntu 20.04服务器上安装和配置Postfix。 然后,您将通过安装s-nail ( 邮件用户代理 (MUA),也称为电子邮件客户端 )来测试Postfix是否能够正确路由邮件。

Note that the goal of this tutorial is to help you get Postfix up and running quickly with only some bare-bones email functionality. You won’t have a full featured email server by the end of this guide, but you will have some of the foundational components of such a setup to help you get started.

请注意,本教程的目标是仅使用一些基本的电子邮件功能来帮助您启动Postfix并快速运行。 到本指南结尾时,您将没有功能齐全的电子邮件服务器,但是您将拥有此类设置的一些基础组件,以帮助您入门。

先决条件 (Prerequisites)

In order to follow this guide, you’ll need the following:

为了遵守本指南,您需要具备以下条件:

  • A server running Ubuntu 20.04 to function as your Postfix mail server. This server should have a non-root user with sudo privileges and a firewall configured with UFW. You can follow our Ubuntu 20.04 initial server setup guide to set this up.

    运行Ubuntu 20.04的服务器用作Postfix邮件服务器。 该服务器应具有具有sudo特权的非root用户和使用UFW配置的防火墙。 您可以按照我们的Ubuntu 20.04初始服务器设置指南进行设置。

  • A Fully Qualified Domain Name pointed at your Ubuntu 20.04 server. You can find help on setting up your domain name with DigitalOcean by following our Domains and DNS Networking documentation. Be aware that if you plan on accessing mail from an external location, you will need to make sure you have an MX record pointing to your mail server as well.

    完全合格的域名指向您的Ubuntu 20.04服务器。 您可以按照我们的域名和DNS网络文档,找到有关使用DigitalOcean设置域名的帮助。 请注意,如果您打算从外部位置访问邮件,则需要确保您也具有指向邮件服务器的MX记录。

Note that this tutorial assumes that you are configuring a host that has the FQDN of mail.example.com. Wherever necessary, be sure to change example.com or mail.example.com to reflect your own FQDN.

请注意,本教程假设您正在配置FQDN为mail.example.com的主机。 如有必要,请确保更改example.commail.example.com以反映您自己的FQDN。

第1步-安装Postfix (Step 1 — Installing Postfix)

Postfix is included in Ubuntu’s default repositories, so you can install it with APT.

Postfix包含在Ubuntu的默认存储库中,因此您可以使用APT安装它。

To begin, update your local apt package cache:

首先,更新本地apt软件包缓存:

  • sudo apt update

    sudo apt更新

Then install the postfix package with the following command. Note that here we pass the DEBIAN_PRIORITY=low environmental variable into this installation command. This will cause the installation process to prompt you to configure some additional options:

然后使用以下命令安装postfix软件包。 请注意,这里我们将DEBIAN_PRIORITY=low环境变量传递到此安装命令中。 这将导致安装过程提示您配置一些其他选项:

  • sudo DEBIAN_PRIORITY=low apt install postfix

    sudo DEBIAN_PRIORITY =安装后缀低

This installation process will open a series of interactive prompts. For the purposes of this tutorial, use the following information to fill in your prompts:

此安装过程将打开一系列交互式提示。 就本教程而言,请使用以下信息填写提示:

  • General type of mail configuration?: For this, choose Internet Site since this matches our infrastructure needs.

    一般邮件配置类型? :为此,请选择Internet Site,因为这可以满足我们的基础架构需求。

  • System mail name: This is the base domain used to construct a valid email address when only the account portion of the address is given. For instance, let’s say the hostname of your server is mail.example.com. You will likely want to set the system mail name to example.com so that, given the username user1, Postfix will use the address user1@example.com.

    系统邮件名 :当仅提供地址的帐户部分时,这是用于构造有效电子邮件地址的基本域。 例如,假设您的服务器的主机名是mail. example.com mail. example.com 。 您可能希望将系统邮件名称设置为example.com以便在给定用户名user1 ,Postfix将使用地址user1@ example.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值