How-To: Gentoo
Documentation
Portage
Updating USE
If it affects glibc need to first run:
emerge --oneshot sys-libs/glibc
Then to upgrade all other packages run:
emerge -uDN world
qmail
Installing qmail on a Gentoo system
Before installing make sure to to add qmail-spp to /etc/portage/package.use:
echo mail-mta/netqmail qmail-spp >> /etc/portage/package.use
Stop svscan if it is already running:
/etc/init.d/svscan stop
Remove ssmtp (the default MTA)...
emerge -C mail-mta/ssmtp
...or if upgrading qmail remove it if you want to install it from scratch:
quickpkg mail-mta/netqmail
mv /var/qmail/ /var/_qmail/
emerge -C mail-mta/netqmail
Install the qmail packages:
emerge mail-mta/netqmail
Do the basic configuration (use the defaults, otherwise see the links below for more information):
. /etc/profile
emerge --config mail-mta/netqmail
To allow certain hosts to relay edit /etc/tcprules.d/tcp.qmail-smtp then re-create the cdb (see the links below for more information):
vim /etc/tcprules.d/tcp.qmail-smtp
tcprules /etc/tcprules.d/tcp.qmail-smtp.cdb \
/etc/tcprules.d/.tcp.qmail-smtp.tmp < /etc/tcprules.d/tcp.qmail-smtp
qmail uses 'maildir' format, if you want mail to arrive in ~/Mailbox you can either change the system default by commenting out the line with './.maildir/' in /var/qmail/control/defaultdelivery, or you can specify a per-user override using ~/.qmail for each user:
echo ./Mailbox > ~/.qmail
Make sure system email addresses get forwarded to a real user (replace SOMEUSER with a real username):
for account in mailer-daemon postmaster root
do
echo SOMEUSER > /var/qmail/alias/.qmail-$account
done
Edit the configuration files in /var/qmail/control as needed, these are the minimum. You can also install SMTP plugins by copying them to /var/qmail/control/smtpplugins then enabling them in /var/qmail/control/smtpplugins.
defaultdomain
locals
me
plusdomain
rcpthosts
For an internal email server you will probably want to disable 'mail from' checks (do NOT run this on an internet-facing server):
echo 0 > /var/qmail/control/mfcheck
Enable outgoing, incoming and POP3 services as needed:
ln -s /var/qmail/supervise/qmail-send /service/qmail-send
ln -s /var/qmail/supervise/qmail-smtpd /service/qmail-smtpd
ln -s /var/qmail/supervise/qmail-pop3d /service/qmail-pop3d
Finally start up svscan (qmail is invoked via the 'service scan' daemon under Gentoo) and enable svscan to start at init (if it wasn't already):
/etc/init.d/svscan start
rc-update add svscan default