Switching Rhel5 MTA

Posted by alex almazan Fri, 02 May 2008 20:22:00 GMT

Rhel alternatives script

Rhel5 as with Enterprise 3 and 4 comes with a scripted mechanism for establishing some very important symbolic links in the system. This functionality permits you to transtion your system into using the MTA of your choice. The scripted utility is called ‘alternatives’

Notes on the utilities usage:

alternatives—display mta
[root@station13 RHEL5RPMS]# 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
lave 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.

The output reveals that this system is set for Sendmail usage. Take note of the listed item ‘link currently points to /usr/sbin/sendmail.sendmail’ Redhat is equipped with two versions of ‘sendmail’ for use, the file(s) /usr/sbin/sendmail.postfix and /usr/sbin/sendmail.sendmail. The script alternatives switches the system links to permit the use of either MTA.

Swap system MTA to Postfix via alternatives—config mta

[root@station13 RHEL5RPMS]# alternatives --config mta
  Selection    Command
-----------------------------------------------
*+ 1           /usr/sbin/sendmail.sendmail
   2           /usr/sbin/sendmail.postfix

Select the number presented to change the MTA in use. Complete all the dialog on the screen and the alternatives script does all the heavy lifiting.

(Once this is performed, it is important to review the startup scripts to ensure the appropriate MTA starts at server boot time.

[root@station13 ]# chkconfig --list |egrep 'sendmail|postfix'
sendmail        0:off   1:off   2:on    3:on    4:on    5:on    6:off
postfix         0:off   1:off   2:on    3:off    4:off    5:off    6:off
Change this to ‘Postfix’ with
[root@station13 ]#chkconfig --level 345 sendmail off
[root@station13 ]#chkconfig --level 345 postfix on
Recheck the preferred MTA
[root@station13 ]# chkconfig --list |egrep 'sendmail|postfix'
sendmail       0:off   1:off   2:on    3:off    4:off    5:off    6:off
postfix         0:off   1:off   2:on    3:on    4:on    5:on    6:off

notice the change once sendmail/postfix is changed. It is imperative that these be reviewed if you are transitioning the MTA with ‘alternatives