8. Install Courier-IMAP
Courier-IMAP will supply IMAP/SIMAP access.
cd /var/src
tar -xjf tar/courier-imap-2.0.0.tar.bz2
cd courier-imap-2.0.0
# configure may take some time...
./configure --disable-root-check --without-authdaemon --with-authvchkpw \
--enable-workarounds-for-imap-client-bugs
make
make install-strip
make install-configure
cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imap
chmod 755 /etc/rc.d/init.d/courier-imap
ln -s ../init.d/courier-imap /etc/rc.d/rc0.d/K30courier-imap
ln -s ../init.d/courier-imap /etc/rc.d/rc1.d/K30courier-imap
ln -s ../init.d/courier-imap /etc/rc.d/rc2.d/S80courier-imap
ln -s ../init.d/courier-imap /etc/rc.d/rc3.d/S80courier-imap
ln -s ../init.d/courier-imap /etc/rc.d/rc4.d/S80courier-imap
ln -s ../init.d/courier-imap /etc/rc.d/rc5.d/S80courier-imap
ln -s ../init.d/courier-imap /etc/rc.d/rc6.d/K30courier-imap
Edit /usr/lib/courier-imap/etc/imapd
change:
'AUTHMODULES="authcustom authcram authuserdb authvchkpw authldap authpam"'
to:
'AUTHMODULES="authvchkpw"'
change :
'IMAPDSTART=NO'
to:
'IMAPDSTART=YES'
Edit /usr/lib/courier-imap/etc/imapd-ssl
change:
'IMAPDSSLSTART=NO'
to:
'IMAPDSSLSTART=YES'
NOTE: courier-imap does (should) run under user vpopmail.vchkpw
Edit /usr/lib/courier-imap/libexec/imapd.rc AND /usr/lib/courier-imap/libexec/imapd-ssl.rc as follows:
change:
/usr/lib/courier-imap/libexec/couriertcpd -address=$ADDRESS \
to:
/usr/lib/courier-imap/libexec/couriertcpd -address=$ADDRESS \
-user=vpopmail -group=vchkpw \
Start IMAP server:
/etc/rc.d/init.d/courier-imap start
Make the new imapd.pem certificate readable by vpopmail since that's the user that the imap server runs as
chown vpopmail.vchkpw /usr/lib/courier-imap/share/imapd.pem
OK, we've now made it past the vpopmail install. You should now have qmail and vpopmail up and running.
Again, you may want to review steps 7 and 8 to familiarize yourself with the vpopmail install. We are going to move on to the Apache install next.
9. Prepare your Apache
The Apache Web server is needed for webmail and qmailadmin access. We'll need to prepare it for our needs.
Now (and this is important), edit your /etc/httpd/conf/httpd.conf file.
Replace the <Directory /var/www/cgi-bin/> contents with this:
<Directory /var/www/cgi-bin/>
AllowOverride All
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
Start up the Apache web server:
/usr/sbin/apachectl restart
10. Install SqWebmail
SqWebmail is a web cgi client that provides direct access to users' mailboxes, bypassing the need for a pop or imap client in between.
cd /var/src
tar -xjf tar/sqwebmail-3.4.0.20021026.tar.bz2
cd sqwebmail-3.4.0.20021026
# configure may take some time...
./configure --without-authdaemon --with-authvchkpw
make
make install-strip
Add the following line to your crontab via `crontab -e`
crontab -e
40 * * * * /usr/local/share/sqwebmail/cleancache.pl 2>&1 > /dev/null
11. Install autorespond
Autorespond is compatible autoresponder/vacation type tool that works well with vdelivermail and qmailadmin.
cd /var/src
tar -xzf tar/autorespond-2.0.3.tar.gz
cd autorespond-2.0.3
make
make install
12. Install ezmlm-idx
Fast, full featured Mailing List Manager configureable from qmailadmin. Sadly, due to some changes in RedHat 9.0, I couldn't get ezmlm to install from source. You'll need to install from RPMs.
cd /var/src/tar
rpm -i ezmlm-idx-std-0.53.400-10.i386.rpm
rpm -i ezmlm-idx-cgi-0.53.400-10.i386.rpm
cp /home/httpd/cgi-bin/ezmlm-cgi /var/www/cgi-bin/
chmod 4755 /var/www/cgi-bin/ezmlm-cgi
13. Install qmailadmin
Qmailadmin can handle nearly all virtual email administration tasks for you from a web browser, except for adding and removing virtual domains. The patch applied below fixes a problem with the default_quota directive used in the .qmailadmin-limits file.
cd /var/src
tar -xzf tar/qmailadmin-1.0.23.tar.gz
cd qmailadmin-1.0.23
#gunzip -cd ../tar/patch-quotafix-1.06.gz | patch -p0
./configure –-enable-cgibindir=/var/www/cgi-bin/ \
--enable-htmldir=/var/www/html/ \
--with-htmllibdir=/var/www/html/
make
make install-strip
Your toaster installation is done! Now we're ready to take it for a test drive.
14. Test drive your qmail + vpopmail setup
Here we'll add a virtual domain, test.com, and test sending/receiving mail. Substitue test.com for whatever domain you setup DNS for.
# Add the domain to vpopmail
/home/vpopmail/bin/vadddomain test.com [password]
This creates the default "postmaster" account for test.com. You will use this account with qmailadmin.
Try adding/removing users with qmailadmin. Open up a web browser, and type in the following address:
http://mail.test.com/cgi-bin/qmailadmin
To test out quota usage support, create a user with a 6MB quota like so:
/home/vpopmail/bin/vadduser -q 6000000000S
user@test.com [password]
Verify the user settings, and create the "maildirsize" file:
/home/vpopmail/bin/vuserinfo
user@test.com
Now, to log into sqwebmail as
user@test.com, point your browser here:
http://mail.test.com/cgi-bin/sqwebmail
Send yourself a message. If you get it, it's likely you're up and running.
To test your POP server, try telnetting to port 110 and logging in.
telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
+OK Hello there.
user
user@test.com
+OK Password required.
pass [password]
+OK logged in.
quit
+OK Bye-bye.
Connection closed by foreign host.
Test your IMAP server in the same way:
telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
* OK Courier-IMAP ready. Copyright 1998-2001 Double Precision, Inc. See COPYING for distribution information.
a001 login
user@test.com [password]
a001 OK LOGIN Ok.
a001 logout
* BYE Courier-IMAP server shutting down
a001 OK LOGOUT completed
Connection closed by foreign host.
15. Take a break!
Ahhh.... You have a fully functioning mail server. The rest of the stuff if optional, but highly recommend. You can stop now, or you can continue. It's your call.
16. Install vQadmin
vqadmin is a web based control pannel. It allows system administrators to perform actions which require root access.
cd /var/src
tar -zxf tar/vqadmin-2.3.4.tar.gz
cd vqadmin-2.3.4
./configure
make
make install
Now we need to add a few lines to our httpd.conf file:
vi /etc/httpd/conf/httpd.conf
<Directory "/usr/local/apache/cgi-bin/vqadmin">
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
</Directory>
RedHat 90's default user and group is apache. We need to change that to nobody:
change:
User apache
Group apache
to:
User nobody
Group nobody
Save the file, and end your vi session.
cd /var/www/cgi-bin/vqadmin/
vi .htaccess
change:
AuthUserFile /usr/local/apache/conf/vqadmin.passwd
to:
AuthUserFile /etc/httpd/conf/vqadmin.passwd
chown nobody .htaccess
chmod 600 .htaccess
# Create an admin account with a password:
/usr/bin/htpasswd -bc /etc/httpd/conf/vqadmin.passwd admin adminpass
chown nobody.nobody /etc/httpd/conf/vqadmin.passwd
/usr/sbin/apachectl stop
/usr/sbin/apachectl start
Test out the installation in your favorite broswer:
http://www.test.com/cgi-bin/vqadmin/vqadmin.cgi
17. Install PHP4
PHP4 is needed for Squirrelmail. You should have it installed already; if you don't, install the RPMs from the RH9 install CDs.
vi /etc/php.ini
change:
register_globals = Off
to:
register_globals = On
18. Install Squirrelmail
Squirrelmail is a great web-based e-mail client with IMAP support. NOTE: Squirrelmail requires PHP4 to be installed.
cd /var/www/html
tar -xzf /var/src/tar/squirrelmail-1.3.2.tar.gz
mv squirrelmail-1.2.7 squirrelmail
cd squirrelmail
mkdir attachment
chown -R nobody.nobody data
chown -R nobody.nobody attachment
chmod 733 attachment
Now, run the squirrelmail configuration script (the configure routine should be self explanatory):
./configure
The one thing you must do is change the IMAP settings from cyrus to courier. Do this by pressing D at the prompt, then at the next prompt, type courier. Also, you should set up your attachment directory path. From the main menu, press 4, then press 3, and set the path to ../attachment/ and then press s to save and q to quit.
19. Install SpamAssassin
Spam is a dirty word where I come from. Most people don't like it, don't read it, and don't want it. If you want to protect yourself against spam, your should install SpamAssassin. As of the time of writing this, there is a newer version of SpamAssassin (version 2.43); however, many people have reported problems, so we're going to stick with version 2.31.
SpamAssassin requires Time-HiRes. If you don't have it, we'll need to install it.
# Install the Time-HiRes perl module
cd /var/src
# NOTE: If you are running CPAN for the first time, you will be asked
# a series of questions. The defaults are fine for most questions.
# It should be easy enough to figure out.
# RedHat 9.0 sets LANG=UTF8, which confuses the CPAN Make, so let's get around that problem:
unset $LANG
perl -MCPAN -e'shell'
cpan> install Time::HiRes
cpan> exit
# Install SpamAssassin
cd /var/src
tar -xzf tar/Mail-SpamAssassin-2.55.tar.gz
cd Mail-SpamAssassin-2.55
perl Makefile.PL
make
make install
# Run a spam and non-spam test
spamassassin -t < sample-spam.txt > spamtest.txt
less spamtest.txt
spamassassin -t < sample-nonspam.txt > nonspamtest.txt
less nonspamtest.txt
The spamtest.txt should contain the “X-Spam-Flag: YES” tag, while the nospamtest.txt should not.
20. Install MailDrop and TNEF reader
TNEF is a program for unpacking MIME attachments of type "application/ms-tnef". This is a Microsoft only attachment.
The TNEF program allows one to unpack the attachments which were encapsulated into the TNEF attachment. It is not essential to install TNEF, but it is highly recommended!
cd /var/src
tar -xzf tar/qmail-scanner-1.16.tgz
tar -xjf tar/maildrop-1.5.3.tar.bz2
tar -xzf tar/tnef-1.2.1.tar.gz
# Install maildrop
cd /var/src/maildrop-1.5.3
./configure
make
make install-strip
make install-man
# Install the tnef
cd /var/src/tnef-1.1.3
./configure
make
make install