Postfix Mail Server With Mysql
[root@smtp ~]# yum install http*
php* mysql* -y
Download Postfixadmin Tar
URL =>
http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-2.3.2/postfixadmin-2.3.2.tar.gz?r=&ts=1295671941&use_mirror=citylan
[root@smtp
~]# cd Desktop/
[root@smtp
Desktop]# cp postfixadmin-2.3.2.tar.gz /var/www/html/
[root@smtp
~]# cd /var/www/html
[root@smtp
html]# tar -xvf postfixadmin-2.3.2.tar.gz
[root@smtp
html]# cp -a postfixadmin-2.3.2 mailadmin
[root@smtp
html]# cd mailadmin/
[root@smtp
mailadmin]# cp config.inc.php config.inc.php-org
[root@smtp
mailadmin]# vim config.inc.php
( This is postfixmailserver configuration file )
$CONF['database_password']
= 'postfix';
$CONF['encrypt']
= 'cleartext';
'abuse' => 'abuse@new.com',
'hostmaster' => 'hostmaster@new.com',
'postmaster' => 'postmaster@new.com',
$CONF['domain_path']
= 'YES';
$CONF['domain_in_mailbox']
= 'YES';
$CONF['vacation_domain']
= 'autoreply.new.com';
[root@smtp
mailadmin]# /etc/init.d/httpd restart
[root@smtp
mailadmin]# /etc/init.d/mysqld restart
[root@smtp
mailadmin]# chkconfig httpd on
[root@smtp
mailadmin]# chkconfig mysqld on
[root@smtp
mailadmin]# mysqladmin psddword "postfix"
[root@smtp
mailadmin]# mysql -u root -p
ENTER
password; postfix
mysql>
show databases;
mysql>
CREATE DATABASE postfix;
mysql>
CREATE USER 'postfix'@'localhost' IDENTIFIED BY 'postfix';
mysql>
GRANT ALL PRIVILEGES ON `postfix` . * TO 'postfix'@'localhost';
mysql>
quit
[root@smtp
mailadmin]# /etc/init.d/httpd restart
(
open web browser & type: )
give the URL: => http://localhost/mailadmin
and Configure your mailadmin
[root@smtp
mailadmin]# useradd keenable
[root@smtp
mailadmin]# passwd keenable
Download
URL -
http://postfix.wl0.org/ftp/official/2.4/SRPMS/postfix-2.4.5-3.src.rpm
[root@smtp
Desktop]# cp -a postfix-2.4.5-3.src.rpm /home/keenable/
[root@smtp
Desktop]# chown keenable.keenable
/home/keenable/postfix-2.4.5-3.src.rpm
[root@smtp
Desktop]# su – keenable
[keenable@smtp
~]$ mkdir rpm
[keenable@smtp
~]$ cd rpm/
[keenable@smtp
rpm]$ mkdir BUILD RPMS SOURCES SPECS SRPMS
[keenable@smtp
rpm]$ cd RPMS/
[keenable@smtp
RPMS]$ mkdir i386
[keenable@smtp
RPMS]$ cd
[keenable@smtp
~]$ echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros
[keenable@smtp
~]$ rpm -ivh postfix-2.4.5-3.src.rpm
[keenable@smtp
~]$ cd rpm/SPECS
[keenable@smtp
SPECS]$ vim postfix.spec
(Make
changed on following line like this--line 84 & 87)
%define with_mysql_redhat 1
%define with_sasl 2
%define with_vda 1
and
find 'rhel-4' to change 'rhel-5' and 'rhel4' to 'rhel5'
then
save & quit
[keenable@smtp
SPECS]$ rpmbuild -ba postfix.spec
[keenable@smtp
SPECS]$ cd /home/keenable/rpm/RPMS/i386/
[keenable@smtp
i386]$ rpm -Uivh postfix-2.4.5-3.rhel5.i386.rpm
[keenable@smtp
i386]$ rpm -Uivh postfix-debuginfo-2.4.5-3.rhel5.i386.rpm
[keenable@smtp
i386]$ postconf -m ( It is command should show mysql )
Downlod URL
http://easynews.dl.sourceforge.net/sourceforge/courier/courier-imap-4.1.1.tar.bz2
Downlod
URL
http://easynews.dl.sourceforge.net/sourceforge/courier/courier-authlib-0.58.tar.bz2
[root@smtp
Desktop]# cp -a courier-imap-4.1.1.tar.bz2
/home/keenable/
[root@smtp
Desktop]# cp -a courier-authlib-0.58.tar.bz2
/home/keenable/
[root@smtp
Desktop]# chown -R keenable.keenable /home/keenable/*
[root@smtp
Desktop]# su – keenable
[keenable@smtp
~]$ rpmbuild -ta courier-authlib-0.58.tar.bz2
[keenable@smtp ~]$ exit
[keenable@smtp
~]# cd /home/keenable/rpm/RPMS/i386/
Install
The All 8 to 9 RPMS in courier-authlib
[keenable@smtp i386]# rpm -ivh courier-authlib
[keenable@smtp ~]# su - keenable
[keenable@smtp ~]$ cd
[keenable@smtp ~]$ tar -jxvf
courier-imap-4.1.1.tar.bz2
[keenable@smtp ~]$ cd courier-imap-4.1.1
[keenable@smtp courier-imap-4.1.1]$ cp
courier-imap.spec courier-imap.spec-org
[keenable@smtp courier-imap-4.1.1]$ cp
courier-imap.spec /home/keenable/rpm/SPECS/
[keenable@smtp courier-imap-4.1.1]$ cd
/home/keenable/rpm/SPECS/
[keenable@smtp SPECS]$ vim courier-imap.spec
( This line NO 44 & 46 like remove fam
support )
44 BuildPreReq: rpm >= 3.0.5
/usr/bin/sed openldap2 openldap2-devel )
45 %else
46 BuildPreReq: rpm >= 4.0.2 sed
openldap-devel openldap-servers
47 %endif
( this line same add
courier-imap-4.1.1 in file )
save & quit
[keenable@smtp SPECS]$ exit
[keenable@smtp SPECS]# cd
/home/keenable/rpm/RPMS/
i386
[keenable@smtp i386]# rpm -ivh
courier-imap-4.1.1-1.5Server.i386.rpm
[keenable@smtp i386]# rpm -ivh
courier-imap-debuginfo-4.1.1-1.5Server.i386.rpm
[root@smtp Desktop]# useradd virtual
[root@smtp Desktop]# passwd virtual
[root@smtp Desktop]# vim /etc/passwd
virtual:x:1001:1001::/home/virtual:/bin/bash
[root@smtp Desktop]# vim /etc/group
virtual:x:1001:
[root@smtp Desktop]# chmod -R 777
/home/virtual/
[root@smtp Desktop]# chown -R virtual.virtual
/home/virtual
[root@smtp Desktop]# yum install postfix* -y
[root@smtp Desktop]# cd /etc/postfix
[root@smtp postfix]# cp main.cf main.cf-org
[root@smtp postfix]# vim main.cf
Edit The Lines In Last
virtual_alias_maps =
mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:1001
virtual_mailbox_base = /home/virtual
virtual_mailbox_domains =
mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 51200000
virtual_mailbox_maps =
mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 1001
virtual_transport = virtual
virtual_uid_maps = static:1001
#Additional for quota support
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps =
mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the
user's maildir has overdrawn his diskspace quota, please try again
later.
virtual_overquota_bounce = yes
relay_domains =
mysql:/etc/postfix/mysql_relay_domains_maps.cf
mynetworks = 192.168.0.0/24, 127.0.0.0/8
File Save & Quit
[root@smtp postfix]# postalias
hash:/etc/postfix/aliases
[root@smtp postfix]# /etc/init.d/postfix
restart
[root@smtp postfix]# chkconfig postfix on
[root@smtp postfix]# vim
mysql_relay_domains_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT domain FROM domain
WHERE domain='%s' and backupmx = '1'
File save & quit
[root@smtp postfix]# vim
mysql_virtual_mailbox_limit_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT quota FROM mailbox
WHERE username='%s'
File save & quit
[root@smtp postfix]# vim
mysql_virtual_alias_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT goto FROM alias
WHERE address='%s' AND active = 1
File save & quit
[root@smtp postfix]# vim
mysql_virtual_mailbox_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT maildir FROM mailbox
WHERE username='%s' AND active = 1
File save & quit
[root@smtp postfix]# vim
mysql_virtual_domains_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT domain FROM domain
WHERE domain='%s'
#optional query to use when
relaying for backup MX
#query = SELECT domain FROM domain
WHERE domain='%s' and backupmx = '0' and active = '1'
File save & quit
[root@smtp postfix]# cd /etc/authlib
[root@smtp authlib]# cp authmysqlrc
authmysqlrc-org
[root@smtp authlib]# cp authdaemonrc
authdaemonrc-org
[root@smtp authlib]# vim authmysqlrc
And make changes:
MYSQL_SERVER
localhost
MYSQL_USERNAME postfix
MYSQL_PASSWORD postfix
MYSQL_PORT 0
MYSQL_OPT 0
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
#MYSQL_CRYPT_PWFILED crypt
MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD 1001
MYSQL_GID_FIELD 1001
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD
'/home/virtual'
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir
File save & quit
[root@smtp authlib]# vim authdaemonrc
#authmodulelist="authuserdb authpam
authpgsql authldap authmysql authcustom authpipe"
authmodulelist="authmysql"
[root@smtp authlib]# /etc/init.d/httpd restart
[root@smtp authlib]# /etc/init.d/mysqld
restart
[root@smtp authlib]# /etc/init.d/courier-imap
restart
[root@smtp authlib]#
/etc/init.d/courier-authlib restart
[root@smtp authlib]# /etc/init.d/postfix
restart
[root@smtp authlib]# chkconfig httpd on
[root@smtp authlib]# chkconfig mysqld on
[root@smtp authlib]# chkconfig courier-imap on
[root@smtp authlib]# chkconfig courier-authlib
on
[root@smtp authlib]# chkconfig postfix on
[root@smtp authlib]# yum install
system-switch-mail
* -y
[root@smtp authlib]# system-switch-mail
sendmail & postfix ( Select the Postfix )
And ok
( open web browser and use )
URL : =>
http:localhost/mailadmin
Comments
Post a Comment