| ISP Style Virtual Mail System |
|
| Written by Chris Gountanis | ||||||||||||
|
This document will explain the process of installing a fully working virtual email system on CentOS Linux using PostFix and Dovecot. I personally finalized my setup with RoundCube Webmail Project for robust online email usage. This how-to is very simple and easy to implement for beginners.
INSTALLATION NOTESIf you have not installed the packages this would be a good time to get moving. Using CentOS or RedHat Enterprise Linux (RHEL) you can use the “YUM” package manager to achieve this. You can also remove sendmail because it may cause SMTP based port issues with Postfix. Installing Postfix with database support is a bit tricky. You have to enable the CentOS Plus repository. You will then use upgrade if already installed or install for a full fresh install. I had to use upgrade due to installing the normal Postfix later finding out it would not work with this setup due to the lack of MySQL database support.
Note: You don't want to screw up your PostFix install with yum updates! Here is how to setup /etc/yum.repos.d/CentOS-Base.repo:
You would also want to add this to both the [base] and [update] sections of /etc/yum.repos.d/CentOS-Base.repo, so as not to get postfix packages from there anymore: exclude=postfix-*
If you had everything working and all of a sudden your SMTP is broke or you have error like "unsupported dictionary type: mysql" check this out for a nice easy fix.
![]() DATABASEThe next step is to manually create the blank database with a corresponding user. You need to log into MySQL and create the database using the create database command. Then, give your new user permissions to that database. In this example the user is named mail with a password of mail.
The next step is to prepare the database. In this example we use MySQL with the PostFix Admin database dump provided with PostFix Admin files. Note the URL might change based on version. Extract the files to your web folder unless you plan on administering your email accounts manually. Something like phpMyAdmin would work as well once you understand the required table data.
Open postfixadmin-2.1.0/DATABASE_MYSQL.TXT with your favorite editor such as vim, nano or gedit and comment out or remove all lines under create user section Postfix / MySQL, since we have created our own use for the mail server. When this is done, just load the file into MySQL using the following command.
![]()
DOVECOTOpen up your Dovecot.conf for editing. The sample below is what I used to create this system using IMAP for webmail and POP3 for email clients like Outlook or Thunderbird direct access.
Open up the dovecot-sql.conf for editing. This file has been specified in the main Dovecot configuration file. Dovecot looks for this file in order to fire up the database driven virtual mailboxes.
![]() POSTFIXOpen Main.cf for editing. You will need to change “hostname” and “myorigin”. The rest was simple and should work on almost all systems for simple implementation.
Open master.cf for editing. Add these two lines to the bottom of the file. I found that if the proper spacing and formatting was not found Postfix would actually not start properly. So as a tip check these lines for proper spacing and formatting as a trouble shooting step.
Add file mysql_virtual_alias_maps.cf and open for editing.
Add file mysql_virtual_domains_maps.cf and open for editing.
Add file mysql_virtual_mailbox_limit_maps.cf and open for editing.
Add file mysql_virtual_mailbox_maps.cf and open for editing.
![]()
ADMINISTRATIONI have installed phpMyAdmin as well as Postfix Admin. Between the two packages I was able to learn how to create mailboxes manually, if needed. I suggest you start with tools like Postfix Admin until you fully understand what data is required for your email system to function properly.
![]() WEBMAILI decided to go with RoundCube Webmail Project due to the sleek look and feel. Once downloaded and extracted it took all of 15 minutes to have it up and running for all users globally. If you want to really seal the deal create a virtual host within Apache to handle webmail.* for all of your domains. This really gives it a professional touch for your end users.
![]()
CONCLUSIONSince installing the system I have had no issues with many domains containing multiple virtual user mailboxes. This is a great virtual setup and can easily go hand in hand with my virtual ftp documentation posted earlier. Once you have these down, you can easily add virtual hosts in Apache for a robust hosting solution at no required software cost.
EXTRASPostfix Admin http://postfixadmin.sourceforge.net/ phpMyAdmin http://www.phpmyadmin.net/ Roundcube Webmail Project http://roundcube.net/ |
||||||||||||
| Last Updated on Wednesday, 24 September 2008 21:30 |







