Mail Server Debian 13: Perbedaan antara revisi
(←Membuat halaman berisi '= PANDUAN LENGKAP INSTALASI MAIL SERVER = '''Debian 13 di Proxmox CT''' ''Edisi Revisi v2.0 — Diperbarui berdasarkan hasil implementasi nyata'' '''Stack:''' Apache2 • BIND9 • Postfix • Dovecot 2.4 • Roundcube • Telnet '''Spesifikasi:''' HDD 8 GB | RAM 512 MB | Proxmox Container (CT) | IP: 192.168.111.103 == BAB 1 — PENDAHULUAN & GAMBARAN UMUM == === 1.1 Tujuan Panduan === Panduan ini menjelaskan langkah-langkah lengkap untuk membangun Mail Server...') |
|||
| (10 revisi perantara oleh pengguna yang sama tidak ditampilkan) | |||
| Baris 1: | Baris 1: | ||
= | = TUTORIAL INSTALASI MAIL SERVER = | ||
'''Debian 13 di Proxmox CT' | '''Debian 13 di Proxmox CT''' | ||
''' | '''Komponen yang Dipelajari:''' | ||
Apache2 | |||
BIND9 | |||
Postfix | |||
Dovecot | |||
Roundcube | |||
'''Spesifikasi Lab:''' | |||
HDD 8 GB | RAM 512 MB | Proxmox Container | IP: 192.168.111.103 (sesuai ip yang didapatkan) | |||
== TUJUAN PEMBELAJARAN == | |||
| | Setelah mengikuti tutorial ini, siswa mampu: | ||
# Memahami arsitektur dasar mail server | |||
# Menginstal dan mengkonfigurasi layanan DNS, SMTP, IMAP, dan Webmail | |||
# Menguji koneksi email menggunakan Telnet | |||
# Melakukan troubleshooting dasar jika terjadi error | |||
=== | == PERSIAPAN AWAL == | ||
{| class="wikitable" | === Spesifikasi Server === | ||
! | {| class="wikitable" style="width:100%" | ||
! Komponen !! Spesifikasi Minimum | |||
|- | |- | ||
| Proxmox VE || Versi 8.x (Container Mode) | |||
|- | |- | ||
| OS Guest || Debian 13 (Trixie) 64-bit | |||
|- | |- | ||
| Storage || 8 GB HDD | |||
|- | |- | ||
| RAM || 512 MB + Swap 512 MB | |||
|- | |- | ||
| IP Address || 192.168.111.103/24 | |||
|- | |- | ||
| Domain || belajar.local | |||
|- | |- | ||
| Hostname || mailserver.belajar.local | |||
|} | |} | ||
=== Langkah 1: Buat Container di Proxmox === | |||
# Buka Proxmox Web UI: <code>https://IP-PROXMOX:8006</code> | |||
# Download template Debian 13: <code>Datacenter → Node → local → CT Templates</code> | |||
= | # Klik '''Create CT''' dan isi: | ||
# | |||
# Download template: <code>Datacenter → Node → local → CT Templates | |||
# Klik | |||
{| class="wikitable" | {| class="wikitable" | ||
! Parameter !! Nilai | ! Parameter !! Nilai Contoh | ||
|- | |- | ||
| CT ID || 101 (sesuai dengan CT yang sudah ada) | |||
|- | |- | ||
| Hostname || mailserver | |||
|- | |- | ||
| Template || debian-13-standard | |||
|- | |- | ||
| Disk || 8 GB | |||
|- | |- | ||
| CPU || 1 core | |||
|- | |- | ||
| RAM || 512 MB | |||
|- | |- | ||
! | | Swap || 512 MB (wajib!) | ||
|- | |- | ||
| Network || IP Static: 192.168.111.103/24 (sesuai IP yang didapatkan masing-masing | |||
|} | |} | ||
=== 2 | === Langkah 2: Masuk ke Container & Update Sistem === | ||
<pre> | <pre> | ||
# Masuk ke console container | |||
apt update && apt upgrade -y | apt update && apt upgrade -y | ||
apt install -y curl wget | |||
# Install paket dasar | |||
apt install -y curl wget nano net-tools dnsutils ufw rsyslog | |||
</pre> | </pre> | ||
=== | === Langkah 3: Set Hostname & Swap === | ||
<pre> | <pre> | ||
# Set hostname | |||
hostnamectl set-hostname mailserver | hostnamectl set-hostname mailserver | ||
# Edit file hosts | |||
nano /etc/hosts | nano /etc/hosts | ||
</pre> | </pre> | ||
| Baris 102: | Baris 91: | ||
192.168.111.103 mailserver.belajar.local mailserver | 192.168.111.103 mailserver.belajar.local mailserver | ||
</pre> | </pre> | ||
[[Berkas:001-etc-hosts.jpg|pus|jmpl|582x582px]] | |||
== | == 🔧 BAGIAN 1: INSTALASI DNS SERVER (BIND9) == | ||
=== Langkah 1: Install BIND9 === | |||
=== | |||
<pre> | <pre> | ||
apt install -y bind9 bind9utils | apt install -y bind9 bind9utils dnsutils | ||
</pre> | </pre> | ||
=== | === Langkah 2: Konfigurasi named.conf.options === | ||
<pre> | <pre> | ||
nano /etc/bind/named.conf.options | nano /etc/bind/named.conf.options | ||
</pre> | </pre> | ||
Isi | Isi dengan: | ||
<pre> | <pre> | ||
options { | options { | ||
| Baris 152: | Baris 114: | ||
}; | }; | ||
</pre> | </pre> | ||
[[Berkas:002-etc-bind-named-conf-options.jpg|pus|jmpl|638x638px]] | |||
=== 3 | === Langkah 3: Konfigurasi Zone Domain === | ||
<pre> | <pre> | ||
nano /etc/bind/named.conf.local | nano /etc/bind/named.conf.local | ||
</pre> | </pre> | ||
Tambahkan: | |||
<pre> | <pre> | ||
zone "belajar.local" { | zone "belajar.local" { | ||
| Baris 168: | Baris 131: | ||
}; | }; | ||
</pre> | </pre> | ||
[[Berkas:003-etc-bind-named-conf-local.jpg|pus|jmpl|635x635px]] | |||
=== | === Langkah 4: Buat File Zone Forward === | ||
<pre> | <pre> | ||
nano /etc/bind/db.belajar.local | nano /etc/bind/db.belajar.local | ||
</pre> | </pre> | ||
| Baris 191: | Baris 154: | ||
www IN A 192.168.111.103 | www IN A 192.168.111.103 | ||
</pre> | </pre> | ||
[[Berkas:004-etc-bind-db-belajar-local.jpg|pus|jmpl|583x583px]] | |||
=== | === Langkah 5: Buat File Zone Reverse === | ||
<pre> | <pre> | ||
nano /etc/bind/db.192.168.111 | nano /etc/bind/db.192.168.111 | ||
</pre> | </pre> | ||
| Baris 210: | Baris 173: | ||
103 IN PTR mailserver.belajar.local. | 103 IN PTR mailserver.belajar.local. | ||
</pre> | </pre> | ||
[[Berkas:005-etc-bind-db-192168111.jpg|pus|jmpl|677x677px]] | |||
=== | === Langkah 6: Set DNS Lokal & Restart === | ||
<pre> | <pre> | ||
# Set DNS ke server sendiri | |||
nano /etc/resolv.conf | nano /etc/resolv.conf | ||
</pre> | </pre> | ||
Isi | Isi: | ||
<pre> | <pre> | ||
nameserver 192.168.111.103 | nameserver 192.168.111.103 | ||
search belajar.local | search belajar.local | ||
</pre> | </pre> | ||
[[Berkas:006-etc-resolv-conf.jpg|pus|jmpl|589x589px]] | |||
<pre> | <pre> | ||
# Cek konfigurasi | |||
named-checkconf | named-checkconf | ||
named-checkzone belajar.local /etc/bind/db.belajar.local | named-checkzone belajar.local /etc/bind/db.belajar.local | ||
# | # Restart BIND9 | ||
nslookup mailserver.belajar.local | systemctl restart bind9 | ||
dig MX belajar.local | systemctl enable bind9 | ||
# Tes DNS | |||
nslookup mailserver.belajar.local | |||
dig MX belajar.local | |||
</pre> | </pre> | ||
[[Berkas:007-cek-konfigurasi-named-checkzone-belajar-local.jpg|pus|jmpl|576x576px]] | |||
[[Berkas:008-nslookup-maiserver-belajar-local.jpg|pus|jmpl|492x492px]] | |||
[[Berkas:009-dig-mx-belajar-local.jpg|pus|jmpl|635x635px]] | |||
== | == BAGIAN 2: INSTALASI WEB SERVER & DATABASE == | ||
=== | === Langkah 1: Install Apache2 === | ||
<pre> | <pre> | ||
apt install -y apache2 | apt install -y apache2 | ||
systemctl start apache2 | systemctl start apache2 | ||
systemctl enable apache2 | |||
</pre> | </pre> | ||
=== | === Langkah 2: Install PHP dan Modul === | ||
<pre> | <pre> | ||
apt install -y php php-cli php-common php-curl php-gd php-intl \ | apt install -y php php-cli php-common php-curl php-gd php-intl \ | ||
php-json php-mbstring php-mysql | php-json php-mbstring php-mysql php-xml php-zip libapache2-mod-php | ||
</pre> | |||
Cek PHP sudah terinstall: | |||
<pre> | |||
php -v | php -v | ||
</pre> | </pre> | ||
=== | === Langkah 3: Install MariaDB === | ||
<pre> | <pre> | ||
apt install -y mariadb-server mariadb-client | apt install -y mariadb-server mariadb-client | ||
systemctl start mariadb | systemctl start mariadb | ||
systemctl enable mariadb | |||
</pre> | </pre> | ||
=== 4 | === Langkah 4: Buat Database untuk Roundcube === | ||
<pre> | |||
mysql -u root -p (enter) | |||
</pre> | |||
biarkan Password tetap kosong, langsung tekan Enter saja. | |||
Masukkan perintah SQL: | |||
<pre> | <pre> | ||
CREATE DATABASE roundcubemail CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | CREATE DATABASE roundcubemail CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
CREATE USER 'roundcube'@'localhost' IDENTIFIED BY ' | CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'password123'; | ||
GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost'; | GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost'; | ||
FLUSH PRIVILEGES; | FLUSH PRIVILEGES; | ||
EXIT; | EXIT; | ||
</pre> | </pre> | ||
=== | === Langkah 5: Aktifkan Modul Apache === | ||
<pre> | <pre> | ||
a2enmod rewrite ssl headers | a2enmod rewrite ssl headers | ||
| Baris 281: | Baris 249: | ||
</pre> | </pre> | ||
== | == BAGIAN 3: INSTALASI SMTP SERVER (POSTFIX) == | ||
=== Langkah 1: Install Postfix === | |||
=== | |||
<pre> | <pre> | ||
apt install -y postfix | apt install -y postfix mailutils | ||
</pre> | </pre> | ||
Saat dialog | Saat muncul dialog: | ||
# | # Pilih: <code>Internet Site</code> | ||
# System mail name: <code>belajar.local</code> | # System mail name: <code>belajar.local</code> | ||
=== | === Langkah 2: Konfigurasi main.cf === | ||
<pre> | <pre> | ||
nano /etc/postfix/main.cf | nano /etc/postfix/main.cf | ||
</pre> | </pre> | ||
Tambahkan/ubah konfigurasi berikut: | |||
<pre> | <pre> | ||
# Identitas server | # Identitas server | ||
| Baris 302: | Baris 268: | ||
mydomain = belajar.local | mydomain = belajar.local | ||
myorigin = $mydomain | myorigin = $mydomain | ||
# Jaringan | # Jaringan | ||
inet_interfaces = all | inet_interfaces = all | ||
| Baris 307: | Baris 274: | ||
mydestination = $myhostname, localhost.$mydomain, $mydomain, localhost | mydestination = $myhostname, localhost.$mydomain, $mydomain, localhost | ||
mynetworks = 127.0.0.0/8 192.168.111.0/24 | mynetworks = 127.0.0.0/8 192.168.111.0/24 | ||
# | # Format mailbox | ||
home_mailbox = Maildir/ | home_mailbox = Maildir/ | ||
# Autentikasi via Dovecot | |||
# | |||
smtpd_sasl_type = dovecot | smtpd_sasl_type = dovecot | ||
smtpd_sasl_path = private/auth | smtpd_sasl_path = private/auth | ||
smtpd_sasl_auth_enable = yes | smtpd_sasl_auth_enable = yes | ||
smtpd_sasl_security_options = noanonymous | smtpd_sasl_security_options = noanonymous | ||
# | # Keamanan relay | ||
smtpd_recipient_restrictions = | smtpd_recipient_restrictions = | ||
permit_sasl_authenticated, | permit_sasl_authenticated, | ||
permit_mynetworks, | permit_mynetworks, | ||
reject_unauth_destination | reject_unauth_destination | ||
# Optimasi untuk RAM rendah | |||
# Optimasi RAM rendah | |||
default_process_limit = 10 | default_process_limit = 10 | ||
smtpd_client_connection_rate_limit = 30 | smtpd_client_connection_rate_limit = 30 | ||
</pre> | </pre> | ||
[[Berkas:010-nano-etc-postfix-main-cf.jpg|pus|jmpl|560x560px]] | |||
=== | === Langkah 3: Aktifkan Port Submission === | ||
<pre> | <pre> | ||
nano /etc/postfix/master.cf | nano /etc/postfix/master.cf | ||
</pre> | </pre> | ||
Cari baris <code>submission</code> dan hapus tanda <code>#</code>: | |||
<pre> | <pre> | ||
submission inet n - y - - smtpd | submission inet n - y - - smtpd | ||
| Baris 343: | Baris 308: | ||
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject | -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject | ||
</pre> | </pre> | ||
[[Berkas:011-nano-etc-postfix-master-cf.jpg|pus|jmpl|534x534px]] | |||
=== | === Langkah 4: Restart Postfix === | ||
<pre> | <pre> | ||
systemctl restart postfix | systemctl restart postfix | ||
systemctl enable postfix | |||
# Cek port sudah terbuka | |||
ss -tlnp | grep -E ':25|:587' | ss -tlnp | grep -E ':25|:587' | ||
</pre> | </pre> | ||
[[Berkas:012-restart-postfix.jpg|pus|jmpl|731x731px]] | |||
== | == BAGIAN 4: INSTALASI IMAP SERVER (DOVECOT) == | ||
=== Langkah 1: Install Dovecot === | |||
=== | |||
<pre> | <pre> | ||
apt install -y dovecot-core dovecot-imapd dovecot-pop3d | apt install -y dovecot-core dovecot-imapd dovecot-pop3d | ||
</pre> | </pre> | ||
=== | === Langkah 2: Konfigurasi Protokol === | ||
<pre> | <pre> | ||
nano /etc/dovecot/dovecot.conf | nano /etc/dovecot/dovecot.conf | ||
</pre> | </pre> | ||
Ubah | Ubah baris: | ||
<pre> | <pre> | ||
protocols = imap pop3 | protocols = imap pop3 | ||
</pre> | </pre> | ||
[[Berkas:013-nano-etc-dovecot-conf.jpg|pus|jmpl|654x654px]] | |||
=== | === Langkah 3: Konfigurasi Format Mail === | ||
<pre> | <pre> | ||
nano /etc/dovecot/conf.d/10-mail.conf | nano /etc/dovecot/conf.d/10-mail.conf | ||
</pre> | </pre> | ||
Cari | Cari dan ubah: | ||
<pre> | <pre> | ||
mail_path = maildir:~/Maildir | |||
</pre> | </pre> | ||
[[Berkas:014-etc-dovecot-conf-d-10-mail-conf.jpg|pus|jmpl|591x591px]] | |||
=== | === Langkah 4: Konfigurasi Autentikasi === | ||
<pre> | <pre> | ||
nano /etc/dovecot/conf.d/ | nano /etc/dovecot/conf.d/10-auth.conf | ||
</pre> | </pre> | ||
Pastikan baris ini aktif (tanpa tanda <code>#</code>): | |||
<pre> | <pre> | ||
!include auth-system.conf.ext | |||
</pre> | </pre> | ||
[[Berkas:015-etc-dovecot-conf-d-10-auth-conf.jpg|pus|jmpl|564x564px]] | |||
=== | === Langkah 5: Konfigurasi Socket untuk Postfix === | ||
<pre> | <pre> | ||
nano /etc/dovecot/conf.d/10-master.conf | nano /etc/dovecot/conf.d/10-master.conf | ||
</pre> | </pre> | ||
Cari bagian <code>service auth</code> dan pastikan | Cari bagian <code>service auth</code> dan pastikan seperti ini: | ||
<pre> | <pre> | ||
service auth { | service auth { | ||
unix_listener /var/spool/postfix/private/auth { | unix_listener /var/spool/postfix/private/auth { | ||
mode = 0660 | mode = 0660 | ||
| Baris 415: | Baris 368: | ||
group = postfix | group = postfix | ||
} | } | ||
unix_listener auth-userdb { | unix_listener auth-userdb { | ||
mode = 0660 | |||
user = dovecot | |||
} | } | ||
} | } | ||
</pre> | </pre> | ||
[[Berkas:016-nano-etc-dovecot-conf-d-10-master-conf.jpg|pus|jmpl|754x754px]] | |||
=== 6 | === Langkah 6: Restart Dovecot === | ||
<pre> | <pre> | ||
# | # Restart Dovecot dulu | ||
systemctl restart dovecot | |||
systemctl enable dovecot | |||
# Lalu restart Postfix | |||
# | |||
systemctl restart postfix | systemctl restart postfix | ||
# | |||
ss -tlnp | grep -E ' | # Cek port | ||
ss -tlnp | grep -E ':110|:143' | |||
</pre> | </pre> | ||
[[Berkas:017-restart-dovecot-6.jpg|pus|jmpl|653x653px]] | |||
== | == BAGIAN 5: MEMBUAT AKUN EMAIL == | ||
=== Buat User Email === | |||
=== | |||
<pre> | <pre> | ||
# Buat | # Buat user1 | ||
adduser --shell /sbin/nologin user1 | adduser --shell /sbin/nologin user1 | ||
# Masukkan password saat diminta | |||
# Buat user2 | |||
adduser --shell /sbin/nologin user2 | adduser --shell /sbin/nologin user2 | ||
# Buat | |||
# Buat folder Maildir | |||
mkdir -p /home/user1/Maildir/{new,cur,tmp} | mkdir -p /home/user1/Maildir/{new,cur,tmp} | ||
chown -R user1:user1 /home/user1/Maildir | chown -R user1:user1 /home/user1/Maildir | ||
mkdir -p /home/user2/Maildir/{new,cur,tmp} | mkdir -p /home/user2/Maildir/{new,cur,tmp} | ||
chown -R user2:user2 /home/user2/Maildir | chown -R user2:user2 /home/user2/Maildir | ||
</pre> | </pre> | ||
''' | '''💡 Info:''' | ||
* User <code>user1</code> = email <code>user1@belajar.local</code> | |||
* User <code>user2</code> = email <code>user2@belajar.local</code> | |||
== | == 🧪 BAGIAN 6: PENGUJIAN DENGAN TELNET == | ||
=== | === Langkah 1: Install Telnet === | ||
<pre> | <pre> | ||
apt install -y telnet | apt install -y telnet | ||
</pre> | </pre> | ||
=== | === Langkah 2: Tes Kirim Email via SMTP === | ||
<pre> | <pre> | ||
telnet 192.168.111.103 25 | telnet 192.168.111.103 25 | ||
</pre> | </pre> | ||
Jika berhasil, akan muncul: | |||
<pre> | <pre> | ||
220 mailserver.belajar.local ESMTP Postfix | |||
</pre> | </pre> | ||
Ketik perintah berikut satu per satu: | |||
<pre> | <pre> | ||
EHLO belajar.local | |||
MAIL FROM:<[email protected]> | MAIL FROM:<[email protected]> | ||
RCPT TO:<[email protected]> | RCPT TO:<[email protected]> | ||
DATA | DATA | ||
</pre> | </pre> | ||
Kemudian ketik isi email: | |||
<pre> | <pre> | ||
From: [email protected] | From: [email protected] | ||
Subject: | Subject: Hallo dari user1 | ||
Halo user2, ini | |||
Halo user2, ini email percobaan kita! | |||
Semoga berhasil ya! | |||
. | . | ||
</pre> | </pre> | ||
Titik (<code>.</code>) di baris terakhir harus | '''⚠️ Penting:''' Titik (<code>.</code>) di baris terakhir harus sendiri, tanpa spasi! | ||
Lanjutkan: | |||
<pre> | <pre> | ||
QUIT | QUIT | ||
</pre> | </pre> | ||
=== | === Langkah 3: Cek Email Masuk === | ||
<pre> | <pre> | ||
ls /home/user2/Maildir/new/ | ls /home/user2/Maildir/new/ | ||
</pre> | </pre> | ||
Jika muncul file | Jika muncul file, email berhasil diterima! | ||
<pre> | <pre> | ||
# Lihat isi email | # Lihat isi email | ||
cat /home/user2/Maildir/new/ | cat /home/user2/Maildir/new/* | ||
</pre> | </pre> | ||
=== | === Langkah 4: Tes IMAP === | ||
<pre> | <pre> | ||
telnet 192.168.111.103 143 | telnet 192.168.111.103 143 | ||
</pre> | </pre> | ||
Harus muncul: <code>* OK Dovecot ready</code> | |||
<pre> | <pre> | ||
a LOGIN user2 passworduser2 | a LOGIN user2 passworduser2 | ||
b SELECT INBOX | b SELECT INBOX | ||
d LOGOUT | d LOGOUT | ||
</pre> | </pre> | ||
== | == 🌍 BAGIAN 7: INSTALASI WEBMAIL (ROUNDCUBE) == | ||
=== Langkah 1: Download Roundcube === | |||
=== | |||
<pre> | <pre> | ||
cd /var/www/html | cd /var/www/html | ||
wget https://github.com/roundcube/roundcubemail/releases/download/1.6.6/roundcubemail-1.6.6-complete.tar.gz | wget https://github.com/roundcube/roundcubemail/releases/download/1.6.6/roundcubemail-1.6.6-complete.tar.gz | ||
tar xzf roundcubemail-1.6.6-complete.tar.gz | tar xzf roundcubemail-1.6.6-complete.tar.gz | ||
| Baris 585: | Baris 481: | ||
</pre> | </pre> | ||
=== | === Langkah 2: Set Permission === | ||
<pre> | <pre> | ||
chown -R www-data:www-data /var/www/html/roundcube | chown -R www-data:www-data /var/www/html/roundcube | ||
| Baris 593: | Baris 489: | ||
</pre> | </pre> | ||
=== | === Langkah 3: Konfigurasi Apache === | ||
<pre> | <pre> | ||
nano /etc/apache2/sites-available/roundcube.conf | nano /etc/apache2/sites-available/roundcube.conf | ||
</pre> | </pre> | ||
Isi | Isi: | ||
<pre> | <pre> | ||
<VirtualHost *:80> | |||
ServerName mail.belajar.local | ServerName mail.belajar.local | ||
DocumentRoot /var/www/html/roundcube | DocumentRoot /var/www/html/roundcube | ||
<Directory /var/www/html/roundcube> | |||
Options -Indexes +FollowSymLinks | Options -Indexes +FollowSymLinks | ||
AllowOverride All | AllowOverride All | ||
Require all granted | Require all granted | ||
</Directory> | |||
</VirtualHost> | |||
</pre> | </pre> | ||
Aktifkan site: | Aktifkan site: | ||
| Baris 618: | Baris 512: | ||
</pre> | </pre> | ||
=== | === Langkah 4: Import Database Roundcube === | ||
<pre> | <pre> | ||
mysql -u roundcube -p roundcubemail < /var/www/html/roundcube/SQL/mysql.initial.sql | mysql -u roundcube -p roundcubemail < /var/www/html/roundcube/SQL/mysql.initial.sql | ||
</pre> | </pre> | ||
=== | === Langkah 5: Setup via Browser === | ||
# Buka browser: <code>http://192.168.111.103/roundcube/installer</code> | # Buka browser: <code>http://192.168.111.103/roundcube/installer</code> | ||
# Ikuti wizard | # Ikuti wizard setup | ||
# | # Konfigurasi database: | ||
## | ## Server: <code>localhost</code> | ||
## Database | ## Database: <code>roundcubemail</code> | ||
## | ## User: <code>roundcube</code> | ||
## | ## Password: <code>password123</code> (sesuai yang dibuat tadi) | ||
# | # Konfigurasi IMAP: <code>localhost</code>, port <code>143</code> | ||
# Konfigurasi SMTP: <code>localhost</code>, port <code>25</code> | |||
# | # Klik '''Create config''' → '''Initialize database''' | ||
=== Langkah 6: Hapus Folder Installer === | |||
# Klik | |||
<pre> | <pre> | ||
rm -rf /var/www/html/roundcube/installer | rm -rf /var/www/html/roundcube/installer | ||
</pre> | </pre> | ||
=== | === Langkah 7: Akses Webmail === | ||
Buka browser | Buka browser: <code>http://192.168.111.103/roundcube</code> | ||
Login | Login dengan: | ||
* Username: <code>user1</code> atau <code>user2</code> | |||
* Password: (sesuai password user Linux) | |||
== | == 🔍 TROUBLESHOOTING DASAR == | ||
=== | === Mail Server Tidak Bisa Dikirim === | ||
<pre> | |||
# Cek log Postfix | |||
journalctl -u postfix --no-pager | tail -20 | |||
# Cek antrian email | |||
mailq | |||
# Flush antrian | |||
postqueue -f | |||
</pre> | |||
|- | |||
=== Dovecot Tidak Bisa Login === | |||
<pre> | |||
# Cek log Dovecot | |||
journalctl -u dovecot --no-pager | tail -20 | |||
# Cek konfigurasi | |||
doveconf -n | head -20 | |||
</pre> | |||
|- | |||
|- | |||
=== | === DNS Tidak Resolve === | ||
<pre> | <pre> | ||
# Restart | # Cek konfigurasi BIND | ||
systemctl restart bind9 | named-checkconf | ||
named-checkzone belajar.local /etc/bind/db.belajar.local | |||
# Restart BIND | |||
systemctl restart bind9 | |||
</pre> | |||
=== Perintah Berguna untuk Siswa === | |||
<pre> | |||
# Cek status semua layanan | # Cek status semua layanan | ||
systemctl status bind9 apache2 mariadb postfix dovecot | |||
# | # Restart semua layanan | ||
systemctl restart bind9 apache2 mariadb postfix dovecot | |||
# | # Monitor log realtime | ||
journalctl -f | |||
# Tambah user email baru | # Tambah user email baru | ||
| Baris 708: | Baris 589: | ||
</pre> | </pre> | ||
= | == 📋 CHECKLIST AKHIR == | ||
{| class="wikitable" style="width:100%" | |||
{| class="wikitable" | ! No !! Pengujian !! Perintah !! Hasil OK | ||
! | |||
|- | |- | ||
| | | 1 || DNS aktif || <code>systemctl is-active bind9</code> || active | ||
|- | |- | ||
| | | 2 || MX record || <code>dig MX belajar.local</code> || mailserver.belajar.local | ||
|- | |- | ||
| | | 3 || Apache aktif || <code>systemctl is-active apache2</code> || active | ||
|- | |- | ||
| | | 4 || Database aktif || <code>systemctl is-active mariadb</code> || active | ||
|- | |- | ||
| | | 5 || Postfix aktif || <code>systemctl is-active postfix</code> || active | ||
|- | |- | ||
| | | 6 || Port 25 terbuka || <code>ss -tlnp | grep :25</code> || LISTEN | ||
|- | |- | ||
| | | 7 || Dovecot aktif || <code>systemctl is-active dovecot</code> || active | ||
|- | |- | ||
| | | 8 || Port 143 terbuka || <code>ss -tlnp | grep :143</code> || LISTEN | ||
|- | |- | ||
| | | 9 || Kirim email Telnet || <code>telnet localhost 25</code> || 220 banner muncul | ||
|- | |- | ||
| | | 10 || Email masuk || <code>ls /home/user2/Maildir/new/</code> || ada file | ||
|- | |- | ||
| | | 11 || Webmail bisa diakses || Browser ke <code>/roundcube</code> || halaman login muncul | ||
|} | |} | ||
== 🎓 TUGAS PRAKTIKUM == | |||
# ✅ Instal mail server sesuai tutorial ini | |||
# ✅ Buat 3 akun email: <code>siswa1</code>, <code>siswa2</code>, <code>guru</code> | |||
# ✅ Kirim email dari <code>siswa1</code> ke <code>siswa2</code> via Telnet | |||
# ✅ Verifikasi email masuk ke Maildir <code>siswa2</code> | |||
# ✅ Login ke webmail Roundcube dengan akun <code>guru</code> | |||
# ✅ Kirim email via webmail dari <code>guru</code> ke <code>siswa1</code> | |||
# ✅ Dokumentasikan setiap langkah dengan screenshot | |||
# ✅ Buat laporan praktikum dalam format PDF | |||
== 📚 REFERENSI == | |||
* [https://www.postfix.org/ Postfix Official Documentation] | |||
* [https://www.dovecot.org/ Dovecot Official Documentation] | |||
* [https://roundcube.net/ Roundcube Webmail] | |||
* [https://www.isc.org/bind/ BIND9 Documentation] | |||
* Modul Praktikum TKJ SMK — Administrasi Server Linux | |||
Revisi terkini sejak 22 April 2026 07.30
TUTORIAL INSTALASI MAIL SERVER
Debian 13 di Proxmox CT
Komponen yang Dipelajari:
Apache2
BIND9
Postfix
Dovecot
Roundcube
Spesifikasi Lab:
HDD 8 GB | RAM 512 MB | Proxmox Container | IP: 192.168.111.103 (sesuai ip yang didapatkan)
TUJUAN PEMBELAJARAN
Setelah mengikuti tutorial ini, siswa mampu:
- Memahami arsitektur dasar mail server
- Menginstal dan mengkonfigurasi layanan DNS, SMTP, IMAP, dan Webmail
- Menguji koneksi email menggunakan Telnet
- Melakukan troubleshooting dasar jika terjadi error
PERSIAPAN AWAL
Spesifikasi Server
| Komponen | Spesifikasi Minimum |
|---|---|
| Proxmox VE | Versi 8.x (Container Mode) |
| OS Guest | Debian 13 (Trixie) 64-bit |
| Storage | 8 GB HDD |
| RAM | 512 MB + Swap 512 MB |
| IP Address | 192.168.111.103/24 |
| Domain | belajar.local |
| Hostname | mailserver.belajar.local |
Langkah 1: Buat Container di Proxmox
- Buka Proxmox Web UI:
https://IP-PROXMOX:8006 - Download template Debian 13:
Datacenter → Node → local → CT Templates - Klik Create CT dan isi:
| Parameter | Nilai Contoh |
|---|---|
| CT ID | 101 (sesuai dengan CT yang sudah ada) |
| Hostname | mailserver |
| Template | debian-13-standard |
| Disk | 8 GB |
| CPU | 1 core |
| RAM | 512 MB |
| Swap | 512 MB (wajib!) |
| Network | IP Static: 192.168.111.103/24 (sesuai IP yang didapatkan masing-masing |
Langkah 2: Masuk ke Container & Update Sistem
# Masuk ke console container apt update && apt upgrade -y # Install paket dasar apt install -y curl wget nano net-tools dnsutils ufw rsyslog
Langkah 3: Set Hostname & Swap
# Set hostname hostnamectl set-hostname mailserver # Edit file hosts nano /etc/hosts
Isi file /etc/hosts:
127.0.0.1 localhost 192.168.111.103 mailserver.belajar.local mailserver
🔧 BAGIAN 1: INSTALASI DNS SERVER (BIND9)
Langkah 1: Install BIND9
apt install -y bind9 bind9utils dnsutils
Langkah 2: Konfigurasi named.conf.options
nano /etc/bind/named.conf.options
Isi dengan:
options {
directory "/var/cache/bind";
forwarders { 8.8.8.8; 8.8.4.4; };
dnssec-validation auto;
listen-on { any; };
allow-query { any; };
recursion yes;
};
Langkah 3: Konfigurasi Zone Domain
nano /etc/bind/named.conf.local
Tambahkan:
zone "belajar.local" {
type master;
file "/etc/bind/db.belajar.local";
};
zone "111.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.192.168.111";
};
Langkah 4: Buat File Zone Forward
nano /etc/bind/db.belajar.local
Isi file:
$TTL 604800
@ IN SOA mailserver.belajar.local. root.belajar.local. (
2024010101 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS mailserver.belajar.local.
@ IN A 192.168.111.103
@ IN MX 10 mailserver.belajar.local.
mailserver IN A 192.168.111.103
mail IN A 192.168.111.103
www IN A 192.168.111.103
Langkah 5: Buat File Zone Reverse
nano /etc/bind/db.192.168.111
Isi file:
$TTL 604800
@ IN SOA mailserver.belajar.local. root.belajar.local. (
2024010101 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS mailserver.belajar.local.
103 IN PTR mailserver.belajar.local.
Langkah 6: Set DNS Lokal & Restart
# Set DNS ke server sendiri nano /etc/resolv.conf
Isi:
nameserver 192.168.111.103 search belajar.local
# Cek konfigurasi named-checkconf named-checkzone belajar.local /etc/bind/db.belajar.local # Restart BIND9 systemctl restart bind9 systemctl enable bind9 # Tes DNS nslookup mailserver.belajar.local dig MX belajar.local
BAGIAN 2: INSTALASI WEB SERVER & DATABASE
Langkah 1: Install Apache2
apt install -y apache2 systemctl start apache2 systemctl enable apache2
Langkah 2: Install PHP dan Modul
apt install -y php php-cli php-common php-curl php-gd php-intl \
php-json php-mbstring php-mysql php-xml php-zip libapache2-mod-php
Cek PHP sudah terinstall:
php -v
Langkah 3: Install MariaDB
apt install -y mariadb-server mariadb-client systemctl start mariadb systemctl enable mariadb
Langkah 4: Buat Database untuk Roundcube
mysql -u root -p (enter)
biarkan Password tetap kosong, langsung tekan Enter saja.
Masukkan perintah SQL:
CREATE DATABASE roundcubemail CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'password123'; GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost'; FLUSH PRIVILEGES; EXIT;
Langkah 5: Aktifkan Modul Apache
a2enmod rewrite ssl headers systemctl restart apache2
BAGIAN 3: INSTALASI SMTP SERVER (POSTFIX)
Langkah 1: Install Postfix
apt install -y postfix mailutils
Saat muncul dialog:
- Pilih:
Internet Site - System mail name:
belajar.local
Langkah 2: Konfigurasi main.cf
nano /etc/postfix/main.cf
Tambahkan/ubah konfigurasi berikut:
# Identitas server
myhostname = mailserver.belajar.local
mydomain = belajar.local
myorigin = $mydomain
# Jaringan
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, $mydomain, localhost
mynetworks = 127.0.0.0/8 192.168.111.0/24
# Format mailbox
home_mailbox = Maildir/
# Autentikasi via Dovecot
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
# Keamanan relay
smtpd_recipient_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination
# Optimasi untuk RAM rendah
default_process_limit = 10
smtpd_client_connection_rate_limit = 30
Langkah 3: Aktifkan Port Submission
nano /etc/postfix/master.cf
Cari baris submission dan hapus tanda #:
submission inet n - y - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
Langkah 4: Restart Postfix
systemctl restart postfix systemctl enable postfix # Cek port sudah terbuka ss -tlnp | grep -E ':25|:587'
BAGIAN 4: INSTALASI IMAP SERVER (DOVECOT)
Langkah 1: Install Dovecot
apt install -y dovecot-core dovecot-imapd dovecot-pop3d
Langkah 2: Konfigurasi Protokol
nano /etc/dovecot/dovecot.conf
Ubah baris:
protocols = imap pop3
Langkah 3: Konfigurasi Format Mail
nano /etc/dovecot/conf.d/10-mail.conf
Cari dan ubah:
mail_path = maildir:~/Maildir
Langkah 4: Konfigurasi Autentikasi
nano /etc/dovecot/conf.d/10-auth.conf
Pastikan baris ini aktif (tanpa tanda #):
!include auth-system.conf.ext
Langkah 5: Konfigurasi Socket untuk Postfix
nano /etc/dovecot/conf.d/10-master.conf
Cari bagian service auth dan pastikan seperti ini:
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0660
user = postfix
group = postfix
}
unix_listener auth-userdb {
mode = 0660
user = dovecot
}
}
Langkah 6: Restart Dovecot
# Restart Dovecot dulu systemctl restart dovecot systemctl enable dovecot # Lalu restart Postfix systemctl restart postfix # Cek port ss -tlnp | grep -E ':110|:143'
BAGIAN 5: MEMBUAT AKUN EMAIL
Buat User Email
# Buat user1
adduser --shell /sbin/nologin user1
# Masukkan password saat diminta
# Buat user2
adduser --shell /sbin/nologin user2
# Buat folder Maildir
mkdir -p /home/user1/Maildir/{new,cur,tmp}
chown -R user1:user1 /home/user1/Maildir
mkdir -p /home/user2/Maildir/{new,cur,tmp}
chown -R user2:user2 /home/user2/Maildir
💡 Info:
- User
user1= email[email protected] - User
user2= email[email protected]
🧪 BAGIAN 6: PENGUJIAN DENGAN TELNET
Langkah 1: Install Telnet
apt install -y telnet
Langkah 2: Tes Kirim Email via SMTP
telnet 192.168.111.103 25
Jika berhasil, akan muncul:
220 mailserver.belajar.local ESMTP Postfix
Ketik perintah berikut satu per satu:
EHLO belajar.local MAIL FROM:<[email protected]> RCPT TO:<[email protected]> DATA
Kemudian ketik isi email:
From: [email protected] To: [email protected] Subject: Hallo dari user1 Halo user2, ini email percobaan kita! Semoga berhasil ya! .
⚠️ Penting: Titik (.) di baris terakhir harus sendiri, tanpa spasi!
Lanjutkan:
QUIT
Langkah 3: Cek Email Masuk
ls /home/user2/Maildir/new/
Jika muncul file, email berhasil diterima!
# Lihat isi email cat /home/user2/Maildir/new/*
Langkah 4: Tes IMAP
telnet 192.168.111.103 143
Harus muncul: * OK Dovecot ready
a LOGIN user2 passworduser2 b SELECT INBOX d LOGOUT
🌍 BAGIAN 7: INSTALASI WEBMAIL (ROUNDCUBE)
Langkah 1: Download Roundcube
cd /var/www/html wget https://github.com/roundcube/roundcubemail/releases/download/1.6.6/roundcubemail-1.6.6-complete.tar.gz tar xzf roundcubemail-1.6.6-complete.tar.gz mv roundcubemail-1.6.6 roundcube rm roundcubemail-1.6.6-complete.tar.gz
Langkah 2: Set Permission
chown -R www-data:www-data /var/www/html/roundcube chmod -R 755 /var/www/html/roundcube chmod -R 777 /var/www/html/roundcube/temp chmod -R 777 /var/www/html/roundcube/logs
Langkah 3: Konfigurasi Apache
nano /etc/apache2/sites-available/roundcube.conf
Isi:
<VirtualHost *:80>
ServerName mail.belajar.local
DocumentRoot /var/www/html/roundcube
<Directory /var/www/html/roundcube>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Aktifkan site:
a2ensite roundcube.conf a2dissite 000-default.conf systemctl reload apache2
Langkah 4: Import Database Roundcube
mysql -u roundcube -p roundcubemail < /var/www/html/roundcube/SQL/mysql.initial.sql
Langkah 5: Setup via Browser
- Buka browser:
http://192.168.111.103/roundcube/installer - Ikuti wizard setup
- Konfigurasi database:
- Server:
localhost - Database:
roundcubemail - User:
roundcube - Password:
password123(sesuai yang dibuat tadi)
- Server:
- Konfigurasi IMAP:
localhost, port143 - Konfigurasi SMTP:
localhost, port25 - Klik Create config → Initialize database
Langkah 6: Hapus Folder Installer
rm -rf /var/www/html/roundcube/installer
Langkah 7: Akses Webmail
Buka browser: http://192.168.111.103/roundcube
Login dengan:
- Username:
user1atauuser2 - Password: (sesuai password user Linux)
🔍 TROUBLESHOOTING DASAR
Mail Server Tidak Bisa Dikirim
# Cek log Postfix journalctl -u postfix --no-pager | tail -20 # Cek antrian email mailq # Flush antrian postqueue -f
Dovecot Tidak Bisa Login
# Cek log Dovecot journalctl -u dovecot --no-pager | tail -20 # Cek konfigurasi doveconf -n | head -20
DNS Tidak Resolve
# Cek konfigurasi BIND named-checkconf named-checkzone belajar.local /etc/bind/db.belajar.local # Restart BIND systemctl restart bind9
Perintah Berguna untuk Siswa
# Cek status semua layanan
systemctl status bind9 apache2 mariadb postfix dovecot
# Restart semua layanan
systemctl restart bind9 apache2 mariadb postfix dovecot
# Monitor log realtime
journalctl -f
# Tambah user email baru
adduser --shell /sbin/nologin namauser
mkdir -p /home/namauser/Maildir/{new,cur,tmp}
chown -R namauser:namauser /home/namauser/Maildir
📋 CHECKLIST AKHIR
| No | Pengujian | Perintah | Hasil OK |
|---|---|---|---|
| 1 | DNS aktif | systemctl is-active bind9 |
active |
| 2 | MX record | dig MX belajar.local |
mailserver.belajar.local |
| 3 | Apache aktif | systemctl is-active apache2 |
active |
| 4 | Database aktif | systemctl is-active mariadb |
active |
| 5 | Postfix aktif | systemctl is-active postfix |
active |
| 6 | Port 25 terbuka | grep :25 | LISTEN |
| 7 | Dovecot aktif | systemctl is-active dovecot |
active |
| 8 | Port 143 terbuka | grep :143 | LISTEN |
| 9 | Kirim email Telnet | telnet localhost 25 |
220 banner muncul |
| 10 | Email masuk | ls /home/user2/Maildir/new/ |
ada file |
| 11 | Webmail bisa diakses | Browser ke /roundcube |
halaman login muncul |
🎓 TUGAS PRAKTIKUM
- ✅ Instal mail server sesuai tutorial ini
- ✅ Buat 3 akun email:
siswa1,siswa2,guru - ✅ Kirim email dari
siswa1kesiswa2via Telnet - ✅ Verifikasi email masuk ke Maildir
siswa2 - ✅ Login ke webmail Roundcube dengan akun
guru - ✅ Kirim email via webmail dari
gurukesiswa1 - ✅ Dokumentasikan setiap langkah dengan screenshot
- ✅ Buat laporan praktikum dalam format PDF
📚 REFERENSI
- Postfix Official Documentation
- Dovecot Official Documentation
- Roundcube Webmail
- BIND9 Documentation
- Modul Praktikum TKJ SMK — Administrasi Server Linux


