How to install Postfix @ Debian 5.0 i686

Requirement

* GNU C Compiler and other small packages required

ervan:~# apt-get install gcc build-essential automake autoconf autoreconf libncurses5-dev g++
ervan:~# apt-get install libdb-devel

* OpenSSL
* CyrusSASL
* Courier Authlib and Courier IMAP

Package

ervan:~# wget ftp://ftp.reverse.net/pub/postfix/official/postfix-2.7.0.tar.gz
ervan:~# tar -zxvf postfix-2.7.0.tar.gz
ervan:~# cd postfix-2.7.0

Creating new user and groups for postfix

ervan:~/postfix-2.7.0# groupadd -g 1001 postfix
ervan:~/postfix-2.7.0# groupadd -g 1002 postdrop
ervan:~/postfix-2.7.0# useradd -u 1001 -g 1001 -G postdrop -d /home/postfix -s /usr/sbin/nologin postfix

Installation

ervan:~/postfix-2.7.0# mkdir /usr/include/openssl/
ervan:~/postfix-2.7.0# cp /usr/local/ssl/include/openssl/* /usr/include/openssl/
ervan:~/postfix-2.7.0# cp /usr/local/ssl/include/mysql/* /usr/include/
ervan:~/postfix-2.7.0# ln -s ./libssl.so.0.9.8 ./libssl.so
ervan:~/postfix-2.7.0# ln -s ./libcrypto.so.0.9.8 ./libcrypto.so
ervan:~/postfix-2.7.0# 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/lib64 -lssl -lcrypto -lsasl2'
ervan:~/postfix-2.7.0# make && make install


Configuration

ervan:~/postfix-2.7.0# nano /etc/postfix/main.cf
soft_bounce = no
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
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
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
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
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.unix-shell.org
mynetworks = 208.99.198.181, 127.0.0.1
html_directory = no
setgid_group = postdrop
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
home_mailbox = Maildir/

Starting the Daemon

ervan:~/postfix-2.7.0# postmap /etc/postfix/canonical
ervan:~/postfix-2.7.0# postmap /etc/postfix/access
ervan:~/postfix-2.7.0# postmap /etc/postfix/aliases
ervan:~/postfix-2.7.0# nano /etc/postfix/virtual
unix-shell.org                     virtual
ervan@unix-shell.org                  ervan
admin@unix-shell.org                  admin
ervan:~/postfix-2.7.0# postmap /etc/postfix/virtual
ervan:~/postfix-2.7.0# postmap /etc/postfix/relocated
ervan:~/postfix-2.7.0# postmap /etc/postfix/transport
ervan:~/postfix-2.7.0# postfix set-permission
ervan:~/postfix-2.7.0# postfix start

The Test
Open your command prompt then telnet to your postfix mail server

D:\>telnet unix-shell.org 25
220 mail.unix-shell.org ESMTP Postfix
ehlo ervan
250-mail.unix-shell.org
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye

Connection to host lost.

Category: Linux | Tags: , , , , , , , , , , , , Comment »


Leave a Reply



Back to top