PostfixBasicSetupHowto

Differences between revisions 19 and 69 (spanning 50 versions)
Revision 19 as of 2006-03-04 15:18:05
Size: 4909
Editor: 61
Comment:
Revision 69 as of 2008-08-06 17:00:10
Size: 66
Editor: localhost
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;">'''Contents'''[[BR]][[TableOfContents]]||

= Introduction =

This howto will help you to have a basic Postfix mail server setup for your corporate environment. The main intention of this howto is to teach how you can install and configure a basic Postfix mail server setup with IMAP and POP3 services. I do not intend to tell you how you can integrate advanced stuffs like virus checking and spam filtering with this guide. My advanced postfix guide is CompleteVirtualPostfixIspMailSetup. Enjoy it once you have finished this basic howto.

= System Overview =

In our setup, Postfix sends & retrieves mail from Internet and stores in the user mail boxes while clients in the Internet can retrieve their mails either from Courier IMAP or POP3. The user authentication is done by Courier Authdaemon. The following diagram shows this process.

attachment:PostfixSetupOverview.jpg



= Install Postfix =

In this setup I assume that your dmain is {{{yourdomain.com}}} and it has a valid MX record call {{{mail.yourdomain.com}}}. Remember to replace {{{yourdomain.com}}} with your actual domain in the example codes in this howto. Also I assume that you know what an MX record is. To find out MX your type in a terminal:

{{{
dig mx yourdomain.com
}}}

'''To install postfix'''

{{{
sudo apt-get install postfix
}}}

= Adding TLS (Transport Layer Sequrity) =

Transport Layer Security (TLS), its successor, are cryptographic protocols which provide secure communications on the Internet. Using this we tell Postfix to authentitcate when they are sending mail. This will provide a way to secure our mails and stop un-authorized relaying etc.

To add TLS support for postfix:

{{{
sudo apt-get install postfix-tls
}}}

= Test your default setup =

Add a user before you start this.

{{{
sudo useradd -m -s /bin/bash fmaster
sudo passwd fmaster
}}}

Test your default installation using the following code segment.

{{{
telnet localhost 25
ehlo localhost
mail from: root@localhost
rcpt to: fmaster@localhost
data
Subjet: My first mail on Postfix
Hi,
Are you there?
regards,
Admin
. (and Enter In a new Line)
quit
}}}

Check the mailbox of {{{fmaster}}}

{{{
su - fmaster
mail
}}}

= Setting Postfix Support for Maildir-style Mailboxes =

Maildir is a format for an e-mail spool that does not require file locking to maintain message integrity because the messages are kept in separate files with unique names. A Maildir is a directory (often named Maildir) with three subdirectories named tmp, new, and cur. The subdirectories should all reside on the same filesystem.

Another reason to use Maildir format is that Courier IMAP/POP3 servers only work with Maildir format of mailboxes.

Plese find out more about Maildir [http://en.wikipedia.org/wiki/Maildir here]


{{{
 sudo vi /etc/postfix/main.cf
}}}

Add the following code segment:

{{{
   home_mailbox = Maildir/
}}}
   
Comment the Line {{{ mailbox_command = procmail -a "$EXTENSION"}}} adding a "#" at the begining
   
'''Restart Postfix''' to make changes effect.

{{{
sudo /etc/init.d/postfix restart
}}}

Test your setup again
 
= Installing courier IMAP and POP3 =

{{{
sudo apt-get install courier-pop
sudo apt-get install courier-pop-ssl
sudo apt-get install courier-imap
sudo apt-get install courier-imap-ssl
}}}

= Adding local domains to postfix

{{{
sudo vi /etc/postfix/main.cf
}}}

'''Add your domain to:'''

{{{
sudo vi /etc/postfix/main.cf
}}}

Add your domain to {{{mydestination}}}. Once added it should be like the following code segment.

{{{
...
mydestination = mail.fossedu.org, localhost.localdomain, localhost, yourdoamin.com
...
}}}

'''Add your local network to:'''

{{{
sudo vi /etc/postfix/main.cf
}}}

I assume that your local network is 192.168.1.0/24 and add your local network to {{{mynetworks}}}. Once added it should be like the following code segment.

{{{
mynetworks = 127.0.0.0/8, 192.168.1.0/24
}}}

'''Make Postfix to recieve mail from the Internt'''

Set {{{inet_interfaces = all}}} in {{{/etc/postfix/main.cf}}} using:

{{{
sudo vi /etc/postfix/main.cf
}}}

Finally Restart Postfix;

{{{
sudo /etc/init.d/postfix restart
}}}

Test your setup again using following code:

{{{
telnet mail.yourdomain.com 25
ehlo yourdmain.com
mail from: root@yourdomain.com
rcpt to: fmaster@yourdomain.com
data
Subjet: My first mail for my domain
Hi,
Are you there?
regards,
Admin
. (and Enter In a new Line)
quit
}}}

Check the mailbox of {{{fmaster}}}

{{{
su - fmaster
cd Maildir/new
ls
}}}

Now you will see mail has a seperate file



Howto created by: ChinthakaDeshapriya.

----
CategoryDocumentation
#REFRESH 0 http://help.ubuntu.com/community/PostfixBasicSetupHowto

PostfixBasicSetupHowto (last edited 2008-08-06 17:00:10 by localhost)