Pengen Punya WebSite instan kualitas intan ?

Friday, July 9, 2010

Install And Configure Postfix with Courier-Authlib and Courier-Imap OpenSUSE 11.1 X86_64 O/S

Install C Compiler and Dependencies
zypper -i gcc gcc-c++ ncurses-devel pam-devel automake gettext-tools db1  db43 db43-devel libdb-* libopenssl-devel*

Edit ld.so.conf and add 1 lines below
#vi /etc/ld.so.conf

## add few lines below in the end of file ##
/usr/local/include
/usr/local/ssl/lib/
/usr/local/mysql/lib/mysql
/usr/local/mysql/include
/usr/local/ssl/include/openssl
/usr/local/ssl/include
/usr/include
/usr/include/openssl

Reload with ldconfig
ldconfig

Install Cyrus-SASL
tar -zxvf cyrus-sasl-2.1.23.tar.gz

cd cyrus-sasl-2.1.23

./configure  --enable-anon --enable-plain --enable-login --enable-sql \
--disable-krb4  --disable-otp --disable-cram --disable-digest \
--with-mysql=/usr/local/mysql/lib/mysql  --without-pam --without-saslauthd \
--without-pwcheck --prefix=/usr  --with-plugindir=/usr/lib/sasl2

make -j2; make install

Note :
if you have any problem with cyrus-sasl you can export 2 lines below and try to configure again.
export  CPPFLAGS="-I/usr/local/mysql/include/mysql"
export  LDFLAGS="-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm"

Install Courier-Authlib


wget http://nchc.dl.sourceforge.net/project/courier/authlib/0.63.0/courier-authlib-0.63.0.tar.bz2
tar -jxvf courier-authlib-0.63.0.tar.bz2
cd  courier-authlib-0.63.0
./configure --with-authshadow
make  && make install

Edit authdaemonrc
cd /usr/local/etc/authlib/
cp  authdaemonrc.dist authdaemonrc

vi authdaemonrc

#### Modify 2  lines below ####

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

### To  ###

authmodulelist="authshadow"
authmodulelistorig="authshadow"

Create smtpd.conf
cd /usr/lib/sasl2

vi  smtpd.conf

pwcheck_method: authdaemond
log_level: 3
mech_list:  PLAIN LOGIN
authdaemond_path:/usr/local/var/spool/authdaemon/socket

Create Symlink to /usr/lib64/sasl2
cd /usr/lib64/sasl2
ln  -s /usr/lib/sasl2/smtpd.conf smtpd.conf

Create Symlink OPENSSL
cd /usr/include/sasl
ln  -s /usr/local/ssl/include/openssl openssl

Installing Postfix

sebelum install postfix dari source, pastikan postfix yang dari paket rpm bawaan default di uninstall terlebih dahulu
wget ftp://ftp.reverse.net/pub/postfix/official/postfix-2.7.0.tar.gz
tar -zxvf postfix-2.7.0.tar.gz
cd postfix-2.7.0
groupadd -g  1001 postfix
groupadd -g 1002 postdrop
useradd -u 1001 -g 1001  -G postdrop -d /home/postfix -s /usr/sbin/nologin postfix
make  makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql  -DUSE_SASL_AUTH -DUSE_TLS -DUSE_CYRUS_SASL -I/usr/include/sasl'  'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -L/usr/lib  -lssl -lcrypto -lsasl2'
make && make install

Change Owner and Group To Postfix
cd  /usr/local/var/spool
chown  -R postfix:postfix authdaemon

Edit Postfix main.cf

cd /etc/postfix
vi main.cf

soft_bounce  = no
queue_directory = /var/spool/postfix
command_directory =  /usr/sbin
#daemon_directory = /usr/lib/postfix
mail_owner =  postfix
default_privs = nobody
inet_interfaces = all
unknown_local_recipient_reject_code  = 450
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path  = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path  = /usr/bin/mailq
#setgid_group = maildrop
manpage_directory =  /usr/share/man
sample_directory =  /usr/share/doc/packages/postfix/samples
readme_directory =  /usr/share/doc/packages/postfix/README_FILES
mail_spool_directory =  /var/mail
canonical_maps = hash:/etc/postfix/canonical
virtual_maps  = hash:/etc/postfix/virtual
relocated_maps =  hash:/etc/postfix/relocated
transport_maps =  hash:/etc/postfix/transport
sender_canonical_maps =  hash:/etc/postfix/sender_canonical
masquerade_exceptions = root
masquerade_classes  = envelope_sender, header_sender, header_recipient
#program_directory  = /usr/lib/postfix
masquerade_domains =
mydestination =  $myhostname, localhost.$mydomain
defer_transports =
disable_dns_lookups  = no
relayhost =
content_filter =
mailbox_command =
smtpd_sender_restrictions  = hash:/etc/postfix/access
smtpd_client_restrictions =
smtpd_helo_required  = no
smtpd_helo_restrictions =
strict_rfc821_envelopes = no
mynetworks_style  = subnet
smtpd_recipient_restrictions =  permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
#smtpd_recipient_restrictions  = permit_sasl_authenticated,reject_unauth_destination
smtp_sasl_auth_enable  = no
smtpd_sasl_auth_enable = yes
smtpd_use_tls = no
smtp_use_tls  = no
alias_maps = hash:/etc/aliases
mailbox_size_limit = 0
message_size_limit  = 10240000
myhostname = mail.commands.org.uk
mynetworks = 208.99.198.***,  127.0.0.1
html_directory = no
setgid_group = postdrop
daemon_directory  = /usr/libexec/postfix
data_directory = /var/lib/postfix
home_mailbox  = Maildir/

Edit Postfix Virtual File

cd /etc/postfix
vi  virtual

commands.org.uk                             virtual
prayoga@commands.org.uk                     prayoga
<enter>
<enter>
jan.co.uk                                   virtual
testing@jan.co.uk        testing

Postmap All Postfix Config

cd /etc/postfix
postmap virtual
postmap  access
postmap canonical
postmap relocated
postmap  sender_canonical
postmap transport

Starting Up Postfix

postfix start

Starting Up Courier-Authlib

/usr/local/sbin/authdaemond   start

Buat user
#yast
- security and users
-  edit and create users
- add
- create the users
Example : prayoga

Installing Courier-Imap


Su with normal user

ex : prayoga
su prayoga
cd /home/prayoga
wget http://superb-sea2.dl.sourceforge.net/project/courier/imap/4.7.0/courier-imap-4.7.0.tar.bz2
tar -jxvf courier-imap-4.7.0.tar.bz2
cd courier-imap-4.7.0
./configure

Exit su testing and make with root

exit
make  && make install
make install-configure

Edit imapd
cd /usr/lib/courier-imap/etc
vi imapd

#### modify few lines below ###
#### Change it from 1 to 0

IMAP_MAILBOX_SANITY_CHECK=0

###  change it from no to yes ###

IMAPDSTART=YES

Starting up Courier-Imap

/usr/lib/courier-imap/libexec/imapd.rc  start

Membuat Maildir pada Home User [ Not necessary because if you set your mailserver up and running. Maildir should be automatically created in your home dir /home/prayoga/Maildir ]

Example :
user : prayoga
Homedir : /home/prayoga
su - prayoga
/usr/lib/courier-imap/bin/maildirmake  /home/prayoga/Maildir

View Log for Troubleshooting Purpose

tail -f  /var/log/mail
tail -f /var/log/mail.err
tail -f  /var/log/messages

Add postfix, courier-authlib and courier-imap to boot.local
vi /etc/init.d/boot.local

/usr/sbin/postfix  start

## add these line into boot.local
/usr/local/sbin/authdaemond start
/usr/lib/courier-imap/libexec/imapd.rc  start

Testing

Test postfix:

yoga:~ # telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.commands.org.uk ESMTP Postfix
mail from:tes@commands.org.uk
250 2.1.0 Ok
rcpt to:yoga@swiftco.net
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
sekedar tes untuk pengiriman
jika terkirim berarti,
instalasi dan konfigurasi postfix berhasil

.
250 2.0.0 Ok: queued as 35C891D18203
quit
221 2.0.0 Bye
Connection closed by foreign host.

Test IMAP :

yoga:~ # telnet localhost 143
Trying ::1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2008 Double Precision, Inc.  See COPYING for distribution information.
a login prayoga passwd*****
a OK LOGIN Ok.
a select inbox
* FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\* \Draft \Answered \Flagged \Deleted \Seen)] Limited
* 4 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1278621241] Ok
* OK [MYRIGHTS "acdilrsw"] ACL
a OK [READ-WRITE] Ok
a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host.

1 comments:

Install Webmail (SquirrelMail) | coretan dinding said...

[...] Sebelum install SquirrelMail, pastikan mail server anda sudah siap, jika belum bisa cek di sini. [...]

Post a Comment