Mail Server Tutorial with Virtual User and Domain, use MySql Postfix Dovecot Postfixadmin
First, we will edit CentOS reposiblity to yum postfix support mysql
#vim /etc/yum.repos.d/CentOS-Base.repo
#yum install -y postfix
To test:
#postconf -m
Notice to mysql
Next to datbase, use mysql:
#mysql -u root -p
Then, vmail user:
#groupadd -g 5000 vmail
#useradd -g vmail -u 5000 vmail -d /home/vmail -m
Config postfix:
#vim /etc/postfix/main.cf
Add:
5000 is user's id you created.
#vim /etc/postfix/mysql-domains.cf
#vim /etc/postfix/mysql-users.cf
#vim /etc/postfix/mysql-aliases.cf
#service postfix start
#chkconfig postfix on
Install Dovecot:
#yum install -y dovecot
#vim /etc/dovecot-sql.conf
#vim /etc/dovecot.conf
#postconf -e virtual_transport=dovecot
#postconf -e dovecot_destination_recipient_limit=1
#service postfix restart
#service dovecot start
#chkconfig dovecot on
# tail /var/log/dovecot.log
Info: auth-worker(default): mysql: Connected to localhost is OK!
Install web to run postfixadmin
#yum install httpd php php-mysql php-imap php5-mbstring
Down postfixadmin
#cd /var/www/html/
#tar -zxvf postfixadmin_2.3.tar.gz
#mv postfixadmin mail-admin
#vim mail-admin/config.inc.php
go to: http://IP_address/mail-admin/setup.php
Generate password to hash, and copy it to:
$CONF['setup_password'] = '';
Ex: $CONF['setup_password'] = '5d2fc88aca697a96534cb890307049ba:00aef3c6bcc1de03dc3169e747b5191f62e84055';
Then create admin user. Login now
Videos: Watch in HD Now :))
Mediafire download to view detail:
Part 1: http://www.mediafire.com/?7x7gdq3m4by7dtx
Part 2: http://www.mediafire.com/?kbcmq2tc1tth4qu
Part 3: http://www.mediafire.com/?fnfwvd802ml2yt1
Part 4: http://www.mediafire.com/?xd2tgv1lowvjorr
------------------------------------------------------------
Thanks for reading
--------------------------------------------------------------------------
All my Lab:
Linux Lab -- window and Cisco Lab
to be continued - I will update more.
#vim /etc/yum.repos.d/CentOS-Base.repo
[base]
exclude=postfix
[update]
exclude=postfix
[centosplus]
enabled=1
includepkgs=postfix
#yum install -y postfix
To test:
#postconf -m
Notice to mysql
Next to datbase, use mysql:
#mysql -u root -p
mysql> CREATE DATABASE postfix;
mysql> CREATE USER mail@localhost IDENTIFIED BY '123456';
mysql> GRANT ALL PRIVILEGES ON postfix.* TO mail;
mysql> show databases;
Then, vmail user:
#groupadd -g 5000 vmail
#useradd -g vmail -u 5000 vmail -d /home/vmail -m
Config postfix:
#vim /etc/postfix/main.cf
myhostname = server.hbn.local
mydomain = hbn.local
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 192.168.81.0/24, 127.0.0.0/8
Add:
virtual_mailbox_domains = mysql:/etc/postfix/mysql-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-users.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-aliases.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
5000 is user's id you created.
#vim /etc/postfix/mysql-domains.cf
host = localhost
user = mail
password = 123456
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = '0' and active = '1'
#vim /etc/postfix/mysql-users.cf
host = localhost
user = mail
password = 123456
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
additional_conditions = and active = '1'
result_format = %sMaildir/
#vim /etc/postfix/mysql-aliases.cf
host = localhost
user = mail
password = 123456
dbname = postfix
table = alias
select_field = goto
where_field = address
additional_conditions = and active = '1'
#service postfix start
#chkconfig postfix on
Install Dovecot:
#yum install -y dovecot
#vim /etc/dovecot-sql.conf
driver = mysql
connect = host=localhost dbname=postfix user=mail password=123456
default_pass_scheme = PLAIN
password_query = SELECT password FROM mailbox WHERE username = '%u'
#vim /etc/dovecot.conf
protocols = imap imaps pop3 pop3s#vim /etc/postfix/master.cf
disable_plaintext_auth = no
mail_location = maildir:/home/vmail/%d/%n/Maildir
mechanisms = plain login
passdb sql {
args = /etc/dovecot-sql.conf
}
userdb static {
args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
}
socket listen {
master {
path = /var/run/dovecot/auth-master
mode = 0600
user = vmail
}
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -d ${recipient}
#postconf -e virtual_transport=dovecot
#postconf -e dovecot_destination_recipient_limit=1
#service postfix restart
#service dovecot start
#chkconfig dovecot on
# tail /var/log/dovecot.log
Info: auth-worker(default): mysql: Connected to localhost is OK!
Install web to run postfixadmin
#yum install httpd php php-mysql php-imap php5-mbstring
Down postfixadmin
#cd /var/www/html/
#tar -zxvf postfixadmin_2.3.tar.gz
#mv postfixadmin mail-admin
#vim mail-admin/config.inc.php
$CONF['configured'] = true;
$CONF['postfix_admin_url'] = '/postfixadmin';
$CONF['database_type'] = 'mysqli';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'mail';
$CONF['database_password'] = 'change-your-new-password-here';
$CONF['database_name'] = 'postfix';
$CONF['encrypt'] = 'cleartext';
$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'NO';
$CONF['emailcheck_resolve_domain']='NO';
go to: http://IP_address/mail-admin/setup.php
Generate password to hash, and copy it to:
$CONF['setup_password'] = '
Ex: $CONF['setup_password'] = '5d2fc88aca697a96534cb890307049ba:00aef3c6bcc1de03dc3169e747b5191f62e84055';
Then create admin user. Login now
Videos: Watch in HD Now :))
Mediafire download to view detail:
Part 1: http://www.mediafire.com/?7x7gdq3m4by7dtx
Part 2: http://www.mediafire.com/?kbcmq2tc1tth4qu
Part 3: http://www.mediafire.com/?fnfwvd802ml2yt1
Part 4: http://www.mediafire.com/?xd2tgv1lowvjorr
------------------------------------------------------------
Thanks for reading
--------------------------------------------------------------------------
All my Lab:
Linux Lab -- window and Cisco Lab
to be continued - I will update more.
Comments