Installing Sendmail on Solaris


  1. Download sendmail from http://www.sendmail.org

  2. Extract the downloaded file into a temporary directory.

  3. Check your version of sendmail (/usr/lib/sendmail -d0)

  4. Check your system's resolver configuration (more /etc/resolv.conf). The pattern of the resolver configuration should be as shown below.

    
    domain xyz.com
    nameserver 123.456.1.1
    nameserver 123.456.1.2
    
    
  5. Sendmail version 8.9+ prohibits (by default) group write access to mail directories and all .forward files plus their parent user home directories. A .forward file will forward email to a specific user onto addresses specified in the user's .forward file. Execute the commands as shown below.

    
    chmod g-w / /etc /etc/mail /etc/mail/aliases /home /usr /var /var/spool /var/spool/mqueue
    chown root / /etc /etc/mail /etc/mail/aliases /home /usr /var /var/spool /var/spool/mqueue
    
    

    Also check the individual user mail directories.

    chmod 660 /var/mail/<username>
    chown <username> /var/mail/<username>
    chgrp mail /var/mail/<username>
    
  6. Make copies of the /usr/lib/sendmail executable and the /etc/mail/sendmail.cf configuration files.

  7. Alter the sendmail.cf configuration file in the sendmail-8.11.4/cf/cf directory. Edit the sendmail.mc and not the sendmail.cf file. The sendmail.cf file is a compiled form of the sendmail.mc file. I edited as shown below. Two sendmail configurations are shown below. The first will not returns errors on sending mail to servers which are unforgiving of email messages cointaining email addresses with UNIX box hostnames in them.

    
    divert(0)dnl
    VERSIONID(`$Id: generic-solaris2.mc,v 8.11 1999/02/07 07:26:03 gshapiro Exp $')
    OSTYPE(solaris2)dnl
    DOMAIN(generic)dnl
    MAILER(local)dnl
    MAILER(smtp)dnl
    define(`confCW_FILE', `/etc/mail/sendmail.cw')dnl
    MASQUERADE_AS(xyz.com)dnl
    MASQUERADE_DOMAIN(xyz.com)dnl
    
    divert(0)dnl
    VERSIONID(`$Id: generic-solaris2.mc,v 8.11 1999/02/07 07:26:03 gshapiro Exp $')
    OSTYPE(solaris2)dnl
    DOMAIN(xyz.com)dnl
    MAILER(local)dnl
    MAILER(smtp)dnl
    define(`confCW_FILE', `/etc/mail/sendmail.cw')dnl
    MASQUERADE_AS(xyz.com)dnl
    MASQUERADE_DOMAIN(xyz.com)dnl
    FEATURE(`masquerade_envelope')dnl
    
    

    Note that there must be atleast an empty /etc/mail/sendmail.cw file present. The sendmail.cw file holds hostnames local to the current host.


  8. Execute ./Build sendmail.cf in the sendmail-8.11.4/cf/cf directory to compile from the sendmail.mc file to the sendmail.cf file. Note that the path may have to be set correctly for root (/bin/sh; PATH=/bin:/usr/bin:/usr/ucb:/etc:/usr/local/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/sbin:/usr/X/bin;export PATH ). Execute /bin/sh first if this does not work properly. Check the setting of the PATH variable by running echo $PATH. Once the sendmail.cf file is built copy sendmail-8.11.4/cf/cf/sendmail.cf to the /etc/mail directory.

  9. Now stop the currently running sendmail daemon (/etc/init.d/sendmail stop). You could also check for the existence of startup (/etc/rc2.d) and shutdown (/etc/rc0.d) links or script copies in the shutdown and startup directories.

  10. To build the sendmail binary executable file run ./Build sendmail in the sendmail.8.11.4 directory.

  11. To install the sendmail binary execute ./Build install.

  12. Rebuild the alias database by executing /usr/lib/sendmail -bi.

  13. Restart the sendmail daemon with the newly installed binary by executing /etc/init.d/sendmail start.

  14. Examine entries in the /var/log/syslog file to check for any errors.