日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
CentOS8中怎么配置Postfix郵件服務(wù)器

本篇文章給大家分享的是有關(guān)CentOS 8中怎么配置Postfix郵件服務(wù)器,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的中方網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

步驟 1)更新系統(tǒng)

第一步是確保系統(tǒng)軟件包是最新的。為此,請(qǐng)按如下所示更新系統(tǒng):

# dnf update

繼續(xù)之前,還請(qǐng)確保不存在其他 MTA(如 Sendmail),因?yàn)檫@將導(dǎo)致與 Postfix 配置沖突。例如,要?jiǎng)h除 Sendmail,請(qǐng)運(yùn)行以下命令:

# dnf remove sendmail

步驟 2)設(shè)置主機(jī)名并更新 /etc/hosts

使用下面的 hostnamectl 命令在系統(tǒng)上設(shè)置主機(jī)名:

# hostnamectl set-hostname server1.crazytechgeek.info# exec bash

此外,你需要在 /etc/hosts 中添加系統(tǒng)的主機(jī)名和 IP:

# vim /etc/hosts192.168.1.13   server1.crazytechgeek.info

保存并退出文件。

步驟 3)安裝 Postfix 郵件服務(wù)器

驗(yàn)證系統(tǒng)上沒有其他 MTA 在運(yùn)行后,運(yùn)行以下命令安裝 Postfix:

# dnf install postfix

CentOS 8中怎么配置Postfix郵件服務(wù)器

Install-Postfix-Centos8

步驟 4)啟動(dòng)并啟用 Postfix 服務(wù)

成功安裝 Postfix 后,運(yùn)行以下命令啟動(dòng)并啟用 Postfix 服務(wù):

# systemctl start postfix# systemctl enable postfix

要檢查 Postfix 狀態(tài),請(qǐng)運(yùn)行以下 systemctl 命令:

# systemctl status postfix

CentOS 8中怎么配置Postfix郵件服務(wù)器

Start-Postfix-check-status-centos8

太好了,我們已經(jīng)驗(yàn)證了 Postfix 已啟動(dòng)并正在運(yùn)行。接下來,我們將配置 Postfix 從本地發(fā)送郵件到我們的服務(wù)器。

步驟 5)安裝 mailx 郵件客戶端

在配置 Postfix 服務(wù)器之前,我們需要安裝 mailx,要安裝它,請(qǐng)運(yùn)行以下命令:

# dnf install mailx

CentOS 8中怎么配置Postfix郵件服務(wù)器

Install-Mailx-CentOS8

步驟 6)配置 Postfix 郵件服務(wù)器

Postfix 的配置文件位于 /etc/postfix/main.cf 中。我們需要對(duì)配置文件進(jìn)行一些修改,因此請(qǐng)使用你喜歡的文本編輯器將其打開:

# vi /etc/postfix/main.cf

更改以下幾行:

myhostname = server1.crazytechgeek.infomydomain = crazytechgeek.infomyorigin = $mydomain## 取消注釋并將 inet_interfaces 設(shè)置為 all##inet_interfaces = all## 更改為 all ##inet_protocols = all## 注釋 ###mydestination = $myhostname, localhost.$mydomain, localhost## 取消注釋 ##mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain## 取消注釋并添加 IP 范圍 ##mynetworks = 192.168.1.0/24, 127.0.0.0/8## 取消注釋 ##home_mailbox = Maildir/

完成后,保存并退出配置文件。重新啟動(dòng) postfix 服務(wù)以使更改生效:

# systemctl restart postfix

步驟 7)測(cè)試 Postfix 郵件服務(wù)器

測(cè)試我們的配置是否有效,首先,創(chuàng)建一個(gè)測(cè)試用戶。

# useradd postfixuser# passwd postfixuser

接下來,運(yùn)行以下命令,從本地用戶 pkumar 發(fā)送郵件到另一個(gè)用戶 postfixuser

# telnet localhost smtp或者# telnet localhost 25

如果未安裝 telnet 服務(wù),那么可以使用以下命令進(jìn)行安裝:

# dnf install telnet -y

如前所述運(yùn)行命令時(shí),應(yīng)獲得如下輸出:

[root@linuxtechi ~]# telnet localhost 25Trying 127.0.0.1...Connected to localhost.Escape character is '^]'.220 server1.crazytechgeek.info ESMTP Postfix

上面的結(jié)果確認(rèn)與 postfix 郵件服務(wù)器的連接正常。接下來,輸入命令:

# ehlo localhost

輸出看上去像這樣:

250-server1.crazytechgeek.info250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN250-STARTTLS250-ENHANCEDSTATUSCODES250-8BITMIME250-DSN250 SMTPUTF8

接下來,運(yùn)行橙色高亮的命令,例如 mail fromrcpt to、data,最后輸入 quit

mail from:250 2.1.0 Okrcpt to:250 2.1.5 Okdata354 End data with .Hello, Welcome to my mailserver (Postfix).250 2.0.0 Ok: queued as B56BF1189BECquit221 2.0.0 ByeConnection closed by foreign host

完成 telnet 命令可從本地用戶 pkumar 發(fā)送郵件到另一個(gè)本地用戶 postfixuser,如下所示:

CentOS 8中怎么配置Postfix郵件服務(wù)器

Send-email-with-telnet-centos8

如果一切都按計(jì)劃進(jìn)行,那么你應(yīng)該可以在新用戶的家目錄中查看發(fā)送的郵件:

# ls /home/postfixuser/Maildir/new1573580091.Vfd02I20050b8M635437.server1.crazytechgeek.info#

要閱讀郵件,只需使用 cat 命令,如下所示:

# cat /home/postfixuser/Maildir/new/1573580091.Vfd02I20050b8M635437.server1.crazytechgeek.info

CentOS 8中怎么配置Postfix郵件服務(wù)器

Read-postfix-email-linux

Postfix 郵件服務(wù)器日志

Postfix 郵件服務(wù)器郵件日志保存在文件 /var/log/maillog 中,使用以下命令查看實(shí)時(shí)日志,

# tail -f /var/log/maillog

CentOS 8中怎么配置Postfix郵件服務(wù)器

postfix-maillogs-centos8

保護(hù) Postfix 郵件服務(wù)器

建議始終確??蛻舳撕?Postfix 服務(wù)器之間的通信安全,這可以使用 SSL 證書來實(shí)現(xiàn),它們可以來自受信任的權(quán)威機(jī)構(gòu)或自簽名證書。在本教程中,我們將使用 openssl 命令生成用于 Postfix 的自簽名證書,

我假設(shè) openssl 已經(jīng)安裝在你的系統(tǒng)上,如果未安裝,請(qǐng)使用以下 dnf 命令:

# dnf install openssl -y

使用下面的 openssl 命令生成私鑰和 CSR(證書簽名請(qǐng)求):

# openssl req -nodes -newkey rsa:2048 -keyout mail.key -out mail.csr

CentOS 8中怎么配置Postfix郵件服務(wù)器

Postfix-Key-CSR-CentOS8

現(xiàn)在,使用以下 openssl 命令生成自簽名證書:

# openssl x509 -req -days 365 -in mail.csr -signkey mail.key -out mail.crtSignature oksubject=C = IN, ST = New Delhi, L = New Delhi, O = IT, OU = IT, CN = server1.crazytechgeek.info, emailAddress = root@linuxtechiGetting Private key#

現(xiàn)在將私鑰和證書文件復(fù)制到 /etc/postfix 目錄下:

# cp mail.key mail.crt /etc/postfix

在 Postfix 配置文件中更新私鑰和證書文件的路徑:

# vi /etc/postfix/main.cf………smtpd_use_tls = yessmtpd_tls_cert_file = /etc/postfix/mail.crtsmtpd_tls_key_file = /etc/postfix/mail.keysmtpd_tls_security_level = may………

重啟 Postfix 服務(wù)以使上述更改生效:

# systemctl restart postfix

讓我們嘗試使用 mailx 客戶端將郵件發(fā)送到內(nèi)部本地域和外部域。

從 pkumar 發(fā)送內(nèi)部本地郵件到 postfixuser 中:

# echo "test email" | mailx -s "Test email from Postfix MailServer" -r root@linuxtechi root@linuxtechi

使用以下命令檢查并閱讀郵件:

# cd /home/postfixuser/Maildir/new/# lltotal 8-rw-------. 1 postfixuser postfixuser 476 Nov 12 17:34 1573580091.Vfd02I20050b8M635437.server1.crazytechgeek.info-rw-------. 1 postfixuser postfixuser 612 Nov 13 02:40 1573612845.Vfd02I20050bbM466643.server1.crazytechgeek.info# cat 1573612845.Vfd02I20050bbM466643.server1.crazytechgeek.info

CentOS 8中怎么配置Postfix郵件服務(wù)器

Read-Postfixuser-Email-CentOS8

從 postfixuser 發(fā)送郵件到外部域(root@linuxtechi.com):

# echo "External Test email" | mailx -s "Postfix MailServer" -r root@linuxtechi root@linuxtechi

注意:如果你的 IP 沒有被任何地方列入黑名單,那么你發(fā)送到外部域的郵件將被發(fā)送,否則它將被退回,并提示你的 IP 被 spamhaus 之類的數(shù)據(jù)庫(kù)列入黑名單。

檢查 Postfix 郵件隊(duì)列

使用 mailq 命令列出隊(duì)列中的郵件:

# mailqMail queue is empty#

以上就是CentOS 8中怎么配置Postfix郵件服務(wù)器,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。


文章標(biāo)題:CentOS8中怎么配置Postfix郵件服務(wù)器
當(dāng)前URL:http://www.dlmjj.cn/article/jjpspo.html