Index: openacs-4/packages/acs-core-docs/www/install-qmail.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/install-qmail.html,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-core-docs/www/install-qmail.html 24 Jun 2003 03:58:11 -0000 1.1 +++ openacs-4/packages/acs-core-docs/www/install-qmail.html 28 Jun 2003 05:07:01 -0000 1.2 @@ -1,6 +1,6 @@ -Install qmail (OPTIONAL)

Install qmail (OPTIONAL)

Qmail is a Mail Transfer Agent. It handles incoming and outgoing mail. Install qmail if you want your OpenACS server to send and receive mail, and you don't want to use an alternate MTA.

  1. Install ucspi.�This program handles incoming tcp connections. - Download ucspi and install it.

    [root@yourserver root]# cd /usr/local/src
    +Install qmail (OPTIONAL)

    Install qmail (OPTIONAL)

    Qmail is a Mail Transfer Agent. It handles incoming and outgoing mail. Install qmail if you want your OpenACS server to send and receive mail, and you don't want to use an alternate MTA.

    1. Install ucspi.�This program handles incoming tcp connections. + Download ucspi and install it.

      Red Hat 9.0: put

      #include <errno.h>

      as the first line of error.h. More information)

      [root@yourserver root]# cd /usr/local/src
       [root@yourserver src]# tar xzf /tmp/ucspi-tcp-0.88.tar.gz
       [root@yourserver src]# cd ucspi-tcp-0.88
       [root@yourserver ucspi-tcp-0.88]# make
      @@ -22,7 +22,7 @@
       tcpserver: usage: tcpserver [ -1UXpPhHrRoOdDqQv ] [ -c limit ] [ -x rules.cdb ] [ -B banner ] [ -g gid ] [ -u uid
       ] [ -b backlog ] [ -l localname ] [ -t timeout ] host port program
       [root@yourserver ucspi-tcp-0.88]#
      -

      +

    (I'm not sure if this next step is 100% necessary, but when I skip it I get problems. If you get the error 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1) then you need to do this.) AOLServer sends outgoing mail via the ns_sendmail command, which pipes a command to the sendmail executable. Or, in our @@ -33,11 +33,16 @@ Unless this mail is addressed to the same machine, qmail thinks that it's an attempt to relay mail, and rejects it. So these two commands set up an exception so that any mail sent from 127.0.0.1 is allowed to -send outgoing mail.

    [root@yourserver ucspi-tcp-0.88]# cp /tmp/openacs-5.0.0/packages/acs-core-docs/www/files/tcp.smtp.txt /etc/tcp.smtp
    +send outgoing mail.

    [root@yourserver ucspi-tcp-0.88]# cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/tcp.smtp.txt /etc/tcp.smtp
     [root@yourserver ucspi-tcp-0.88]# tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
    -
    cp /tmp/openacs-5.0.0/packages/acs-core-docs/www/files/tcp.smtp.txt /etc/tcp.smtp 
    -tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp 
  2. Install Qmail.�

    Download qmail, - set up the standard supporting users and build the binaries:

    (If you are using Red Hat 9.0, you need to put #include <errno.h> as the first line of /usr/local/src/qmail-1.03/error.h. More information)

    [root@yourserver root]# cd /usr/local/src
    +
    cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/tcp.smtp.txt /etc/tcp.smtp 
    +tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp 
  3. Install Qmail.�

    Download qmail, + set up the standard supporting users and build the binaries:

    Red Hat 9.0: Put +

    #include <errno.h>

    +as the first line of + /usr/local/src/qmail-1.03/error.h. + More + information

    [root@yourserver root]# cd /usr/local/src
     [root@yourserver src]# tar xzf /tmp/qmail-1.03.tar.gz
     [root@yourserver src]# mkdir /var/qmail
     [root@yourserver src]# groupadd nofiles
    @@ -70,10 +75,10 @@
     useradd -g qmail -d /var/qmail qmailr 
     useradd -g qmail -d /var/qmail qmails
     cd qmail-1.03 
    -make setup check

    Replace sendmail with qmail's wrapper.

    [root@yourserver qmail-1.03]# rm -f /usr/bin/sendmail
    +make setup check

    Replace sendmail with qmail's wrapper.

    [root@yourserver qmail-1.03]# rm -f /usr/bin/sendmail /usr/sbin/sendmail
     [root@yourserver qmail-1.03]# ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
     [root@yourserver qmail-1.03]#
    -
    rm -f /usr/bin/sendmail 
    +
    rm -f /usr/bin/sendmail /usr/sbin/sendmail
     ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

    Configure qmail - specifically, run the config script to set up files in /var/qmail/control specifying the computer's identity and which addresses it should accept mail for. This command will automatically set up qmail correctly if you have correctly set a valid host nome. If not, you'll want to read /var/qmail/doc/INSTALL.ctl to find out how to configure qmail.

    [root@yourserver qmail-1.03]# ./config-fast yourserver.test
     Your fully qualified host name is yourserver.test.
     Putting yourserver.test into control/me...
    @@ -92,61 +97,58 @@
     
    cd ~alias; touch .qmail-postmaster .qmail-mailer-daemon .qmail-root 
     chmod 644 ~alias/.qmail* 
     /var/qmail/bin/maildirmake ~alias/Maildir/ 
    -chown -R alias.nofiles /var/qmail/alias/Maildir

    Configure qmail to use the Maildir delivery format +chown -R alias.nofiles /var/qmail/alias/Maildir

    Configure qmail to use the Maildir delivery format (instead of mbox), and install a version of the qmail startup script modified to use Maildir.

    [root@yourserver alias]# echo "./Maildir" > /var/qmail/bin/.qmail
    -[root@yourserver alias]# cp /tmp/openacs-5.0.0/packages/acs-core-docs/www/files/qmail.rc.txt /var/qmail/rc
    +[root@yourserver alias]# cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail.rc.txt /var/qmail/rc
     [root@yourserver alias]# chmod 755 /var/qmail/rc
     [root@yourserver alias]# 
     
    echo "./Maildir" > /var/qmail/bin/.qmail 
    -cp /tmp/openacs-5.0.0/packages/acs-core-docs/www/files/qmail.rc.txt /var/qmail/rc 
    +cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail.rc.txt /var/qmail/rc 
     chmod 755 /var/qmail/rc 
     

    Set up the skeleton directory so that new users will - be configured for qmail.

    [root@localhost root]# /var/qmail/bin/maildirmake /etc/skel/Maildir
    -[root@localhost root]# echo "./Maildir/" > /etc/skel/.qmail
    -[root@localhost root]# 
    +          be configured for qmail.

    [root@yourserver root]# /var/qmail/bin/maildirmake /etc/skel/Maildir
    +[root@yourserver root]# echo "./Maildir/" > /etc/skel/.qmail
    +[root@yourserver root]# 
     
    /var/qmail/bin/maildirmake /etc/skel/Maildir
    -echo "./Maildir/" > /etc/skel/.qmail

    Qmail runs in two parts. First, several different - qmail daemons are started by the qmail rc file. Second, a - process is started in within tcpserver to listen for incoming smtp traffic. Run both of these commands to start qmail. Be very careful about line breaks - there should be a total of two commands here. Note also that the tcpserver command takes the uid and guid of qmaild, which will only be 502 and 501 if you have followed all of these instructions exactly and in order. Otherwise, grep qmaild /etc/passwd to find uid and guid, in that order.

    [root@yourserver alias]# /usr/local/bin/tcpserver -x /etc/tcp.smtp.cdb -v -u 502 -g 501 0 smtp /var/qmail/bin/qmail-smtpd 2>&1 | /var/qmail/bin/splogger smtpd 3 &
    -[1] 15863
    -[root@yourserver alias]# csh -cf '/var/qmail/rc &'
    -[1] 15865
    -[root@yourserver alias]#
    -
    /usr/local/bin/tcpserver -x /etc/tcp.smtp.cdb -v -u 502 -g 501 0 smtp /var/qmail/bin/qmail-smtpd 2>&1 | /var/qmail/bin/splogger smtpd 3 & 
    -csh -cf '/var/qmail/rc &'

    Verify that seven different qmail threads are running:

    [root@yourserver alias]# ps -auxw | grep
    -          qmail
    -qmaild    4269  0.0  0.3  1384  452 pts/0    S    21:21   0:00 [tcpserver]
    -root      4270  0.0  0.3  1340  412 pts/0    S    21:21   0:00 /var/qmail/bin/splogger smtpd 3
    -qmails    4272  0.1  0.2  1364  320 pts/0    S    21:21   0:00 [qmail-send]
    -qmaill    4273  0.0  0.3  1332  408 pts/0    S    21:21   0:00 [splogger]
    -root      4274  0.0  0.2  1332  272 pts/0    S    21:21   0:00 qmail-lspawn ./Maildir/
    -qmailr    4275  0.0  0.2  1328  272 pts/0    S    21:21   0:00 [qmail-rspawn]
    -qmailq    4276  0.0  0.2  1324  280 pts/0    S    21:21   0:00 [qmail-clean]
    -root      4278  0.0  0.5  3280  632 pts/0    S    21:21   0:00 grep qmail
    -[root@yourserver alias]#

    Further verify by sending and receiving email. Incoming mail for root is stored in /var/qmail/alias/Maildir. If it worked, make it permanent by putting the same commands in your startup scripts. (These instructions put the commands in rc.local, which means that they'll be run once, on boot. There will be no monitoring and no interface to start and stop and check status. We ought instead to either use full init scripts or daemontools.)

    [root@yourserver alias]# echo "/usr/local/bin/tcpserver -x /etc/tcp.smtp.cdb -v -u 502 -g 501 0 smtp /var/qmail/bin/qmail-smtpd \ " >> /etc/rc.local
    -[root@yourserver alias]# echo "2>&1 | /var/qmail/bin/splogger smtpd 3 &  " >> /etc/rc.local
    -[root@yourserver alias]# echo "csh -cf '/var/qmail/rc &' " >> /etc/rc.local
    -[root@yourserver alias]# 
    -
    echo "/usr/local/bin/tcpserver -x /etc/tcp.smtp.cdb -v -u 502 -g 501 0 smtp /var/qmail/bin/qmail-smtpd \ " >> /etc/rc.local
    -echo "2>&1 | /var/qmail/bin/splogger smtpd 3 &  " >> /etc/rc.local
    -echo "csh -cf '/var/qmail/rc &' " >> /etc/rc.local
  4. Analog web file analyser. You should -have the source tarball in -/tmp. Unpack, compile, and install analog.

    [root@yourserver aolserver]# cd /usr/local/src
    -[root@yourserver src]# tar xzf /tmp/analog-5.31.tar.gz
    -[root@yourserver src]# cd analog-5.31
    -[root@yourserver analog-5.31]# make
    -cd src && make
    -make[1]: Entering directory `/usr/local/src/analog-5.31/src'
    -(many lines omitted)
    -***IMPORTANT: You must read the licence before using analog
    -***
    -make[1]: Leaving directory `/usr/local/src/analog-5.31/src'
    -[root@yourserver analog-5.31]# cd ..
    -[root@yourserver src]# mv analog-5.31 /usr/share/
    -[root@yourserver src]#
    -
    cd /usr/local/src
    -tar xzf /tmp/analog-5.31.tar.gz
    -cd analog-5.31
    -make
    -cd ..
    -mv analog-5.31 /usr/share/

    See also the section called “Set up Log Analysis Reports - OPTIONAL”

View comments on this page at openacs.org
+echo "./Maildir/" > /etc/skel/.qmail

As recommended, we will run qmail with daemontools + control files. Create daemontools control directories, set up a daemontools control script, copy the supervise control files, and set permissions. The last line links the control directories to /service, which will cause supervise to detect them and execute the run files, causing qmail to start.

[root@yourserver root]# mkdir -p /var/qmail/supervise/qmail-send/log
+[root@yourserver root]# mkdir -p /var/qmail/supervise/qmail-smtpd/log
+[root@yourserver root]# mkdir /var/log/qmail
+[root@yourserver root]# chown qmaill /var/log/qmail
+[root@yourserver root]# cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmailctl.txt /var/qmail/bin/qmailctl
+[root@yourserver root]# chmod 755 /var/qmail/bin/qmailctl
+[root@yourserver root]# ln -s /var/qmail/bin/qmailctl /usr/bin
+[root@yourserver root]# cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail-send-run.txt /var/qmail/supervise/qmail-send/run 
+[root@yourserver root]# cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail-send-log-run.txt /var/qmail/supervise/qmail-send/log/run
+[root@yourserver root]# cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail-smtpd-run.txt /var/qmail/supervise/qmail-smtpd/run
+[root@yourserver root]# cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail-smtpd-log-run.txt /var/qmail/supervise/qmail-smtpd/log/run
+[root@yourserver root]# chmod 755 /var/qmail/supervise/qmail-send/run
+[root@yourserver root]# chmod 755 /var/qmail/supervise/qmail-send/log/run
+[root@yourserver root]# chmod 755 /var/qmail/supervise/qmail-smtpd/run
+[root@yourserver root]# chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
+[root@yourserver root]# ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service
+[root@yourserver root]# ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service
+
mkdir -p /var/qmail/supervise/qmail-send/log
+mkdir -p /var/qmail/supervise/qmail-smtpd/log
+mkdir /var/log/qmail
+chown qmaill /var/log/qmail
+cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmailctl.txt /var/qmail/bin/qmailctl
+chmod 755 /var/qmail/bin/qmailctl
+ln -s /var/qmail/bin/qmailctl /usr/bin
+cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail-send-run.txt /var/qmail/supervise/qmail-send/run
+cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail-send-log-run.txt /var/qmail/supervise/qmail-send/log/run
+cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail-smtpd-run.txt /var/qmail/supervise/qmail-smtpd/run
+cp /tmp/openacs-4.7.0d/packages/acs-core-docs/www/files/qmail-smtpd-log-run.txt /var/qmail/supervise/qmail-smtpd/log/run
+chmod 755 /var/qmail/supervise/qmail-send/run
+chmod 755 /var/qmail/supervise/qmail-send/log/run
+chmod 755 /var/qmail/supervise/qmail-smtpd/run
+chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
+ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service
+

Wait ten seconds or so, and then verify that that the four qmail processes are running. If uptimes are 1 second, this may indicate broken scripts that are continuously restarting. In that case, start debugging by checking permissions.

[root@yourserver root]# qmailctl stat
+/service/qmail-send: up (pid 32700) 430 seconds
+/service/qmail-send/log: up (pid 32701) 430 seconds
+/service/qmail-smtpd: up (pid 32704) 430 seconds
+/service/qmail-smtpd/log: up (pid 32705) 430 seconds
+messages in queue: 0
+messages in queue but not yet preprocessed: 0
+[root@yourserver root]#

Further verify by sending and receiving email. Incoming mail for root is stored in /var/qmail/alias/Maildir.

View comments on this page at openacs.org