|
Home HowTos Random Thoughts Sony PS3 Family Genealogy Hesse Research Member Mail Contact |
echo $TITLE; ?>Brian J. DensmoreCopyright ©2004 Brian J. Densmore 2004-04-25, 0.1.1beta Abstract So you want to have your own mailserver? This mini-HowTo is specific to debian so your mileage may vary.
This document will attempt to instruct you how to install and configure : exim to send and receive mail,
procmail to gather all your mail and organize it according to your taste into folders, spamassasin to filter the Spam, courier-imap to allow you to access mail by secure imap and Squirrelmail to retrieve mail via the Web (webmail).
1. Authorship and copyright1.1. AuthorshipThis document is copyright (c) by Brian J. Densmore 2004 under the creative commons license. You are free to copy, modify, and/or redistribute only under the terms of this license. If you do modify this document or redistribute it for commercial purposes, I would appreciate a copy of the work or an order of 7 star Kung Pao Shrimp.1.2 AcknowledgementsI'd like to thank a somewhat anonymous writer on the 'net for giving me the idea. A person using the handle of Rei (king). I'd also like to thank Jason Boxman and I'm sure I'll add more names before I release my 1.0 version of this HowTo.1.3 Comments and CorrectionsYours can be the first!1.4 Latest Version and TranslationsThe latest version can be found here. Or a strict html version downloaded here. Or a single page version here.I haven't done any translations yet.
2. Requirements2.1. The hardwareI use a pentium 133, 40 MB ram, and 2 Gig of hard disk.2.2. Necessary SoftwareOur centralized mail/webmail server needs:
I know this list may seem daunting, but it's really not that difficult in debian. The installation of each one of them separately can be trivial, but when combined they tend to interact and thus can create issues that are easily overcome with some planning. 2.3. Installing DebianThe first task is to choose a flavor of Debian. I recommend stable, which what I run. The downside to Stable is it is very outdated, from a Linux standpoint. Testing is more current and is quite stable, but the downside is that security patches are less frequently applied to Testing. Unstable will be as stable as most of the major distributions, but I don't recommend running unstable on a production box. I prefer to use a prepakaged debian version and one with a minimal approach, so we will use Bonzai Linux. There are plenty of good documents on installing debian so I won't detail it extensively here. A mailserver accessible over the internet should be secured and run a minimum of dangerous services.As soon as we have Debian in operation, we can recompile the kernel so that it is better adjusted with the hardware. Go ahead, I'll wait... Done already? I didn't do this for mine. That's a future project. Next we will need a means of remotely controlling the machine. We will use ssh as telnet is too dangerous. Install ssh thus: server:~#apt-get install ssh You'll want to get a real certificate but for now we can just use the snake oil cert. If you are running a firewall you will need these ports open 22, 80, 443, and 993. If you aren't using a firewall, why aren't you!? 3. InstallationThe first step is to install the necessary packages. We will do this one at a time and configure and test each one before going on to the next package. So let's start!3.1. Eximmyserver:~#apt-get install eximWhen prompted for the server type we will choose option 1 for direct delivery ("Internet Server"). We will not relay to any other host, nor accept mail if it is not for our computer. Exim is in charge of transporting mail from and to other mail servers, hence the name Mail Transport Agent (MTA). For the delivery of local mail we will use procmail. Test your exim configuration now. You should be able to send mail and receive. Got that working? Now let's make some changes to the /etc/exim/exim.conf in preparation for the next steps. We don't want exim in it's default configuration. We need to have exim understand Maildir format. To set up Maildir in exim we need to edit the /etc/exim/exim.conf file.
This should turn on sitewide Maildir format. I also like to
/home/username/Maildir/ Finally you'll need to create the Maildirs for each user and also in /etc/skel. For the /etc/skel directory running: maildirmake /etc/skel should create the maildir format in /etc/skel. You can run this on the home directory of every user on the system, or you can send a mail to every user, and exim should create the Maildir structure for everyone. You should now have a functioning exim delivering in maildir format. It's very important to remember that Maildirs must be owned by the user. Don't forget to restart exim after making these changes. 3.2. Procmailmyserver:~#apt-get install procmailProcmail is going to give much flexibility to us. We will create in the home of each existing user a control file ".procmailrc" where we will put the configuration. We will also put a copy in /etc/skel for users created in the future. In this file we will have to do two things: first to send mails to spamassassin so that it filters the Spam, and to organize it by folders.
3.3. Spamassassinserver:~#apt-get install spamassassin This program will allow us to filter the incoming mail and what it considers to be Spam placed in another folder. Rather than delete it since it is possible to get false positives detecting Spam mail that is not. Usually it is configured a little permissive (the limit is 5 and that lets pass Spam, with 4 much less is passed) We edit the configuration file in the user directories and in /etc/skel myserver:~#nano -w .spamassassin/user_prefs # How many hits before mail is considered Spam. required_hits 4 3.4. Courier-imapThe application for distributing mail to users. In debian is as simple to install as:server:~#apt-get install courier-imap courier-imap-ssl I have the imap port set up only for local connection which is used by squirrelmail, the only imap port open to the internet is the imap-ssl port 993 3.5. ApacheTo install we will use debian's apt-get functionality again. From a command prompt We will install apache with ssl so we never transmit passwords over the internet unencrypted and expose our servers to evil crackers.myserver:~#apt-get install apache Edit the /etc/apache/httpd config file thus: TODO: add content here 3.6. Squirrelmailmyserver:~#apt-get install squirrelmailRunning the above install will also install php4 if it is not installed on your server. PHP is required to run Squirrelmail. Made it this far? Excellent! You may notice squirrelmail will install in a directory that is not: /var/www. Which is where we installed apache. Therefore it is not directly accessible by apache. We will have to create a link to it in order to use it. I prefer to fully qualify my symbolic links. myserver:/var/www/# ln - s /usr/share/squirrelmail /var/www/webmail Squirrelmail requires php4 to work. You will also need to uncomment the following lines in your configuration file, myserver:~# nano -w /etc/apache/httpd.conf LoadModule php4_module/usr/lib/apache/1.3/libphp4.so AddType application/x-httpd-php php AddType application/x-httpd-php-source phps Or add them if not it there. Setting Squirrelmail is as easy as running the configuration menu: myserver:~#/etc/squirrelmail/conf.pl
We will perform the 1,2, 4, and 8
3.7. Amavismyserver:~#apt-get install amavisI haven't installed this yet. Congratulations! Now your new internet mail server is complete.
4. FAQs4.1 What yet another mail HowTo!?Yes, still another HowTo. I did this because I couldn't find one with all the pieces I wanted on my mail server. It was purely a selfish thing, and hopefully having it all in one place will help someone else.4.2 Debian sucks, why don't you use RedHat?I've used just about every major type of distro out there. From simple do it all for you distros to through Slackware, RedHat,Mandrake, LFS and gentoo. I've found that gentoo and debian have the best update and upgrade functionality. I know that RH and Mandrake are are improving one this, but I feel that debian's method is mature and stable and it just works. I feel that gentoo is too time intensive for a production server. So I'm now a true believer in debian. If you aren't that's fine too.4.3 Why doesn't it work for me?This document probably won't work for everyone. I may have left something out. You may have different software installed, or you may have a different system configuration.4.4 Why use exim, I prefer qmail?There are several fine choices for mail transport agents (MTAs). I've used sendmail and it is powerful and stable and yes it can even be secure. Qmail is an excellent MTA also, but I felt that exim was easier to set up and also I choose it to work with squirrelmail better. It's fast, lightweight, secure and easy to maintain. Sure the same can be said for other MTAs.4.5 There are mistakes how do I let you know?If you find mistakes in my HowTo, I'll would like to hear from you. If you have refinements, I'd be glad to incorporate them also.4.6 What if I want to translate this in another language?If you want to translate this into another language, please do so. If you contact me, I'll make sure you have the latest copy. I would also appreciate a link, or if you want, I'll post it here.
5. ErrataThere are no errors, of course. If you do find any, I would appreciate hearing from you. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|