Minggu, 12 Februari 2012

Membuat mail server POSTFIX di fedora

Instalasi BIND ( DNS Server )

1. Cek terlebih dahulu paket-paket yang harus terinstal di komputer anda dengan cara :
[root@linux root]# rpm -qa |grep bind
bind-libs-9.2.3-13
system-config-bind-2.0.2-5
bind-utils-9.2.3-13
ypbind-1.17.2-1
bind-9.2.3-13

2. Setting DNS
# vi /etc/named.conf
options {
directory “/etc”;
pid-file “/var/run/named/named.pid”;
};

zone “.” {
type hint;
file “/etc/db.cache”;
};

zone “linuxsite.com” {
type master;
file “/var/named/linuxsite.com.hosts”;
};
zone “anakjayapura07.com” {
type master;
file “/var/named/anakjayapura07.com.hosts”;
};
zone “7.168.192.in-addr.arpa” {
type master;
file “/var/named/192.168.7.rev”;
};

3. Setting zone yang telah anda buat, kalo saya buatnya anakjayapura07.com.hosts
# vi /var/named/anakjayapura07.com.hosts

$ttl 38400
anakjayapura07.com. IN SOA linux.anakjayapura07.com. admin@.anakjayapura07.com. (
1220975691 ; serial
10800 ; refresh
3600 ; retry
604800 ; expire
38400 ; minimum
)
anakjayapura07.com. IN NS linux.anakjayapura07.com.
linux.anakjayapura07.com. IN A 192.168.7.51
mx.anakjayapura07.com. IN A 192.168.7.51
mail.anakjayapura07.com. IN CNAME mx.anakjayapura07.com
anakjayapura07.com. IN MX 10 mx.anakjayapura07.com

# vi /var/named/192.168.7.rev

$ttl 38400
7.168.192.in-addr.arpa. IN SOA linux.anakjayapura07.com. admin@.anakjayapura07.com. (
1220975740 ; serial
10800 ; refresh
3600 ; retry
604800 ; expire
38400 ; minimum
)
7.168.192.in-addr.arpa. IN NS linux.anakjayapura07.com.
51.7.168.192.in-addr.arpa. IN PTR linux.anakjayapura07.com.
51.7.168.192.in-addr.arpa. IN PTR mx.anakjayapura07.com.

Restart service BIND
/etc/init.d/named restart

Untuk memastikan dns sudah jalan dapat mengecek dengan mengetikan sbb:
[root@linux root]# nslookup -sil
> set type=any
> anakjayapura07.com
Server: 192.168.7.50
Address: 192.168.7.50#53
anakjayapura07.com mail exchanger = 10 mx.anakjayapura07.com.anakjayapura07.com.
anakjayapura07.com
origin = linux.anakjayapura07.com
mail addr = admin@anakjayapura07.com
serial = 1220975691
refresh = 10800
retry = 3600
expire = 604800
minimum = 38400
anakjayapura07.com nameserver = linux.anakjayapura07.com.

4. Untuk memastikan komputer anda menggunakan DNS Server yang sudah diatur maka gunakan cara:
#vi /etc/resolv.conf

domain anakjayapura07.com
nameserver 192.168.7.50
ip publicànameserver 125.166.104.60

Restart service Bind
/etc/ini.d/named restart

Instalasi Postfix (SMTP)

Cek terlebih dahulu paket postfixnya dengan mengetikan perintah sbb:
[root@linux root]# rpm -qa |grep postfix
postfix-2.0.18-4

1. Setting pengaturan postfixnya di
#vi /etc/postfix/main.cf
#soft_bounce = no
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
#default_privs = nobody
myhostname = linux.anakjayapura07.com
#myhostname = virtual.domain.tld
mydomain = anakjayapura07.com
myorigin = $myhostname
#myorigin = $mydomain
inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost
#proxy_interfaces =
#proxy_interfaces = 1.2.3.4
#mydestination = $myhostname, localhost.$mydomain
#mydestination = $myhostname, localhost.$mydomain $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# mail.$mydomain, www.$mydomain, ftp.$mydomain

#local_recipient_maps = unix:passwd.byname $alias_maps
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
#local_recipient_maps =
unknown_local_recipient_reject_code = 550
#unknown_local_recipient_reject_code = 450
#mynetworks_style = class
mynetworks_style = subnet
#mynetworks_style = host
#mynetworks = 168.100.189.0/28, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table
mynetworks = 192.168.7.0/24, 127.0.0.0/8
#relay_domains = $mydestination
#relayhost = $mydomain
#relayhost = gateway.my.domain
#relayhost = uucphost
#relayhost = [an.ip.add.ress]
#relay_recipient_maps = hash:/etc/postfix/relay_recipients
#in_flow_delay = 1s
#alias_maps = dbm:/etc/aliases
alias_maps = hash:/etc/postfix/aliases
#alias_maps = hash:/etc/aliases, nis:mail.aliases
#alias_maps = netinfo:/aliases
#alias_database = dbm:/etc/aliases
#alias_database = dbm:/etc/mail/aliases
#alias_database = hash:/etc/aliases
#alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
#recipient_delimiter = +
#home_mailbox = Mailbox
home_mailbox = ./Maildir/
#mail_spool_directory = /var/mail
#mail_spool_directory = /var/spool/mail
#mailbox_command = /some/where/procmail
#mailbox_command = /some/where/procmail -a “$EXTENSION”
#mailbox_transport = lmtp:unix:/file/name
#mailbox_transport = cyrus
#fallback_transport = lmtp:unix:/file/name
#fallback_transport = cyrus
#fallback_transport =
#luser_relay = $user@other.host
#luser_relay = $local@other.host
#luser_relay = admin+$local
luser_relay = admin@
#header_checks = regexp:/etc/postfix/header_checks
#fast_flush_domains = $relay_domains
#fast_flush_domains =
#smtpd_banner = $myhostname ESMTP $mail_name
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
#local_destination_concurrency_limit = 2
#default_destination_concurrency_limit = 20
debug_peer_level = 2
#debug_peer_list = 127.0.0.1
#debug_peer_list = some.domain
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.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.0.18/samples

# readme_directory: The location of the Postfix README files.
############################################################################

readme_directory = /usr/share/doc/postfix-2.0.18/README_FILES
alias_database = hash:/etc/postfix/aliases
mail_spool_directory = /var/mail
smtpd_banner = $myhostname ESMTP $mail_name
smtp_sasl_auth_enable = no
smtpd_sasl_auth_enable = no
smtpd_use_tls = no
smtp_use_tls = no
mailbox_size_limit = 0
message_size_limit = 10240000
disable_dns_lookups = no

#defer_transports = smtp
#smtp_sasl_auth_enable = yes
#smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
#canonical_maps = hash:/etc/postfix/canonical
#relocated_maps = hash:/etc/postfix/relocated
#transport_maps = hash:/etc/postfix/transport
#sender_canonical_maps = hash:/etc/postfix/sender_canonical
#smtpd_sender_restrictions = hash:/etc/postfix/access
#masquerade_exceptions = root
#masquerade_classes = envelope_sender, header_sender, header_recipient
#smtpd_helo_required = no
#strict_rfc821_envelopes = no
#smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination

Cara buat Mailing List di Postfix
setting sesuai yg di inginkanàEdit vi /etc/postfix/aliases

2. Sebelum menjalankan postfix anda harus mematikan service dari sendmail dengan cara
# /etc/init.d/sendmail stop atau bisa juga menghapus paket sendmail yang sebelumnya sudah terinstall cara sbb.
rpm -e –nodeps sendmail

Restart service Postfix nya
# /etc/init.d/postfix restart

3. Untuk memastikan bahwa postfix telah berjalan, kita coba telnet pada port SMTP
#telnet localhost 25
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 linux.anakjayapura07.com ESMTP Postfix
helo anakjayapura07.com
250 linux.anakjayapura07.com
mail from:putri@anakjayapura07.com
250 Ok
rcpt to:admin@anakjayapura07.com
250 Ok
data
354 End data with .
subject: test kirim email
hai test mail ya dari admin
yes masuk
.
250 Ok: queued as 6C0121BE5C
quit
221 Bye
Connection closed by foreign host.

Instalasi Dovecot (POP3/IMAP)

Cek terlebih dahulu paket dovecot dengan mengetikan perintah sbb:
[root@linux root]# rpm -qa |grep dovecot
dovecot-0.99.10.4-4
1. Sesudah itu anda atur POP3 dan IMAP, untuk itu kita gunakan program dovecot
#vi /etc/dovecot.conf
protocols = imap imaps pop3 pop3s
disable_plantext_auth = no

Setelah itu restart service dovecotnya dengan cara :
/etc/init.d/dovecot restart

Jangan lupa untuk membuat user baru, dimana user tersebut akan langsung dibuatkan di mailboxnya, dengan cara:

useradd admin
passwd admin
Changing password for user admin.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Untuk memastikan bahwa Dovecot telah berjalan, kita coba telnet pada port 110

# telnet localhost 110
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
+OK dovecot ready.
user admin@
+OK
pass admin@
+OK Logged in.
list
+OK 1 messages:
1 471
.
retr 1
+OK 471 octets
Return-Path:
X-Original-To: admin@anakjayapura07.com
Delivered-To: admin@anakjayapura07.com
Received: from linux.anakjayapura07.com (linuxer.anakjayapura07.com [127.0.0.1])
by linuxer.anakjayapura07.com (Postfix) with SMTP id 852FE17832
for ; Thu, 2 Oct 2011 18:49:29 +0700 (WIT)
subject:test ya
Message-Id:
Date: Thu, 2 Oct 2011 18:49:29 +0700 (WIT)
From: admin@@anakjayapura07.com
To: undisclosed-recipients:;
.
quit
+OK Logging out.
Connection closed by foreign host.
……….

Instalasi Squirrelmail

Untuk menginstalasi paket squirrelamail Anda bisa langsung mengcopy paket squirrelmail-1.4.15.tar.gz ke directory /var/www/html
lalu extrak difilenya
# tar -xzvf squirrelmail-1.4.15.tar.gz
# mv squirrelmail-1.4.15 webmail
# cd /webmail/config
# ./config.pl

Rubah lah sesuai dengan keinginan anda :

SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Main Menu –
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers
C Turn color on
S Save data
Q Quit

Untuk memberikan hak akses untuk group dan user apache dapat mengetikan perintah sbb :

# chown -R nobody.nobody /usr/apps/htdocs/webmail
# chown -R nobody.nobody /usr/apps/htdocs/webmail/data

Jangan lupa buat file attachment
# mkdir /var/attach
# chown -R nobody.nobody /var/attach

Selamat Anda telah memiliki Server Email yang dapat di pakai untuk kirim dan terima E-mail,selamat mencoba tutorial singkat dari saya semoga tutorial ini membatu heeee.Maju trus open source Indonesia

Tidak ada komentar:

Posting Komentar