Exim, Vexim and Dovecot on CentOS5

From PhoenixWing

Jump to: navigation, search
Image:Neutral.pngThis article is currently Pending Review.
The information is not yet approved for general use.

Contents

Preparing Your System

You will need to make sure a few things are installed:

yum install exim clamd clamav clamav-db spamassassin mysql mysql-server \
dovecot mailman httpd httpd-devel php-mysql php php-pear-db

Next, you'll need to download the latest vexim from http://silverwraith.com/vexim/download.html and untar it.


Now that you have vexim downloaded, prepare a database for use with vexim, create a vexim database and a vexim mysql user with password.


Setting Up vexim

Setting up MySQL

  1. Edit vexim2/setup/mysql.sql, and replace the word 'CHANGE' on lines 6 and 7 with the default UID and GID under which mail deliveries should happen. This UID and GID should be an actual user on your system. It's UID and GID should both be 93 (exim) by default.
  2. Now, on line 135 (or around there) which starts "GRANT SELECT,...", change the word "CHANGE" to a password of your choosing. This is the password the web interface and Exim will both use to access the database. Make sure it is secure.
  3. Finally at the bottom of the file, there are two lines commented out with '-- ' at their start, uncomment both.
  4. Save the file and exit.
  5. Import the file into mysql: mysql -uroot -p vexim < vexim2/setup/mysql.sql (Note: You may have to remove all the lines starting with "---")


Configuring Files

  1. Move the vexim2/vexim folder to a location that is web accessible. Example: mv vexim2/vexim /var/www/virtual/domain.com/htdocs/vexim
  2. Edit the $DOCUMENT_ROOT/vexim/config/variables.php file and change the variables according to your specific needs
  3. Create a directory to store your virtual mailboxes. Common examples include: /home/vmail, /var/mail, or /var/local/mail
  4. chown exim:exim /home/vmail (change to your mail directory)
  5. Back in the original vexim2 directory where you untar'd the original files, copy vexim2/docs/configure to /etc/exim/exim.conf
  6. Copy vexim2/docs/vexim* to /etc/exim/
  7. Edit /etc/exim/vexim-acl-check-content.conf, and replace:
    spam = maildeliver:true
    ... with the following:
    spam = nobody:true


Configuring Exim.conf

  1. Edit /etc/exim/exim.conf to replace all occurences of "/usr/local/etc/" with "/etc/"
  2. Edit the Mailman variables, and change them to:
    MAILMAN_HOME=/usr/lib/mailman
    MAILMAN_WRAP=MAILMAN_HOME/mail/mailman
    MAILMAN_USER=mailman
    MAILMAN_GROUP=mailman
  3. Change the variable "MY_IP = CHANGE" to your IP address
  4. Change the line
    domainlist local_domains = @ : pear.silverwraith.com : ...
    To:
    domainlist local_domains = @ : host.domain.com : ...
  5. Change "trusted_users = avleen:www" to "trusted_users = exim:clamav"
  6. Change the following:
    #hide mysql_servers = localhost::(/tmp/mysql.sock)/vexim/vexim/CHANGE
    to whatever your system uses, for example:
    hide mysql_servers = localhost::(/var/lib/mysql/mysql.sock)/veximDBname/veximUserName/PASSWORD
  7. Change "av_scanner = clamd:/var/run/clamav/clamd" to the appropriate socket file, for example: "av_scanner = clamd:/var/run/clamav/clamd.socket"
  8. Change the following to use "exim":
    exim_user = exim
    exim_group = exim
  9. In the section labeled "system_aliases" (about line #666), find the 'user' and 'group' variables, and change them both to 'exim'


Setting Up Dovecot

MySQL Config File

  1. Create the directory /etc/dovecot
  2. Create a file named /etc/dovecot/dovecot-sql.conf, and enter in the following information (edit CHANGE to your values)
    driver = mysql
    connect = host=localhost user=CHANGE password=CHANGE dbname=CHANGE
    default_pass_scheme = PLAIN
    password_query = SELECT clear as password FROM users WHERE username = '%u' AND type = 'local' AND enabled = '1'
    user_query = SELECT smtp as maildir, u.uid as uid, u.gid as gid, u.domain_id, d.domain_id FROM users u, domains d WHERE u.username = '%u' AND u.type = 'local' AND u.enabled = '1' AND u.domain_id = d.domain_id AND d.enabled = '1' AND d.domain = '%d'


Dovecot Config File

  1. Open the /etc/dovecot.conf file for editing
  2. Find and change the following options:
    auth default {
    
    mechanisms = plain
    passdb sql {
    args = /etc/dovecot/dovecot-sql.conf
    }
    userdb sql {
    args = /etc/dovecot/dovecot-sql.conf
    }
    user = exim
    count = 1
    }
  3. When changing the above, comment out (put a # before) the following sections: passdb pam, userdb passwd
  4. Find and change first_valid_uid to the value of 93 (otherwise mailchecking will not work)
  5. Find "mail_location" and change it to: "mail_location = maildir:/YOUR/Mail/Directory/%d/%n/Maildir"


Setting up Mailman

First Configuration Steps

  1. Change to /etc/mailman/ and create a link to the Defaults.py file: (DO NOT EDIT THE FILE!)
    ln -snf /usr/lib/mailman/Mailman/Defaults.py Defaults.py
  2. Edit /etc/mailman/mm_cfg.py and change DEFAULT_EMAIL_HOST = fqdn to the domain name using the primary mailling list.
    Example: DEFAULT_EMAIL_HOST = 'domain.com'
  3. Set the password for the mailing list site administrator: /usr/lib/mailman/bin/mmsitepass <your-site-password>
  4. Run /usr/lib/mailman/bin/update for good measure ;)
  5. Create a "site-wide" mailing list (Note: this must be done before starting the mailman daemon). This is the one that password reminders will appear to come from. Usually this should be the "mailman" mailing list, but if you need to change this, be sure to change the MAILMAN_SITE_LIST variable in mm_cfg.py.
    /usr/lib/mailman/bin/newlist mailman
  6. Copy the output for the email aliases and add them to the bottom of /etc/aliases, then run newaliases command, and restart exim. Example:
    Add the following to /etc/aliases, when done, run the command "newaliases" and restart exim using "service exim restart"
    ## mailman mailing list
    mailman: "|/usr/lib/mailman/mail/mailman post mailman"
    mailman-admin: "|/usr/lib/mailman/mail/mailman admin mailman"
    mailman-bounces: "|/usr/lib/mailman/mail/mailman bounces mailman"
    mailman-confirm: "|/usr/lib/mailman/mail/mailman confirm mailman"
    mailman-join: "|/usr/lib/mailman/mail/mailman join mailman"
    mailman-leave: "|/usr/lib/mailman/mail/mailman leave mailman"
    mailman-owner: "|/usr/lib/mailman/mail/mailman owner mailman"
    mailman-request: "|/usr/lib/mailman/mail/mailman request mailman"
    mailman-subscribe: "|/usr/lib/mailman/mail/mailman subscribe mailman"
    mailman-unsubscribe: "|/usr/lib/mailman/mail/mailman unsubscribe mailman"


Finish Installation

  1. Start mailman: service mailman start
  2. Set mailman to run on boot: chkconfig mailman on
  3. Check that it will run on runlevel 3: chkconfig --list mailman


Post Configuration

  1. The file /etc/mailman/Defaults.py (which you symlinked to earlier) contains a number of defaults for your installation. If any of these are incorrect, override them in /etc/Mailman/mm_cfg.py
  2. DO NOT EDIT Defaults.py!
  3. Further reading can be found at: /usr/share/doc/mailman-2.1.9/INSTALL.REDHAT
Personal tools