Installing a new mailserver: Difference between revisions

From Edgar BV Wiki
Jump to navigation Jump to search
Line 43: Line 43:
<pre>
<pre>
protocols = imap imaps pop3 pop3s
protocols = imap imaps pop3 pop3s
</pre>
We need to set it to listen on all interfaces, so uncomment
<pre>
listen = *
</pre>
</pre>



Revision as of 11:41, 14 January 2013

apt-get install openssh-server proftpd snmpd iotop iptstate atsar postfix shorewall vim awstats bmon nscd sshfs mc zip unzip bzip2 arj spamassassin pyzor razor ncftp rsync quota ntpdate ntp vacation pdnsd dovecot-common dovecot-imapd dovecot-pop3d

pdnsd - use resolvconf configuration

Network

Set up networking in /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
#auto eth0
iface eth0 inet static
        address 192.168.0.112
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
#       gateway 192.168.0.1
        dns-nameservers 213.75.63.36 213.75.63.70 192.168.0.1
#       dns-nameservers 192.168.0.1 192.168.0.2
#       dns-search tripnet.int internal.tripnet.int ops.tripnet.int

auto eth1
iface eth1 inet static
        address 188.204.140.195
        netmask 255.255.255.224
        network 188.204.140.192
        broadcast 188.204.140.223
        gateway 188.204.140.193
        dns-nameservers 213.75.63.36 213.75.63.70 192.168.0.1

Postfix and Procmail

First install Postfix

Spamassassin

Then install Spamassassin

Dovecot

Check the following is set, or dovecot won't let people POP / IMAP in

protocols = imap imaps pop3 pop3s

We need to set it to listen on all interfaces, so uncomment

listen = *

To set Dovecot to save files in Maildir format and then also use directories to store folders (instead of foldername.mail in one big folder), set

mail_location = maildir:~/Maildir:LAYOUT=fs

Ensure the following is set for performance

maildir_copy_with_hardlinks = yes

Because we're using NFS for mail storage we need to check:

mmap_disable = yes
dotlock_use_excl = yes # MUST CHECK THIS ONE
mail_nfs_storage = yes
mail_nfs_index = yes

Logging:

log_path = /var/log/mail/dovecot.err
info_log_path = /var/log/mail/dovecot.info
touch /var/log/mail/dovecot.err
touch /var/log/mail/dovecot.info

in /etc/logrotate.d/rsyslog add

/var/log/mail/dovecot.err
/var/log/mail/dovecot.info

to the rest of the mail lines

To test:

mutt -f imap://username@localhost
mutt -f pop://username@localhost

or to open a user's maildir:
mutt -m maildir -f ~user/Maildir

Roundcube webmail

First install roundcube and roundcube-mysql. You will need mysql-server, apache2 and php5 as well.

then in /etc/roundcube/apache.conf

uncomment:
    Alias /roundcube/program/js/tiny_mce/ /usr/share/tinymce/www/
    Alias /roundcube /var/lib/roundcube

in /etc/roundcube/main.inc.php change

$rcmail_config['htmleditor'] = FALSE; to TRUE
$rcmail_config['default_host'] = '127.0.0.1';
$rcmail_config['virtuser_file'] = '/etc/postfix/virtual';
$rcmail_config['smtp_server'] = 'localhost';
$rcmail_config['smtp_user'] = '%u';
$rcmail_config['smtp_pass'] = '%p';

Converting from mbox to maildir

Because we want the system to support IMAP functionality fully, there are some changes to to be made which will be documented further. For now, look at Converting from mbox to maildir