六月丁香五月婷婷,丁香五月婷婷网,欧美激情网站,日本护士xxxx,禁止18岁天天操夜夜操,18岁禁止1000免费,国产福利无码一区色费

學習啦 > 學習電腦 > 操作系統(tǒng) > Linux教程 > Linux怎么安裝配置Postfix

Linux怎么安裝配置Postfix

時間: 春健736 分享

Linux怎么安裝配置Postfix

  Postfix是一款用法靈活的電子郵件應用程序,那么大家知道Linux怎么安裝配置Postfix嗎?今天學習啦小編與大家分享下Linux安裝配置Postfix的具體操作步驟,有需要的朋友不妨了解下。

  Linux安裝配置Postfix方法

  postfix的產(chǎn)生是為了替代傳統(tǒng)的sendmail.相較于sendmail,postfix在速度,性能和穩(wěn)定性上都更勝一籌。現(xiàn)在目前非常多的主流郵件服務其實都在采用postfix. 當我們需要一個輕量級的的郵件服務器是,postfix不失為一種選擇。

  1. postfix是免費的:

  postfix想要作用的范圍是廣大的Internet用戶,試圖影響大多數(shù)的Internet上的電子郵件系統(tǒng),因此它是免費的。

  2. 更快:

  postfix在性能上大約比sendmail快三倍。一部運行postfix的臺式PC每天可以收發(fā)上百萬封郵件。

  3. 兼容性好:

  postfix是sendmail兼容的,從而使sendmail用戶可以很方便地遷移到postfix。Postfix支持/var[/spool]/mail、/etc/aliases、 NIS、和 ~/.forward 文件。

  4. 更健壯:

  postfix被設計成在重負荷之下仍然可以正常工作。當系統(tǒng)運行超出了可用的內(nèi)存或磁盤空間時,postfix會自動減少運行進程的數(shù)目。當處理的郵件數(shù)目增長時,postfix運行的進程不會跟著增加。

  5. 更靈活:

  postfix是由超過一打的小程序組成的,每個程序完成特定的功能。你可以

  通過配置文件設置每個程序的運行參數(shù)。

  6. 安全性

  postfix具有多層防御結(jié)構(gòu),可以有效地抵御惡意入侵者。如大多數(shù)的postfix程序可以運行在較低的權限之下,不可以通過網(wǎng)絡訪問安全性相關的本地投遞程序等等。

  下面來介紹linux上如何搭建和配置postfix服務:

  1.關掉sendmail相關的所有服務,最好是直接卸載sendmail.

  # service sendmail stop

  # chkconfig sendmail off

  #rpm -qa | grep sendmail | xargs rpm -e

  2.安裝postfix.

  redhat6.0以上版本應該是默認集成了postfix服務的,假如沒有安裝的話,可以手動安裝。

  rpm -qa | grep postifx (查看是否安裝)

  yum install postfix

  3.安裝完成后,修改配置文件:/etc/postfix/main.cfg

  vi /etc/postfix/main.cf

  myhostname = sample.test.com  ← 設置系統(tǒng)的主機名

  mydomain = test.com  ← 設置域名(我們將讓此處設置將成為E-mail地址“@”后面的部分)

  myorigin = $mydomain  ← 將發(fā)信地址“@”后面的部分設置為域名(非系統(tǒng)主機名)

  inet_interfaces = all  ← 接受來自所有網(wǎng)絡的請求

  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain  ← 指定發(fā)給本地郵件的域名

  home_mailbox = Maildir/  ← 指定用戶郵箱目錄

  <保存退出!>

  4.為本機添加DNS server.

  為什DNS Server?因為在郵件發(fā)送過程中,需要把郵件地址的domain地址轉(zhuǎn)化成IP地址,再去發(fā)送給對應的收件人,這里涉及到DNS中的A記錄和MX記錄相關的知識,不熟悉的同學可以google或者百度 腦補一下 :-)

  如何添加DNS server呢,DNS server去哪里尋找?

  vim /etc/resolv.conf

  添加如下行:

  nameserver 8.8.8.8

  nameserver 8.8.4.4

  上面用的8.8.8.8/8.8.4.4是Google Free DNS server,當然還有很多免費的DNS server供大家使用,可以google一下:-)

  5.測試一下郵件是否能夠發(fā)送成功:

  命令行輸入$: > echo "Mail Content" | mail -s "Mail Subject" xxxx@xxx.com

  Note:if you see below warings after you run above command.

  send-mail: warning: inet_protocols: IPv6 support is disabled: Address family not supported by protocol

  send-mail: warning: inet_protocols: configuring for IPv4 support only

  postdrop: warning: inet_protocols: IPv6 support is disabled: Address family not supported by protocol

  postdrop: warning: inet_protocols: configuring for IPv4 support only

  that means you don't have IPv6 configured in your OS's network stack, but your mailer (presumably postfix) is configured to use IPv6. Since there is no IPv6 for your mailer to use, it's warning you that it's only going to use IPv4.

  To disable the waring messsage, go to /etc/postfix/main.cf and change from:

  inet_protocols = all

  to:

  inet_protocols = ipv4

  This will only use ipv4 and the warning message will go away.

  You will have to issue a stop and start for postfix to register the change.

  service postfix restart

  6.查看log,確認郵件發(fā)送狀態(tài):

  Postfix郵件的log位置是:/var/log/maillog

  發(fā)送成功的話,會返回250和OK,也可以去自己的郵件客戶端查收。

  一切OK的話,那Postfix mail service應該就搭建成功了。

  另外一些有用的postfix維護命令,一遍日常的檢測和維護:

  mailq :會列出當前在postfix發(fā)送隊列中的所有郵件

  postsuper -d ALL:刪除當前等待發(fā)送隊列的所有郵件,包括發(fā)送失敗的退信

  當然還有很多,就不一一列舉了,大家可以網(wǎng)上搜索擴展,Good Luck!

  7.Update Mail From sender

  echo "do-not-reply@example.com root@example.com" >> /etc/postfix/generic

  echo "smtp_generic_maps = hash:/etc/postfix/generic" >>/etc/postfix/main.cf

  postmap /etc/postfix/generic

  service postfix restart

看過“Linux怎么安裝配置Postfix”的人還看了:

1.Linux如何安裝使用logwatch

2.linux操作系統(tǒng)安全設置

3.IT項目招標書模板

4.linux操作系統(tǒng)安全加固

5.lnmp下無法使用mail發(fā)郵件怎么辦

962317