[Home] [Credit Search] [Category Browser] [Staff Roll Call] | The LINUX.COM Article Archive |
Originally Published: Monday, 20 August 2001 | Author: Henry Chen |
Published to: enhance_articles_sysadmin/Sysadmin | Page: 1/1 - [Std View] |
Install and Test Qmail with POP, IMAP and WebMail
Kill Sendmail? Are you kidding me? Well, no. In this first run original article Henry Chen provides us with free detailed step-by-step instructions for installing Qmail with Redhat 7.1, an alternative open source solution to your mail management needs.
|
We have been using Qmail since 1995. The primary reasons for our move from sendmail to Qmail were: (1) SPAM relay control and (2) virtual domain e-mail aliases support. Qmail worked so well for us that we never "upgraded" until earlier this month. We upgraded not because Qmail broke. We upgraded because more and more people (including ourselves) are demanding more from our e-mail server. Stuff like IMAP, web interface, and remote relay control are common place among most ISP's and web hosts. Someone suggested Exchange 2000. We tried it and loved it. But for what we want to do, we cannot justify the cost of the licensing fee. So we did a little research and found that we can do what we want for free, well, except for the server hardware.
The following document will take you, step by step, through the installation of Qmail (SMTP), qmail-popup, qmail-pop3d (POP), Courier IMAP and IMP (web interface to IMAP). The majority of the Qmail related setup information comes from Life with Qmail. I also sourced bits and pieces of several others' write-ups. You can find a list of these sources in Credits.
Following the steps herein, you will create the following: a server that is (1) a SMTP server that can receive e-mail for localhost and virtual domain hosts that you have setup and send (relay) e-mail from any remote host from which users have authenticated through POP or IMAP, (2) a POP server, (3) an IMAP server, and (4) a web interface to browse e-mails in the IMAP folders and send e-mails. There are also other some small stuff that I will discuss later.
I am known for making quite a bit of silly typos. If you find any parts of this document that do not make sense (or more importantly, are just plain wrong!), please e-mail me at: henry@sxpress.com.
I am not going to discuss performance, reliability, security, etc. You can find much better discussions about these on the Qmail web site. Let's jump right into what's relevant:
We have decided to refurbish an older machine with some spare parts. So far, this has worked well for us. We have over 1,500 users and we process between 5,000 to 10,000 pieces (occasionally a little more) of e-mail per day. You can probably get away with an even older machine with about 1GB of disk space and 64MB of RAM if you are not going to be doing a lot of e-mails.
We also have multiple T-1 connection to the Internet.
Except for IMP, I downloaded tarball versions of the above instead of RPMs. I just could not find anyone who has made RPMs for Red Hat 7.1. I figure that if we build everything from the source code, it will probably work better.
Along with these, don't forget to install Red Hat 7.1's RPMs for mysql and php-mysql from the CD-ROM (or download these from Red Hat's FTP server). I also updated to procmail 3.21 to get Maildir support since we will be using Maildir for Qmail.
As we are migrating from another server, we started with a clean Red Hat Linux 7.1 server installation with just the Web Server module. I downloaded all the software into my home directory on the server. Note: for the truly lazy (or just very bad typist), copy the commands and paste them into your console window.
From your home directory, unpack the tarballs:
tar -xzf qmail-1.03.tar.gz tar -xzf ucspi-tcp-0.88.tar.gz tar -xzf checkpassword-0.90.tar.gz
There should now be subdirectories of these packages. We start by doing Qmail.
su umask 022 mkdir /var/qmail ln -s /usr/local/man /var/qmail/man
I decided to leave the control
and bin
in the
/var/qmail
directory.
Otherwise, you can also do these:
mkdir /etc/qmail ln -s /etc/qmail /var/qmail/control ln -s /usr/sbin /var/qmail/bin
Now, we need to setup the Qmail groups and users:
/usr/sbin/groupadd nofiles /usr/sbin/useradd alias -g nofiles -d /var/qmail/alias -s /nonexistent /usr/sbin/useradd qmaild -g nofiles -d /var/qmail -s /nonexistent /usr/sbin/useradd qmaill -g nofiles -d /var/qmail -s /nonexistent /usr/sbin/useradd qmailp -g nofiles -d /var/qmail -s /nonexistent /usr/sbin/groupadd qmail /usr/sbin/useradd qmailq -g qmail -d /var/qmail -s /nonexistent /usr/sbin/useradd qmailr -g qmail -d /var/qmail -s /nonexistent /usr/sbin/useradd qmails -g qmail -d /var/qmail -s /nonexistent
The following will build Qmail from the sources:
cd qmail-1.03 make setup check ./config
For us, config
works because we have a separate DNS server that has been
humming along for ages. If your DNS server some how doesn't get it, try
this:
./config-fast the.full.hostname
Qmail is done. Now we do ucspi-tcp. You should still be the root user. Note: $username is your username.
cd ~$username/ucspi-tcp-0.88 make make setup check
ucspi-tcp is done. This will install ucspi-tcp into the /usr/local/
directories. Now daemontools. You are still the root user:
mkdir -p /package chmod 1755 /package cd /package tar -xzf ~$username/daemontools-0.76.tar.gz cd admin/daemontools-0.76 package/install
daemontools is done. At this point in time, you should see a few
svsc...
processes running (when you do a ps -ef
). Now checkpassword.
You are still the root user:
cd ~$username/checkpassword-0.90 make make setup check
checkpassword is done. We have made all the binaries that we need to run Qmail. Next, we need create some configuration directories and files so that Qmail will run properly.
We are following the configuration suggestions made by Dave Sill (in Life with Qmail). We have further made the decision to use Maildir instead of the other two less fancy options. I am only going to discuss Maildir and not the other options. Life with Qmail covers this configuration topic very well and very thoroughly. I do not need to reinvent the wheel here.
In this section, you will need to create some files. I use vi. If you hate vi, anytime you see vi, just replace it with your favorite editor. You are still be the root user. First, we kill sendmail:
vi hint: hit i
for
insert, the [ESC]
key to end insert, and :x
to save and
exit. If you made a mistake, hit [ESC]
to stop whatever you are doing
and :q!
to exit without saving.
/etc/init.d/sendmail stop rpm -e --nodeps sendmail
Removing sendmail completely is quite safe. Qmail is more than capable of taking over for sendmail. Now, we create all the directories that we need:
mkdir -p /var/log/qmail/smtpd mkdir -p /var/log/qmail/pop3d chown -R qmaill /var/log/qmail mkdir -p /var/qmail/supervise/qmail-send/log chmod +t /var/qmail/supervise/qmail-send mkdir -p /var/qmail/supervise/qmail-smtpd/log chmod +t /var/qmail/supervise/qmail-smtpd mkdir -p /var/qmail/supervise/qmail-pop3d/log chmod +t /var/qmail/supervise/qmail-pop3d
Now we create a rc
file by vi
/var/qmail/rc
#!/bin/sh # Using stdout for logging # Using control/defaultdelivery from qmail-local to deliver messages by default exec env - PATH="/var/qmail/bin:$PATH" \ qmail-start "`cat /var/qmail/control/defaultdelivery`"
Make this file executable, then create the defaultdelivery
file:
chmod 755 /var/qmail/rc echo ./Maildir/ > /var/qmail/control/defaultdelivery
Create the qmailctl
file by vi
/var/qmail/bin/qmailctl
#!/bin/sh # For Red Hat chkconfig # chkconfig: - 30 80 # description: the qmail MTA PATH=/var/qmail/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin export PATH QMAILDUID=`id -u qmaild` NOFILESGID=`id -g qmaild` case "$1" in start) echo "Starting qmail" if svok /service/qmail-send ; then svc -u /service/qmail-send else echo qmail-send service not running fi if svok /service/qmail-smtpd ; then svc -u /service/qmail-smtpd else echo qmail-smtpd service not running fi if [ -d /var/lock/subsys ]; then touch /var/lock/subsys/qmail fi if svok /service/qmail-pop3d ; then svc -u /service/qmail-pop3d else echo qmail-pop3d service not running fi ;; stop) echo "Stopping qmail..." echo " qmail-smtpd" svc -d /service/qmail-smtpd echo " qmail-send" svc -d /service/qmail-send if [ -f /var/lock/subsys/qmail ]; then rm /var/lock/subsys/qmail fi echo " qmail-pop3d" svc -d /service/qmail-pop3d ;; stat) svstat /service/qmail-send svstat /service/qmail-send/log svstat /service/qmail-smtpd svstat /service/qmail-smtpd/log qmail-qstat svstat /service/qmail-pop3d svstat /service/qmail-pop3d/log ;; doqueue|alrm|flush) echo "Sending ALRM signal to qmail-send." svc -a /service/qmail-send ;; queue) qmail-qstat qmail-qread ;; reload|hup) echo "Sending HUP signal to qmail-send." svc -h /service/qmail-send ;; pause) echo "Pausing qmail-send" svc -p /service/qmail-send echo "Pausing qmail-smtpd" svc -p /service/qmail-smtpd echo "Pausing qmail-pop3d" svc -p /service/qmail-pop3d ;; cont) echo "Continuing qmail-send" svc -c /service/qmail-send echo "Continuing qmail-smtpd" svc -c /service/qmail-smtpd echo "Continuing qmail-pop3d" svc -c /service/qmail-pop3d ;; restart) echo "Restarting qmail:" echo "* Stopping qmail-smtpd." svc -d /service/qmail-smtpd echo "* Sending qmail-send SIGTERM and restarting." svc -t /service/qmail-send echo "* Restarting qmail-smtpd." svc -u /service/qmail-smtpd echo "* Restarting qmail-pop3d." svc -t /service/qmail-pop3d ;; cdb) tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp chmod 644 /etc/tcp.smtp.cdb echo "Reloaded /etc/tcp.smtp." ;; help) cat <<HELP stop -- stops mail service (smtp connections refused, nothing goes out) start -- starts mail service (smtp connection accepted, mail can go out) pause -- temporarily stops mail service (smtp connections accepted, but nothing leaves) cont -- continues paused mail service stat -- displays status of mail service cdb -- rebuild the tcpserver cdb file for smtp restart -- stops and restarts smtp, sends qmail-send a TERM & restarts it doqueue -- sends qmail-send ALRM, scheduling queued messages for delivery reload -- sends qmail-send HUP, rereading locals and virtualdomains queue -- shows status of queue alrm -- same as doqueue flush -- same as doqueue hup -- same as reload HELP ;; *) echo "Usage: $0 {start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help}" exit 1 ;; esac exit 0
Make qmailctl
executable and link it to a whole bunch of places to make life
easier when we need to manage Qmail later:
chmod 755 /var/qmail/bin/qmailctl ln -s /var/qmail/bin/qmailctl /etc/init.d/qmail ln -s /var/qmail/bin/qmailctl /usr/bin/qmailctl ln -s ../init.d/qmail /etc/rc0.d/K30qmail ln -s ../init.d/qmail /etc/rc1.d/K30qmail ln -s ../init.d/qmail /etc/rc2.d/S80qmail ln -s ../init.d/qmail /etc/rc3.d/S80qmail ln -s ../init.d/qmail /etc/rc4.d/S80qmail ln -s ../init.d/qmail /etc/rc5.d/S80qmail ln -s ../init.d/qmail /etc/rc6.d/K30qmail
Now we do the supervise scripts for send. First, vi /var/qmail/supervise/qmail-send/run
#!/bin/sh exec /var/qmail/rc
Then send's log, vi /var/qmail/supervise/qmail-send/log/run
#!/bin/sh exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail
Now we do the supervise scripts for smtpd. First, vi /var/qmail/supervise/qmail-smtpd/run
#!/bin/sh QMAILDUID=`id -u qmaild` NOFILESGID=`id -g qmaild` MAXSMTPD=`cat /var/qmail/control/concurrencyincoming` exec /usr/local/bin/softlimit -m 2000000 \ /usr/local/bin/tcpserver -v -R -l 0 -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \ -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
Then, create the concurrencyincoming
file:
echo 20 > /var/qmail/control/concurrencyincoming
Then smtpd's log, vi /var/qmail/supervise/qmail-smtpd/log/run
#!/bin/sh exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail/smtpd
Now we do the supervise scripts for pop3d. First, vi
/var/qmail/supervise/qmail-pop3d/run
#!/bin/sh exec /usr/local/bin/softlimit -m 2000000 \ /usr/local/bin/tcpserver -v -R -H -l 0 0 110 /var/qmail/bin/qmail-popup \ FQDN /bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir 2>&1
FQDN is the Fully Qualified Domain Name of the server that you are working on.
Then pop3d's log, vi /var/qmail/supervise/qmail-pop3d/log/run
#!/bin/sh exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail/pop3d
Now make all these files executable:
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 chmod 755 /var/qmail/supervise/qmail-pop3d/run chmod 755 /var/qmail/supervise/qmail-pop3d/log/run
Before we start up Qmail, we need to disallow relay from remote hosts (we will deal with relay control later) and setup some aliases.
echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp qmailctl cdb
echo $username > /var/qmail/alias/.qmail-root echo $username > /var/qmail/alias/.qmail-postmaster ln -s .qmail-postmaster /var/qmail/alias/.qmail-mailer-daemon chmod 644 /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-postmaster
These are the bare minimum aliases. Feel free to create more.
You should also see INSTALL.alias
for more details on aliases.
You also need to populate the proper hostnames and domain names in the /var/qmail/control/locals
and /var/qmail/control/rcpthosts
. At the bare minimum, you
should have these:
localhost hostname of your server
For virtual domains, you will need to populate /var/qmail/control/virtualdomains
and create the proper .qmail-...
file in the specific users'
home directories. You can find better discussions about virtual domains
and all the fun and cool uses of .qmail files on the Qmail
web site.
We have removed sendmail before. Now, we replace it with Qmail's sendmail:
ln -s /var/qmail/bin/sendmail /usr/lib ln -s /var/qmail/bin/sendmail /usr/sbin
Lastly (phew!), we link the run
files to the /service
directory (by
linking the directories). The /service
directory was created by the
daemontools' install script.
ln -s /var/qmail/supervise/qmail-send /service ln -s /var/qmail/supervise/qmail-smtpd /service ln -s /var/qmail/supervise/qmail-pop3d /service
Once these links are created, wait for a minute or two and Qmail will start running and you will have SMTP (send and receive) and POP. For now, you also need to know these to start, stop and restart Qmail:
qmailctl start qmailctl stop qmailctl restart
That's it for Qmail. Now comes the fun part of testing. Before you
start testing, you need to create the proper "mailbox" for
yourself, which is really a directory. If you are still root, type exit
to become yourself again, then do this:
cd /var/qmail/bin/maildirmake Maildir
This will create a Maildir
directory (in your home directory)
with three sub-directories, cur
, new
and tmp
.
When you send e-mail to yourself during testing, the new mail will appear in
the new
directory.
Follow the instructions in TEST.deliver
and TEST.receive
to verify that SMTP is working correctly.
To test POP, use any POP client to connect to this server to retrieve the
e-mail that you have just sent yourself in TEST.receive
. I
use Outlook Express to test this. Remember to check the Leave
copy of message on server
box so that you do not delete the e-mails from the
server (for testing IMAP later).
Also remember that you can only receive via POP now. If you try to
send anything via POP, Qmail will stop you (and you should test this to make
sure). If things does not work for you, don't freak out. Check
the /var/log/qmail
directory and see what the logs tell
you.
You have downloaded the tarball earlier. You are now yourself (NOT root). From your home directory:
cd Courier-IMAP 1.3.9 ./configure --without-authdaemon --without-authldap --mandir=/usr/local/man make make check su umask 022 make install make install-configure
You have just made the Couried IMAP binaries from the sources. Now you need to configure it so that it will start up right.
If you happen to read Courier IMAP's web page, you will see some discussion on virtual mailboxes, authdaemon, and Courier's POP. We have a dedicated e-mail server here so we did not bother with virtual mailboxes. As for authdaemon, this requires another process to be running in the background and we did not particularly feel like running another process. We also like Qmail's POP better.
You are now root. You need to edit the IMAP configuration file: vi
/usr/lib/courier-imap/etc/imapd
There are only a few things that need to be changed. I am listing the lines that we changed:
ADDRESS=IP Address of your server
AUTHMODULES="authpam"
IMAP_CHECK_ALL_FOLDERS=1
IMAP_MOVE_EXPUNGE_TO_TRASH=1
Leave the other lines as default. Only the ADDRESS
and AUTHMODULES
are essential. We like the other two functions so because we want to mimic the Exchange 2000
server that we test drove. Also, PAM is installed by
default with Red Hat Linux 7.1. Now make some links to make life easier:
ln -s /usr/lib/courier-imap/libexec/imapd.rc /etc/init.d/imapd ln -s ../init.d/imapd /etc/rc0.d/K31imapd ln -s ../init.d/imapd /etc/rc1.d/K31imapd ln -s ../init.d/imapd /etc/rc2.d/S81imapd ln -s ../init.d/imapd /etc/rc3.d/S81imapd ln -s ../init.d/imapd /etc/rc4.d/S81imapd ln -s ../init.d/imapd /etc/rc5.d/S81imapd ln -s ../init.d/imapd /etc/rc6.d/K31imapd
We made the counter in the rc
directories 1 greater than
Qmail because we want to start Qmail first when we reboot. To start (and
stop) Courier IMAP, do this:
/etc/init.d/imapd start /etc/init.d/imapd stop
Startup Courier IMAP and test it. From any IMAP client (I use
Outlook Express), once you set it up, it will look for IMAP folders from your
server. In /var/log/messages
, you should also see a bunch
of PAM authentication messages. In the Inbox, you should see the
messages from TEST.receive
. You should also be able to
create new IMAP folders, subscribe/unsubscribe to these folders.
Furthermore, you should also be able to move messages to/from any folder to
any other folder.
After you have created some IMAP folders, you can check to see what your Maildir
directory looks like. You should see several more directories (with a
"dot" in the beginning of the directory name, i.e. you have to do ls
-al
to see them).
Now that SMTP, POP and IMAP all functions, we need to add the ability for Qmail to selectively relay e-mail for our customers so that they can set their incoming and outgoing e-mail server to be the same thing. To accomplish this, we picked relay-ctrl from Bruce Guenter. It is well written and simple to use.
You are still the root user.
cd ~$username tar -xzf relay-ctrl-2.5.tar.gz cd relay-ctrl-2.5
Before we make the binaries, we have to make some changes to correspond
relay-ctrl to our prior installations. Do vi
relay-ctrl-age.c
and make these changes:
const char* rulesdir = "/etc"; const char* smtprules = "tcp.smtp"; const char* smtpcdb = "tcp.smtp.cdb"; const char* tcprules = "/usr/local/bin/tcprules";
To make and install the binaries:
make make root-install
Now we edit the pop3d file by vi
/var/qmail/supervise/qmail-pop3d/run
#!/bin/sh exec /usr/local/bin/softlimit -m 2000000 \ /usr/local/bin/tcpserver -v -R -H -l 0 0 110 /var/qmail/bin/qmail-popup \ FQDN /bin/checkpassword /usr/sbin/relay-ctrl-allow \ /var/qmail/bin/qmail-pop3d Maildir 2>&1
Note where we inserted relay-ctrl. Then, we change one line in the imapd file by vi
/usr/lib/courier-imap/etc/imapd
AUTHMODULES="authpam relay-ctrl-allow"
Then, we setup a cron job to check the relay list every 3 minutes by crontab
-e
*/3 * * * * /usr/sbin/relay-ctrl-age
Lastly, we create the proper links and directories
ln -s /usr/sbin/relay-ctrl-allow /usr/lib/courier-imap/libexec/authlib mkdir /var/spool/relay-ctrl
Now you are able to make Qmail relay e-mail if you authenticate first
through either POP or IMAP. You should try this out with the POP and
IMAP accounts that you have already setup. When you authenticate, you
should see a file with a filename of the IP address of your "remote" host show up
in the /var/spool/relay-ctrl
directory. As long as this
file exist, you will be able to relay e-mail using such host. To properly
test it, you should do POP first, see the file appear, delete it (you have to
be root to do this), then do
IMAP, and you should see the same IP address appear again.
This Maildir
directory structure, especially with all the
IMAP folders, gets complicated. So, as the root user, I recommend the
following:
mkdir /etc/skel/Maildir mkdir /etc/skel/Maildir/cur mkdir /etc/skel/Maildir/new mkdir /etc/skel/Maildir/tmp mkdir /etc/skel/Maildir/.Trash mkdir /etc/skel/Maildir/.Trash/cur mkdir /etc/skel/Maildir/.Trash/new mkdir /etc/skel/Maildir/.Trash/tmp mkdir /etc/skel/Maildir/.Drafts mkdir /etc/skel/Maildir/.Drafts/cur mkdir /etc/skel/Maildir/.Drafts/new mkdir /etc/skel/Maildir/.Drafts/tmp mkdir /etc/skel/Maildir/.Sent\ Items mkdir /etc/skel/Maildir/.Sent\ Items/cur mkdir /etc/skel/Maildir/.Sent\ Items/new mkdir /etc/skel/Maildir/.Sent\ Items/tmp
Now, whenever we create a new user with the useradd
command,
the new user will get a set of IMAP folders that mimics Exchange 2000.
The Trash folder will also catch all the e-mails that the user
expunges. The .Sent\ Items
directory mimics Exchange
2000's Sent Items folder and it
will catch the sent mails from IMP.
It is also useful to setup quotas for the /home
directory. To do this, you have to edit the /etc/fstab
file. I replace this line:
LABEL=/home /home ext2 defaults 1 2
With this line:
LABEL=/home /home ext2 defaults,usrquota 1 2
Now, you need to reboot the server for this to take hold. It is a good time to reboot the server anyway, to test whether all the boot up scripts for Qmail and Courier IMAP will work properly.
After the server reboots, you should see that the Qmail stuff is running
with supervise
, a bunch of multilog
processes, and
some Courier IMAP related processes. To complete the quota setup, do
this:
su touch /home/aquota.user /usr/sbin/quotacheck /home
quotacheck will report some errors because the aquota.user
file that you just created is garbage and quotacheck just made it
right. I also created this script to make life simpler vi
/root/newuseradd
#!/usr/bin/perl # # Wrapper for useradd and setquota # Usage: newuseradd [username] [password] "[comment]" use POSIX; if ($ARGV[0] eq '' || $ARGV[1] eq '' || $ARGV[2] eq '') { print "Usage: sxuseradd [username] [password] \"[comment]\"\n"; exit; } $username = $ARGV[0]; $comment = $ARGV[2]; # Encrypt password srand($$^time&$ENV{RANDOM}); $salt = seedchar().seedchar(); $password = crypt($ARGV[1],$salt); system "/usr/sbin/useradd -g client -c \"$comment\" -p $password $username"; system "/usr/sbin/setquota /home 0 10000 0 0 $username"; exit; sub seedchar { ('a'..'z','A'..'Z','0'..'9','.','/')[rand(64)]; }
This assumes that you want to give new users a 10MB disk quota for
e-mail. I also used crypt
instead of the PAM thing so this
does not give you as good an encrypted password as Red Hat's default useradd.
Then, I added the following command aliases to root's .bashrc
file:
echo "alias useradd=/root/newuseradd" >> /root/.bashrc
And don't forget to add the client group and make the new script executable:
/usr/sbin/groupadd client chmod 755 /root/newuseradd
So, now, every time you do an useradd
, you will also take
care of the disk quota.
Setup a few new users to make sure that they all have the correct Maildir
directory structure. Check with the IMAP client to make sure that (1)
you can login and (2) the correct IMAP folders show up. If you don't
care for the web interface for IMAP, you can stop now.
I thought about getting the tarball for horde and IMP but I am so tired by
this point that I gave the RPM's a try and they worked! All the RPMs do
is that they add some directories and files to the /var/www
directory structure. As horde/ IMP is designed as an add on module to the
web server, the RPM's for Red Hat 7.0 worked just fine.
Before you can begin installing horde and IMP RPMs, you must first install the mysql and php-mysql RPMs and start the mysql and apache server. To install RPMs, I did this (as root):
rpm -ivh package_name
To start mysql and apache (and at boot time), I did these:
/etc/init.d/mysqld start /etc/init.d/httpd start cd /etc/rc3.d mv K12mysqld S12mysqld mv K15httpd S15httpd
We need MySQL because we want to enable the preference
and address book
functions in IMP. Remember to secure MySQL by doing this:
mysqladmin -u root password new_password
Now to install horde and IMP (note the sequence, and you are still root):
rpm -ivh horde-1.2.6-1rh7.noarch.rpm rpm -ivh horde-mysql-1.2.6-1rh7.noarch.rpm rpm -ivh imp-2.2.6-1rh7.noarch.rpm
The horde/IMP installation packages are so well made that they give you almost all the instructions that you need to complete the rest of the installation. I followed the instructions and did these:
cd /var/www/html/horde sh install.sh
Then, I went to my browser and opened up http://yourhostname/horde/setup.php3
This created the /var/www/html/horde/imp/config/defaults.php3
file. I am noting the following changes from default:
$default->localhost = 'IP address of your server';
$default->server = 'IP address of your server'; $default->from_server = 'your domain name';
It is important to use the IP address, instead of the hostname. Otherwise, your virtual domain clients will not be able to use IMP if they do not specify the exactly correct hostname of your e-mail server.
$default->sent_mail = 'Sent Items'; $default->postponed = 'Drafts';
Note that these are the IMAP folders we created earlier. And they mimic Exchange 2000.
/* Cyrus Configuration */ $default->personal_folders = 'INBOX.'
Watch out for this one on the web configuration interface. If you don't do this, IMP will not be able to see the other folders (under Inbox).
/* Database Configuration */ $default->use_db = true; $default->database_driver = 'mysql';
This enables MySQL for IMP. Once the web configuration is complete, do this on console (you are still root):
sh secure.sh mysql < /var/www/html/horde/scripts/database/mysql_create.sql /var/www/html/horde/scripts/database/dbpasswd.sh
For the last two command lines, MySQL will prompt you for a
password. You should use the new_ password
that you setup earlier
to secure MySQL. The first command creates the proper MySQL database
and the second secures the horde database. Also, if you don't run secure.sh
and secure the horde database, IMP will refuse to start.
To play with IMP, goto http://yourhostname/horde/imp/
To make life simpler, I created a new /var/www/html/index.html
file with these:
<HTML> <meta http-equiv="refresh" content="0; URL=/horde/imp/"> </HTML>
So now, http://yourhostname/ will end up in the IMP login screen.
Congratulations!!! You have just completed setup your new e-mail server with SMTP (with relay from authenticated users), POP, IMAP and web interface to the IMAP server.
I sourced a lot of people's material. I am trying to list all of them here. If I miss any, let me know and I will add them here:
If all these is too much for you and you just want this to be done and someone to take care of it, you should consider contracting SurfXpress (and I will be involved) for a dedicated server solution and negotiate a server management contract with us. We can provide you with a full e-mail hosting solution package.
I have not given this much thought. I guess this is covered by the
OpenContent License, version 1.0. See http://www.opencontent.org/opl.shtml
for the full license. Basically, you can copy, redistribute, or modify this
document provided that modified versions, if redistributed, are also covered
by the OpenContent License.
A lot of legal stuff should go here. Basically, it will say that this document is provided as is and there is no warranty of any kind... See the OpenContent License mentioned above.
Please send corrections, suggestions, complaints, fix any typo, grammatical errors, etc. to henry@sxpress.com.
Or, you can contribute to my personal sanity by buying some stuff for me from Amazon.