Вы находитесь на странице: 1из 11

Mail Server Installation

first time [root@mail~]# alternatives --config mta (and postfix select)

1. Installation of PostfixAdmin:

a-) Download postfixadmin.tar file & Untar that file in


/var/www/html/postfixadmin

Make a directory in /var/www/html


[root@mail~]# cd /var/www/html
[root@mail~]# mkdir postfixadmin
[root@mail~]# cd postfixadmin
#cp Desktop/postfixadmin-*.tar.gz /var/www/html/posfixadmin
tar -xvf postfixadmin-*.tar.gz
[root@mail~]# cd postfixadmin-*

Rename that file--

[root@mail~]# cp config.inc.php.sample config.inc.php.sample_org

[root@mail~]# mv config.inc.php.sample config.inc.php

[root@mail~]# cp setup.php setup.php_org

b-) open config.inc.php & edit following lines:

[root@mail~]# vi config.inc.php
And change these lines

$CONF['admin_email'] = 'postmaster@eta.in';
$CONF['encrypt'] = 'cleartext';(make it cleartext)
'abuse' => 'postmaster@eta.in',
'hostmaster' => 'postmaster@eta.in', (note: here era.in is your domain
naume)
'postmaster' => 'postmaster@eta.in',
'webmaster' => 'postmaster@eta.in'
$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'YES';
$CONF['vacation_domain'] = 'autoreply.change-this-to-your.domain.tld';
$CONF['footer_text'] = 'www.keenable.in';
$CONF['footer_link'] = 'www.keenable.in';

$CONF['show_footer_text'] = 'NO';

c-) go to templates directory:


cd templates

[root@mail~]# cd templates
[root@mail~]# copy header.tpl & footer.tpl
[root@mail~]# cp header.tpl header.tplold
[root@mail~]#cp footer.tpl footer.tplold

edit header.tpl
[root@mail~]# vi header.tpl
and make changes:

<title>Eta Mail Admin - <?php print $_SERVER['HTTP_HOST']; ?></title>

comment these lines ( // )

// print "<img id=\"login_header_logo\" src=\"images/postfixadmin2.png\" />\n";

// print "<img id=\"login_header_logo\" src=\"../images/postfixadmin2.png\"


/>\n";

save & quit

edit footer.tpl
[root@mail~]# vi footer.tpl

remove all lines except these lines

</body>
</html>
d-) Create Sql postfix Database:
be in the same directory

[root@mail~]# mysqladmin password "postfix"


[root@mail~]# mysql -u root -p < DATABASE_MYSQL.TXT

e-) create a admin user:


give the URL: http://localhost/postfixadmin
setup (hyperlink)
admin section (hyperlink)
add a domain through new domain
when creating domain make aliases & Mailboxes 0(Zero), zero means unlimited
users & aliases.
click on Add default mail aliases:
dont click on Mail server is backup MX:
add a admin through New admin
check your admin through Admin list
Now your admin is created.

[root@mail~]# cd /var/www/html/postfixadmin/postfixadmin-*

Rename setup.php

[root@mail~]# mv setup.php setup.phpold

2) Create users for mailing:

open web browser & type:

http://localhost/postfixadmin
login (enter admin username & password)

now go to add mailbox to create new users

==>postfix upgradation (compile with mysql & sasl)


change to any user & make rpm related build directories
[root@mail~]# useradd post
[root@mail~]# passwd post
Download URL -http://postfix.wl0.org/ftp/official/2.4/SRPMS/postfix-2.4.5-
3.src.rpm

[root@mail~]# cp Desktop/postfix-2.4.5-3.src.rpm /home/post


[root@mail~]# chown post.post /home/post/postfix-2.4.5-3.src.rpm
[root@mail~]#su - post

[post@mail~]$ mkdir rpm


[post@mail~]$ mkdir rpm/SOURCES
[post@mail~]$ mkdir rpm/SPECS
[post@mail~]$ mkdir rpm/BUILD
[post@mail~]$ mkdir rpm/SRPMS
[post@mail~]$ mkdir rpm/RPMS
[post@mail~]$ mkdir rpm/RPMS/i386

[post@mail~]$ echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros

install source rpm

[post@mail~]$ rpm -ivh postfix-2.4.5-3.src.rpm

[post@mail~]$ cd /home/post/rpm/SPECS

[post@mail~]$ vi postfix.spec
(Make changed on following line like this--line 86 & 89)

%define with_mysql_redhat 1
%define with_sasl 2

and find 'rhel-4' to change 'rhel-5' and 'rhel4' to 'rhel5'


then save & quit

[post@mail~]$ rpmbuild -ba postfix.spec

it will make postfix rpms to /home/post/rpm/RPMS/i386 directory


then logout through user & login through root & go to RPMS directory & run
Command

[post@mail~]$ su - root

[root@mail~]# cd /home/post/rpm/RPMS/i386

[root@mail~]# rpm -Uivh postfix-2.4.5-3.rhel5.i386.rpm

(Then check with the following command that postfix is compiled with mysql)

[root@mail~]# postconf -m ( it should show mysql)

4) Installation 0f Courier-imap (Its better to uninstall cyrus-imap before installing


this)

Download Courier-imap: courier-imap-4.1.1.tar.bz2

http://easynews.dl.sourceforge.net/sourceforge/courier/courier-imap-
4.1.1.tar.bz2

[root@mail~]# cd Desktop
[root@mail~]# cp Desktop/courier-imap-4.1.1.tar.bz2 /home/post
[root@mail~]# chown post.post /home/post/courier-imap-4.1.1.tar.bz2

Download Courier-authlib: courier-authlib-0.58.tar.bz2

http://easynews.dl.sourceforge.net/sourceforge/courier/courier-authlib-0.58.tar.bz2

[root@mail~]# cp courier-authlib-0.58.tar.bz2 /home/post


[root@mail~]# chown post.post /home/post/courier-authlib-0.58.tar.bz2
[root@mail~]# su - post

[post@mail~]$ rpmbuild -ta courier-authlib-0.58.tar.bz2

become root & go to this directory


[post@mail~]$ su - root
[root@mail~]# cd /home/post/rpm/RPMS/i386

[root@mail~]# rpm -ivh courier-authlib-0.58-1.5Server.i386.rpm


[root@mail~]# rpm -ivh courier-authlib-devel-0.58-1.5Server.i386.rpm
[root@mail~]# rpm -ivh courier-authlib-mysql-0.58-1.5Server.i386.rpm

now again become normal user


[root@mail~]# su - post
#su - post

Run this command:

[post@mail~]$ tar -jxvf courier-imap-4.1.1.tar.bz2


[post@mail~]$ cd courier-imap-4.1.1
[post@mail~]$ vi courier-imap.spec (make 55 & 57 line like this to remove fam
support)

BuildPreReq: rpm >= 3.0.5 /usr/bin/sed openldap2 openldap2-devel


%else
BuildPreReq: rpm >= 4.0.2 sed openldap-devel openldap-servers
%endif

save & quit


copy this spec to SPECS directotry

[post@mail~]$ cp courier-imap.spec /home/post/rpm/SPECS/

copy courier-imap bz2 file to SOURCES directory.

[post@mail~]$ cp courier-imap-4.1.1.tar.bz2 /home/post/rpm/SOURCES

[post@mail~]$ cd /rpm/SPECS/

[post@mail~]$ rpmbuild -ba courier-imap.spec

now become root & go to RPMS & install all related rpms through root:
[post@mail~]$ su - root
[root@mail~]# cd /home/post/rpm/RPMS/i386
[root@mail~]# rpm -ivh courier-imap-4.1.1-1.5Server.i386.rpm

====>create a user virtual


[root@mail~]# useradd virtual

change the permission 777 to /home/virtual

[root@mail~]# chmod -R 777 /home/virtual/

[root@mail~]# chown virtual.virtual /home/virtual

edit /etc/passwd file

[root@mail~]# vi /etc/passwd

virtual:x:1001:1001::/home/virtual:/bin/bash

edit /etc/group

[root@mail~]# vi /etc/group

virtual:x:1001:

5) make changes in main.cf add:-

[root@mail~]# cd /etc/postfix
[root@mail~]# cp main.cf main.cf_org
[root@mail~]# vi main.cf

Add these line in the end of file :

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

relayhost = mail.keenable.com

( if not global server)


save & close the file

[root@mail~]# postmap hash:/etc/postfix/aliases

[root@mail~]# service postfix restart

6) we have to make these files in /etc/postfix directory:

[root@mail~]#vi mysql_relay_domains_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT domain FROM domain WHERE domain='%s' and backupmx
= '1'

[root@mail~]# vi mysql_virtual_mailbox_limit_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT quota FROM mailbox WHERE username='%s'

[root@mail~]# vi mysql_virtual_alias_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT goto FROM alias WHERE address='%s' AND active = 1

[root@mail~]# vi mysql_virtual_mailbox_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT maildir FROM mailbox WHERE username='%s' AND active
=1

[root@mail~]# vi 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'

8) make changes in /etc/authlib/authmysqlrc:


[root@mail~]# cd /etc/authlib
[root@mail~]# cp authmysqlrc authmysqlrc_org
[root@mail~]# vi 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

9) make changes in /etc/authlib/authdaemonrc


[root@mail~]# cp authdaemonrc authdaemonrc_org
[root@mail~]# vi authdaemonrc

change this line:-


authmodulelist="authuserdb authpam authpgsql authldap authmysql
authcustom authpipe"
TO
authmodulelist="authmysql"

Save & quit

10) to fetch the mails of user in case its not global server.

vi /root/.fetchmailrc

edit:
set logfile /var/log/fetchmail.log
poll mail.keenable.in proto POP3

user "amit@keenable.com" there with password "pass" is


"amit@keenable.com" here

# if you have 2 domains:

poll mail.aimsintl.in proto POP3

user "amit@gmail.com" there with password "pass" is "amit@keenable.com"


here

Вам также может понравиться