在Ubuntu 20.04 LTS Focal Fossa上安装Postfix
步骤1.首先,通过apt
在终端中运行以下命令来确保所有系统软件包都是最新的。
sudo apt update
sudo apt upgrade
步骤2.在Ubuntu 20.04上安装Postfix。
现在,我们通过运行以下命令继续安装Postfix:
sudo apt install postfix sasl2-bin
现在,将提示您选择邮件服务器配置的类型。选择继续,从该列表中选择[无配置],然后按Enter键,如下图突出显示:
+------+ Postfix Configuration +-------+ | General type of mail configuration: | | | | No configuration | | Internet Site | | Internet with smarthost | | Satellite system | | Local only | | | | | | <Ok> <Cancel> | | | +--------------------------------------+
步骤3.配置Postfix。
成功安装后,现在我们编辑Postfix配置文件:
cp /usr/share/postfix/main.cf.dist /etc/postfix/main.cf nano /etc/postfix/main.cf
添加以下行:
Add the following lines:
mail_owner = postfix
myhostname = mail.yundongfang.com
mydomain = yundongfang.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
local_recipient_maps = unix:passwd.byname $alias_maps
mynetworks_style = subnet
mynetworks = 127.0.0.0/8,10.0.0.0/24
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
sendmail_path = /usr/sbin/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
readme_directory =
inet_protocols = ipv4
# for example, limit an email size to 10Mmessage_size_limit = 10485760# for example, limit mailbox size to 1Gmailbox_size_limit = 1073741824# SMTP-Auth settings smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous smtpd_sasl_local_domain = $myhostname smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject
保存文件并关闭它。要应用更改,请输入命令:
newaliases
sudo systemctl restart postfix
恭喜你!您已经成功安装了Postfix。感谢您使用本教程在Ubuntu 20.04 LTS Focal Fossa系统上安装Postfix。如需其他帮助或有用信息,建议您访问Postfix官方网站。
原创文章,作者:校长,如若转载,请注明出处:https://www.yundongfang.com/Yun40164.html