使用 alternatives to Switch MTA

tonykorn97發表於2008-10-21

Overview of the alternatives system
displays or configures the preferred MTA and associated man pages based on a generic name
generic name is a link to a link in /etc/alternatives/
only the links in /etc/alternatives/ are modified

[@more@]

Switch between MTA's
stop the current MTA and disable boot-time startup
alternatives --config mta and make a selection
start the new MTA and enable boot-time startup

Graphical interface: system-switch-mail-gnome package


顯示當前使用的MTA
[root@station10 ~]# alternatives --display mta
mta - status is auto.
link currently points to /usr/sbin/sendmail.sendmail
/usr/sbin/sendmail.sendmail - priority 90
slave mta-mailq: /usr/bin/mailq.sendmail
slave mta-newaliases: /usr/bin/newaliases.sendmail
slave mta-rmail: /usr/bin/rmail.sendmail
slave mta-sendmail: /usr/lib/sendmail.sendmail
slave mta-pam: /etc/pam.d/smtp.sendmail
slave mta-sendmailman: /usr/share/man/man8/sendmail.sendmail.8.gz
slave mta-mailqman: /usr/share/man/man1/mailq.sendmail.1.gz
slave mta-newaliasesman: /usr/share/man/man1/newaliases.sendmail.1.gz
slave mta-aliasesman: /usr/share/man/man5/aliases.sendmail.5.gz
Current `best' version is /usr/sbin/sendmail.sendmail.
[root@station10 ~]#

當前只安裝了sendmail,所以當前的mta是sendmail,安裝postfix後繼續檢視

[root@station10 ~]# yum install -y postfix

繼續檢視當前使用的MTA:
[root@station10 ~]# alternatives --display mta
mta - status is auto.
link currently points to /usr/sbin/sendmail.sendmail
/usr/sbin/sendmail.sendmail - priority 90
slave mta-pam: /etc/pam.d/smtp.sendmail
slave mta-mailq: /usr/bin/mailq.sendmail
slave mta-newaliases: /usr/bin/newaliases.sendmail
slave mta-rmail: /usr/bin/rmail.sendmail
slave mta-sendmail: /usr/lib/sendmail.sendmail
slave mta-mailqman: /usr/share/man/man1/mailq.sendmail.1.gz
slave mta-newaliasesman: /usr/share/man/man1/newaliases.sendmail.1.gz
slave mta-aliasesman: /usr/share/man/man5/aliases.sendmail.5.gz
slave mta-sendmailman: /usr/share/man/man8/sendmail.sendmail.8.gz
/usr/sbin/sendmail.postfix - priority 30
slave mta-pam: /etc/pam.d/smtp.postfix
slave mta-mailq: /usr/bin/mailq.postfix
slave mta-newaliases: /usr/bin/newaliases.postfix
slave mta-rmail: /usr/bin/rmail.postfix
slave mta-sendmail: /usr/lib/sendmail.postfix
slave mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
slave mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
slave mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
slave mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
Current `best' version is /usr/sbin/sendmail.sendmail.
[root@station10 ~]#


具體切換步驟:
1,停止當前使用的mta
[root@station10 ~]# /etc/init.d/sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
[root@station10 ~]#

2,設定系統啟動的時候不啟動:
[root@station10 ~]# chkconfig sendmail off

3,配置mta
[root@station10 ~]# alternatives --config mta

There are 2 programs which provide 'mta'.

Selection Command
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.sendmail
2 /usr/sbin/sendmail.postfix

Enter to keep the current selection[+], or type selection number: 2
[root@station10 ~]#


或者:
alternatives --set mta /usr/sbin/sendmail.postfix


圖形切換工具:system-switch-mail

4,啟動另外一個mta
[root@station10 ~]# service postfix status
master is stopped
[root@station10 ~]# service postfix start
Starting postfix: [ OK ]
[root@station10 ~]#

5,配置啟動系統的時候預設啟動服務
[root@station10 ~]# chkconfig postfix on


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-1012210/,如需轉載,請註明出處,否則將追究法律責任。

相關文章