Install Postfix Sebagai Mail Gateway di Freebsd 6.3/7.0

By | September 11, 2008

Mail server penting juga yah, kemaren mau bikin blog dari wordpress eh ternyata butuh tuh mail server. padahal server yang di pake ada di DMZ area. repot juga.
Tapi tenang aja pasti ada jalan 🙂

saya coba install postfix mail server, satu di webserver yang ada mu-wordpressnya dan satu di install di model networknya semacam ini :

Internet
|
|

Router (192.168.13.1)
install postfix sebagai mail gateway
|
|
Webserver (ip local- 192.168.13.13) install postfix

Install Postfix

Sebelumnya disable dulu sendmail :
1. Disable starting sendmail on boot:
# echo ‘sendmail_enable=”NONE”‘ >> /etc/rc.conf

2. Disable sendmail’s daily cron jobs dengan menambahkan baris berikut di /etc/periodic.conf:

daily_clean_hoststat_enable=”NO”
daily_status_mail_rejects_enable=”NO”
daily_status_include_submit_mailq=”NO”
daily_submit_queuerun=”NO”

install postfix melalui port agar mudah and cepat :

# cd /usr/ports/mail/postfix-current
# make install clean

jangan lupa habis selesai install ketik
#rehash
# echo ‘postfix_enable=”YES”‘ >> /etc/rc.conf

Setting postfix di router sebagai mail gateway

Konfigurasi postfix ada di file

jangan lupa habis selesai install ketik
#rehash
# echo ‘postfix_enable=”YES”‘ >> /etc/rc.conf

Update the aliases db:
# /usr/local/bin/newaliases

Setting postfix di router sebagai mail gateway

Konfigurasi postfix ada di file /usr/local/etc/postfix/main.cf. edit bagian berikut :

myhostname = hero.uns.ac.id
mydomain = hero.uns.ac.id
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 192.168.13.0/24, 127.0.0.0/8

Setting postfix yang ada di webserver

myhostname = blog.hero.uns.ac.id
mydomain = blog.hero.uns.ac.id
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 192.168.13.0/24, 127.0.0.0/8
relayhost = [192.168.13.1]

Selanjutnya Start postfix:
#/usr/local/etc/rc.d/postfix.sh start

Untuk test apakah mail server udah jalan apa belum dengan cara sebagai berikut :

#telnet <servername> 25

helo <your domain name><enter>

250 OK

mail from: <your Email Address><enter>

250 OK – mail from <your Email address>

rcpt to: <recipient address><enter>

250 OK – Recipient <recipient address>

data<enter>
response should be as follows
354 Send data.  End with CRLF.CRLF

To: <recipient’s display name><enter>
From: <your display name><enter>
Subject: <Subject field of Email message><enter>
<Enter you body text><enter><enter> . <enter>
response should be as follows
250 OK

quit<enter>

selamat mencoba 🙂