After spending an afternoon wading through the documentation for Qmail, Qmail-Scanner, Clam AV, and SpamAssassin trying to figure out what was applicable to Hsphere, I decided it might be a good idea to write a howto for anyone else who wants to install it. If you follow the steps contained in this howto, you should be up and running in no time.
Recompiling Qmail for Qmail-scanner support
First of all you need to shutdown qmail before proceeding further via the following command:
/etc/init.d/qmaild stop
If you don't follow this step you will run into problems during the recompiling of qmail. You do not really need to worry about loosing mail while you work on this, because per RFC the remote mail server is supposed to queue the mail it could not deliver for at least six hours (If memory serves me correctly) if not several days in the event it can not reach your mail server. The only mail servers who typically do not follow this, are ones used by spammers because they care about sending lots of messages quickly, and not necessarily making sure they got delivered.
After doing that, you then need to download the following files to recompile qmail:
http://www.qmail.org/qmail-1.03.tar.gz
http://www.qmail.org/qmailqueue-patch
http://www.psoft.net/shiv/qmail-smtpd.patch
Then you need to edit the qmailqueue-patch and remove the email comment at the top of the
file (Everything above the diff -u qmail-... line). After doing that execute the following
commands from the prompt.
# tar -xzf qmail-1.03.tar.gz
# cd qmail-1.03
# patch -p0 < ../qmail-smtpd.patch
# patch -p1 < ../qmailqueue-patch
# make setup check
# ./config-fast "your domain name"
# [ -d /hsphere/local/var ] || mkdir -p /hsphere/local/var
# rm -f /hsphere/local/var/qmail
# mkdir -p /hsphere/local/var
# ln -s /var/qmail /hsphere/local/var/qmail
# cp -f /hsphere/local/var/qmail/boot/home /hsphere/local/var/qmail/rc
Make sure you change "your domain name" to the domain name of your mail server (ie. "psoft.net"). While we are on the topic of qmail itself, you also will need to change the memory usage limits on qmail. To do this you need to edit the /etc/rc.d/init.d/qmaild file. In it you should see a line similar to the following:
#POP before SMTP authentication
/hsphere/shared/bin/tcpserver -H -x /hsphere/local/var/vpopmail/ ...
or
# SMTP Authentication
/hsphere/shared/bin/tcpserver -H -u ${USER_QMAILD} -g ${GROUP_QMAIL} ...
Whichever one you use, you need to edit it and make it look like the following:
softlimit -a 10000000 /hsphere/shared/bin/tcpserver -H ...
You should notice that we added a "softlimit -a 10000000" to the front of the command. This adjusts the allowed memory usage on the mail server. This is needed because the spam and virus checkers take up more RAM than just qmail by itself (as one would expect). You might have to play with the above limit to see what works best on your system, but the 10M limit seems to work fine and is what is suggested in the qmail-scanner documentation. If you don't have softlimit on your machine, then you need to go get it from here:
http://www.rpmfind.net
That site is a savior for anyone who uses machines which use RPM. If you didn't already know about that site, then make sure you bookmark it. The package you will be searching for is "daemontools".