==================================================================== CARA MENGINSTALL POSTFIX ==================================================================== Setting up DNS ------------------------------------------------ Type Host Destination Priority TTL MX @ mail.yourdomain.com 10 3600 A mail 3600 2. Masukkan perintah berikut : yum -y update hostname mail.yourdomain.com nano /etc/hosts Tambahkan di bawah : mail.yourdomain.com yum -y install postfix mkdir /etc/postfix/ssl cd /etc/postfix/ssl yum -y install openssl ------------------------------------------------ openssl req -x509 -nodes -newkey rsa:2048 -keyout server.key -out server.crt -nodes -days 365 ------------------------------------------------ Generating a 2048 bit RSA private key ..........................+++ ...........................+++ writing new private key to 'server.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:US State or Province Name (full name) []:New York Locality Name (eg, city) [Default City]: Organization Name (eg, company) [Default Company Ltd]: Organizational Unit Name (eg, section) []:My Unit Common Name (eg, your name or your server's hostname) []:localhost Email Address []:admin@localhost ------------------------------------------------ nano /etc/postfix/main.cf Tambahkan di bawah : myhostname = mail.yourdomain.com mydomain = yourdomain.com myorigin = $mydomain home_mailbox = mail/ mynetworks = 127.0.0.0/8, , [::1]/128 <==== SANGAT PENTING, TAMBAHKAN IP ADDRESS VPS inet_interfaces = all inet_protocols = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_local_domain = smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_sasl_auth_enable = yes smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination smtp_tls_security_level = may smtpd_tls_security_level = may smtp_tls_note_starttls_offer = yes smtpd_tls_loglevel = 1 smtpd_tls_key_file = /etc/postfix/ssl/server.key smtpd_tls_cert_file = /etc/postfix/ssl/server.crt smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s tls_random_source = dev:/dev/urandom ------------------------------------------------ MENAMBAHKAN DOMAIN VIRTUAL ------------------------------------------------ nano /etc/postfix/main.cf #virtual_alias_domains = domain1.com domain2.com domain3.com etc. virtual_alias_domains = hash:/etc/postfix/virtual_domains virtual_alias_maps = hash:/etc/postfix/virtual nano /etc/postfix/virtual_domains ## Tambahkan : mydomain.com #domain myotherdomain.com #domain etc... nano /etc/postfix/virtual ## Tambahkan : @mydomain.com andrian@gmail.com @myotherdomain.com agus@gmail.com etc... postmap /etc/postfix/virtual_domains; postmap /etc/postfix/virtual ------------------------ nano /etc/postfix/master.cf smtp inet n - n - - smtpd submission inet n - n - - smtpd -o syslog_name=postfix/submission -o smtpd_sasl_auth_enable=yes -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING smtps inet n - n - - smtpd -o syslog_name=postfix/smtps -o smtpd_sasl_auth_enable=yes -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING ## Catatan : -o harus ada spasi di depannya ------------------------------------------------ INSTALL DOVECOT ------------------------------------------------ yum -y install dovecot nano /etc/dovecot/conf.d/10-master.conf ## Cari bagian # Postfix smtp-auth ## Tambahkan : # Postfix smtp-auth unix_listener /var/spool/postfix/private/auth { mode = 0666 user = postfix group = postfix } nano /etc/dovecot/conf.d/10-auth.conf ## Cari bagian : auth_mechanisms = plain ## Ganti menjadi : auth_mechanisms = plain login nano /etc/dovecot/conf.d/10-mail.conf ## Cari bagian : #mail_location = ## Ganti menjadi : mail_location = maildir:~/mail nano /etc/dovecot/conf.d/20-pop3.conf ## Cari bagian : #pop3_uidl_format = %08Xu%08Xv ## Buang tanda # menjadi pop3_uidl_format = %08Xu%08Xv postmap /etc/postfix/virtual; postmap /etc/postfix/virtual_domains; postfix reload systemctl restart postfix; systemctl restart dovecot ------------------------------------------------ TESTING KIRIM EMAIL ------------------------------------------------ telnet mail.hunianrumah.com smtp mail from:ardi@cubbying.com rcpt to:xiojin@gmail.com data Subject: Ini adalah ardi Ini adalah isi pesan. . quit ------------------------------------------------ BACA LOG ------------------------------------------------ nano /var/log/maillog echo > /var/log/maillog ------------------------------------------------ DAFTAR FILE PENTING ------------------------------------------------ nano /etc/postfix/main.cf nano /etc/postfix/master.cf nano /etc/dovecot/dovecot.conf ------------------------------------------------ ## Sintaks mynetworks = mynetworks = 127.0.0.0/8, 123.45.56.78, [::1]/128 123.45.56.78 ganti menjadi IP Address VPS kita ------------------------------------------------ ------------------------------------------------ ------------------------------------------------