The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

installing qmail --- by rtroy@springsips.com 29 November 1999
Share
Need more help on this topic? Click here
This article has 1 comment
Show me similar articles
This article was written by Ryan Troy rtroy@springsips.com.   Thanks Ryan.

Removing Sendmail
Compiling Qmail from the ports collection
Installing qpopper
Making pine use ./Maildir format

Another reference for qmail is at http://www.flounder.net/qmail/.

OK, we need to turn off sendmail before installing qmail, we are going to edit the rc.conf file.  Below is an example.
# vi /etc/rc.conf

Now we are in the rc.conf file, search for sendmail you will see something similar to this.

sendmail_enable="YES" # Run the sendmail daemon (or NO).
sendmail_flags="-bd -q30m" # Flags to sendmail (if enabled)

We want to change YES to NO

Save the file and exit.

To remove sendmail from the sytem we will do this.  Note the binary may be at a different location on your machine. [ed: This doesn't actually remove the files, it makes them non-executable, non-readble, non-writeable].

chmod 0 /usr/lib/sendmail
chmod 0 /usr/sbin/sendmail
chmod 0 /usr/lib/sendmail.mx

Move the sendmail binary out of the way.  Again this may vary from system to system:

mv /usr/lib/sendmail /usr/lib/sendmail.bak
mv /usr/sbin/sendmail /usr/sbin/sendmail.bak  
cd /usr/ports/mail/qmail
make
make install

This will download the code from an ftp site, if you haven't already copied the source files into /usr/ports/distfiles.

Here we are going to setup some qmail options, so it will boot at startup time and use the ./Maildir mail delivery structure

cp /var/qmail/boot/home /var/qmail/rc

Now we are editing the boot file to change to ./Maildir format

vi /var/qmail/rc

Now you will see:

#!/bin/sh
# Using splogger to send the log through syslog.
# Using qmail-local to deliver messages to ~/Mailbox by default.

exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start ./Mailbox splogger qmail&

We want this, notice the highlighted ./Maildir:

#!/bin/sh
# Using splogger to send the log through syslog.
# Using qmail-local to deliver messages to ~/Mailbox by default.
   
exec env - PATH="/var/qmail/bin:$PATH" \
    qmail-start ./Maildir splogger qmail&

We want to link the sendmail file (from the qmail installation) to the locations of the old sendmail binary so.

ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

Then we edit the inetd.conf file so we can run qmail and pop3

vi /etc/inetd.conf

Uncomment this line the following line.  This will make let qmail run from inetd. [note this line has been wrapped in this article to make it fit the page]

smtp stream tcp nowait qmaild /var/qmail/bin/tcp-env 
                              tcp-env /var/qmail/bin/qmail-smtpd 

This line will let pop3 run from inetd

pop3 stream tcp nowait root /usr/local/libexec/popper popper 

Now qmail automatically puts a bootup file in /usr/local/etc/rc.d/.  The file name is qmail.sh and it will make sure qmail starts when the box gets rebooted. 

Download the the patch here http://www.qmail.org/qpopper2.53.patch.tar.gz

Download the qpopper source here ftp://ftp.qualcomm.com/eudora/servers/unix/popper/qpopper2.53.tar.Z

[ed: I questioned Troy about this patch.  He said it provides qpopper with MAILDIR support.  Someone else told me the patch at http://www.flounder.net/qmail/c-client.maildir.module.tar.gz allows PINE and imap2 to read messages from MAILDIRs]

Now install the qmail patch and compile qpopper2.53

tar xvzf qpopper2.53.tar.Z
tar qpopper2.53.patch.tar.gz

Then copy qpopper.patch qpopper2.53

cd qpopper2.53
patch < qpopper.patch

Now we have to edit popper.h search for HOMEDIRMAIL you will see this

/* Define HOMEDIRMAIL as the string for the mail drop location 
 * if you have the the user mailboxes in the user's home 
 * directory.
 */ 

/* #define HOMEDIRMAIL "./mail" */
#define HOMEDIRMAIL "/Mailbox"


We want to change the ./Mailbox to ./Maildir

/* #define HOMEDIRMAIL "./mail" */
#define HOMEDIRMAIL "/Maildir"

Now lets compile qpopper and install it

./configure<make
cp popper /usr/local/libexec/

If you're going to be using pine, you will need to find the global pine.conf file mine is located in /usr/local/etc/

To make pine see ./Maildir you need to edit pine.conf and change inbox-path=Maildir, see the example below.
vi /usr/local/etc/pine.conf

# Path of (local or remote) INBOX, e.g. ={mail.somewhere.edu}inbox
# Normal Unix default is the local INBOX (usually 
# /usr/spool/mail/$USER).
inbox-path=Maildir

Finished:

killall -HUP inetd
/usr/local/etc/rc.d/qmail.sh
Mailbox migration 31 December 2000
Troy Bowman wrote in with this suggestion:

Just want to add to the qmail migration page, that it is also nifty to change the location of everyone's mailbox.  You can do this by editing /etc/login.conf, and changing the line:
(/var/mail/$)

:setenv=MAIL=/var/mail/$,BLOCKSIZE=K:FTP_PASSIVE_MODE=YES:\

to: (/home/$/Mailbox or /home/$/Maildir -- whatever you use)

:setenv=MAIL=/home/$/Mailbox,BLOCKSIZE=K:FTP_PASSIVE_MODE=YES:\

That way, programs like mail should notice where the mailbox is through the MAIL environment variable.

Share
Need more help on this topic? Click here
This article has 1 comment
Show me similar articles