Cara Install dan Konfigurasi Mail Server di Ubuntu Server 12.04
IP Server: 192.168.56.200
Domain: mawi-server.com
Install DNS Server
1 | sudo apt-get install bind9 |
Konfigurasi DNS Server
1 2 | cd /etc/bind sudo nano named.conf.local |
Tambahkan pada baris paling bawah
1 2 3 4 5 6 7 8 9 10 | zone "mawi-server.com" { type master; file "/etc/bind/db.mawi-server"; }; zone "56.168.192.in-addr.arpa" { type master; notify no; file "/etc/bind/db.56"; }; |
Copy file contoh konfigurasi domain
1 2 | sudo cp db.local db.mawi-server sudo cp db.127 db.56 |
Edit file db.mawi-server
1 | sudo nano db.mawi-server |
Hasilnya
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA mawi-server.com. root.mawi-server.com. ( 2 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS mawi-server.com. @ IN A 192.168.56.200 ns IN A 192.168.56.200 www IN A 192.168.56.200 mail IN A 192.168.56.200 |
1 | sudo nano db.56 |
Hasilnya
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ; ; BIND reverse data file for local loopback interface ; $TTL 604800 @ IN SOA mawi-server.com. root.mawi-server.com. ( 1 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS mawi-server.com. 200 IN PTR mawi-server.com. ns IN PTR 192.168.56.200 www IN PTR 192.168.56.200 mail IN PTR 192.168.56.200 |
Edit file /etc/resolv.conf
1 | sudo nano /etc/resolv.conf |
Tambahkan
1 2 | nameserver 192.168.56.200 search mawi-server.com |
Restart service DNS
1 | sudo /etc/init.d/bind9 restart |
Pengujian domain
1 2 3 4 5 6 7 | nslookup mawi-server.com Server: 192.168.56.200 Address: 192.168.56.200#53 Name: mawi-server.com Address: 192.168.56.200 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | dig mawi-server.com ; <<>> DiG 9.8.1-P1 <<>> mawi-server.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64274 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;mawi-server.com. IN A ;; ANSWER SECTION: mawi-server.com. 604800 IN A 192.168.56.200 ;; AUTHORITY SECTION: mawi-server.com. 604800 IN NS mawi-server.com. ;; Query time: 6 msec ;; SERVER: 192.168.56.200#53(192.168.56.200) ;; WHEN: Sun Mar 16 10:18:06 2014 ;; MSG SIZE rcvd: 63 |
Install Web Server
1 | sudo apt-get install apache2 php5 php5-cgi libapache2-mod-php5 |
Install Mail Server
1 | sudo apt-get install postfix |
Pilih OK
Pilih Internet Site, OK
Pilih OK
System mail name = mawi-server.com
1 | sudo apt-get install courier-imap courier-pop |
Pilih OK
Pilih NO
Set Maildir
1 | sudo maildirmake.courier /etc/skel/Maildir |
Tambah 2 user yang akan digunakan sebagai account email
Saya menambahkan user rms dan linus
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | sudo adduser rms Adding user `rms' ... Adding new group `rms' (1001) ... Adding new user `rms' (1001) with group `rms' ... Creating home directory `/home/rms' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for rms Enter the new value, or press ENTER for the default Full Name []: RMS Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y |
Konfigurasi ulang postfix
1 | sudo dpkg-reconfigure postfix |
Kosongkan saja, OK
Tambahkan mail.mawi-server.com
Pilih NO
Tidak usah diubah, OK
Limit mailbox, 0 = unlimit. OK
Isinya +, OK
Pilih IPv4, OK
Set alamat Mailbox
1 | sudo nano /etc/postfix/main.cf |
Tambahkan pada baris paling bawah
1 | home_mailbox = Maildir/ |
Restart service mail server
1 2 3 | sudo /etc/init.d/postfix restart sudo /etc/init.d/courier-pop restart sudo /etc/init.d/courier-imap restart |
Install aplikasi web mail Squirrelmail
1 | sudo apt-get install squirrelmail |
Koneksikan Apache dan Squirrelmail
1 | sudo nano /etc/apache2/apache2.conf |
Cari baris kode di bawah ini
1 2 3 | # Include module configuration: Include mods-enabled/*.load Include mods-enabled/*.conf |
Tambahkan
1 | Include /etc/squirrelmail/apache.conf |
Edit apache.conf pada squirrelmail
1 | sudo nano /etc/squirrelmail/apache.conf |
Cari baris kode
1 | </Directory> |
Tambahkan di bawahnya
1 2 3 4 | <VirtualHost 192.168.56.200:80> DocumentRoot /usr/share/squirrelmail ServerName mail.mawi-server.com </VirtualHost> |
Restart web server
1 | sudo /etc/init.d/apache2 restart |
Pengujian mail server, login ke squirrelmail dan lakukan pengiriman email
http://mail.mawi-server.com
Login user [email protected]
Mengirim email ke [email protected]
User linus login dan mengecek apakah ada ada email dari user rms
Isi email dari rms kepada linus
selamat mencoba 🙂
Saya menggunakan VPS VUltr, tapi masih gagal.
Apakah DNS perlu juga disetting di cloudflare atau DNS Vultr? ataukah cukup dengan settingan ini saja?
tutorial ini saya tes di local server. gak perlu install DNS server, pakai saja Cloudflare atau Vultr.