1. download postfix admin from http://postfixadmin.sourceforge.net/
2. install all necessary packages,
sudo apt-get install postfix postfix-mysql dovecot-postfix mysql-server apache2 php5 php5-mysql php5-imap
3. on "Postfix Configuration" wizard, please choice "Internet Site"
5. create postfix database,
mysql -u root -p
CREATE DATABASE email;
CREATE USER 'postfix'@'localhost' IDENTIFIED BY 'postfix123';
GRANT ALL ON email.* to 'postfix'@'localhost';
6. extract postfixadmin tarball to /var/www,
sudo tar xzvf postfixadmin-2.3.6.tar.gz -C /var/www/
7. rename postfixadmin folder into mailadmin,
sudo mv /var/www/postfixadmin-2.3.6 /var/www/mailadmin
8. edit postfixadmin conf file,
sudo vim /var/www/mailadmin/config.inc.php
$CONF['configured'] = true;
$CONF['setup_password'] = 'letmeinstallit';
$CONF['postfix_admin_url'] = $_SERVER['HTTP_HOST'].’/mailadmin’;
$CONF['database_password'] = 'postfix123';
$CONF['database_name'] = 'email';
$CONF['admin_email'] = 'putyour@emailaddress.com';
$CONF['default_aliases'] = array (
'abuse' => 'abuse@change-this-to-your.domain.tld',
'hostmaster' => 'hostmaster@yourdomain.com',
'postmaster' => 'postmaster@yourdomain.com',
'webmaster' => 'webmaster@yourdomain.com'
9. go to http://yourwebserver.com/mailadmin/setup.php and put "letmeinstallit" (without quotes) on Setup Password and click Generate Password Hash.
10. copy your password hash!
11. open your /var/www/mailadmin/config.inc.php again and edit 'setup_password' with your hash password,
sudo vim /var/www/mailadmin/config.inc.php
$CONF['setup_password'] = 'pleaseuseyourpasswordhashfromposftixadmininstallation';
12. create superadmin account. put 'letmeinstallit' as Setup Password and create new admin user with email,
ex,
Admin : ime@andmyself.com
13. create new email alias file,
sudo vim /etc/postfix/aliasmaps.cf
user = postfix
password = postfix123
hosts = localhost
dbname = email
query = SELECT goto FROM alias WHERE address = ‘%s’ AND active = 1
14. create new domain maps file,
sudo vim /etc/postfix/domainsmaps.cf
user = postfix
password = postfix123
hosts = localhost
dbname = email
query = SELECT domain FROM domain WHERE domain = ‘%s’ AND backupmx = 0 AND active = 1
15. create new mailbox limit file,
sudo vim /etc/postfix/mailboxlimits.cf
user = postfix
password = postfix123
hosts = localhost
dbname = email
query = SELECT quota FROM mailbox WHERE username = ‘%s’ AND active = 1
16. create new mailbox maps,
sudo vim /etc/postfix/mailboxmaps.cf
user = postfix
password = postfix123
hosts = localhost
dbname = email
query = SELECT CONCAT(domain,’/',maildir) FROM mailbox WHERE username = ‘%s’ AND active = 1
17. edit main.cf file,
sudo vim /etc/postfix/main.cf
virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:8
virtual_mailbox_base = /var/vmail
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
virtual_alias_maps = proxy:mysql:/etc/postfix/aliasmaps.cf
virtual_mailbox_limit = proxy:mysql:/etc/postfix/mailboxlimits.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/domainsmaps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mymailboxmaps.cf
18. comment out this options,
sudo vim /etc/postfix/main.cf
#home_mailbox = Maildir/
#mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/dovecot-postfix.conf -n -m “${EXTENSION}”
19. edit master.cf file,
sudo vim /etc/postfix/master.cf
dovecot unix - n n - - pipe flags=DRhu user=vmail:mail argv=/usr/lib/dovecot/deliver -c /etc/dovecot/dovecot-postfix.conf -f ${sender} -d $(recipient)
my suggestion is, do not copy paste that line but write it by your self. :)
20. create new vmail user,
sudo useradd -r -u 150 -g mail -d /var/vmail -s /sbin/nologin vmail
21. create vmail directory,
sudo mkdir /var/vmail
22. give permission for vmail user,
sudo chmod 770 /var/vmail
sudo chmod mail:mail /var/vmail
23. create new dovecot-sql.conf file,
sudo vim /etc/dovecot/dovecot-sql.conf
driver = mysql
connect = host=localhost dbname=email user=postfix password=postfix123
default_pass_scheme = MD5-CRYPT
user_query = SELECT ‘/var/vmail/%d/%n’ as home, ‘maildir:/var/vmail/%d/%n’ as mail, 150 AS uid, 8 AS gid, concat(‘dirsize:storage=’, quota) AS quota FROM mailbox WHERE username = ‘%u’ AND active = 1
password_query = SELECT username as user, password, ‘/var/vmail/%d/%n’ as userdb_home, ‘maildir:/var/vmail/%d/%n’ as userdb_mail, 150 as userdb_uid, 8 as userdb_gid FROM mailbox WHERE username = ‘%u’ AND active = 1
24. create new dovecot-postfix.conf,
sudo vim /etc/dovecot/dovecot-postfix.conf
mail_location = maildir:/var/vmail/%d/%n
first_valid_uid = 150
last_valid_uid = 150
passdb sql {
args = /etc/dovecot/dovecot-sql.conf
}
userdb sql {
args = /etc/dovecot/dovecot-sql.conf
}
master {
path = /var/run/dovecot/auth-master
mode = 0660
user = vmail
group = mail
}
25. restart postfix and dovecot services,
sudo /etc/init.d/postfix restart
sudo /etc/init.d/dovecot restart
No comments:
Post a Comment