Debian 12 (Bookworm) adalah rilis Long Term Support (LTS) yang menawarkan stabilitas dan keamanan tertinggi untuk production servers. Artikel ini membahas instalasi Debian 12 Server dengan konfigurasi optimal untuk environment production.
Persiapan Instalasi
System Requirements
Minimum:
– CPU: 1 GHz dual-core processor
– RAM: 512 MB
– Storage: 10 GB
– Network: Ethernet/WiFi
Recommended untuk Production:
– CPU: 2 GHz quad-core atau lebih
– RAM: 2 GB+ (4-8 GB untuk aplikasi berat)
– Storage: 50 GB+ SSD
– Network: Gigabit Ethernet
Download ISO Debian 12
# Download dari mirror resmi
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.1.0-amd64-netinst.iso
Verifikasi checksum
sha512sum debian-12.1.0-amd64-netinst.iso
Bandingkan dengan SHA512SUMS di website
Buat Bootable USB
# Using dd (Linux/Mac)
sudo dd if=debian-12.1.0-amd64-netinst.iso of=/dev/sdX bs=4M status=progress
Atau menggunakan Ventoy, Rufus (Windows)
Proses Instalasi
1. Boot dari USB
- Masukkan USB dan boot komputer
- Pilih “Install” (bukan Graphical Install untuk server)
- Pilih bahasa: English (recommended untuk server)
- Pilih lokasi: Indonesia atau United States
- Pilih locale: en_US.UTF-8
2. Konfigurasi Network
Configure the network:
– Hostname: server01 atau nama yang deskriptif
– Domain: company.local atau kosong untuk local domain
IP Configuration (Static untuk server):
IP Address: 192.168.1.100
Netmask: 255.255.255.0
Gateway: 192.168.1.1
Name Servers: 8.8.8.8, 8.8.4.4
3. Partisi Disk
Untuk Production Server (LVM recommended):
- /boot: 512 MB (ext4)
- /boot/efi: 200 MB (EFI System Partition, jika UEFI)
- LVG (Logical Volume Group): Sisanya
- / (root): 20 GB (ext4)
- /var: 10 GB (ext4)
- /tmp: 5 GB (ext4)
- /home: 10 GB (ext4)
- swap: 4 GB (atau 2x RAM untuk < 8GB)
- /srv: 20 GB+ (ext4, untuk data aplikasi)
- free space: untuk future expansion
Panduan Partisi Manual:
1. Pilih "Manual" partitioning
2. Create partition table: GPT untuk UEFI, msdos untuk BIOS
3. Buat partitions sesuai layout di atas
4. Set filesystem: ext4 untuk semua kecuali swap dan EFI
5. Set mountpoints
6. Enable LVM jika menggunakan
7. Review dan confirm changes
4. Setup User Accounts
Root Password:
– Masukkan password yang kuat untuk root
– Minimal 12 karakter, kombinasi huruf, angka, simbol
Create User Account:
– Full name: Admin User
– Username: admin
– Password: [password kuat]
5. Software Selection
Untuk Minimal Server:
– [ ] Debian desktop environment
– [ ] GNOME
– [ ] KDE
– [ ] …
– [x] SSH server
– [x] Standard system utilities
– [ ] Web server (pilih jika butuh Apache/Nginx)
Production Recommendation:
Pilih minimal installation dan install services nanti secara manual.
6. GRUB Boot Loader
- Install GRUB to MBR jika single disk
- Atau ke EFI partition jika UEFI
Konfigurasi Post-Installasi
1. Update Sistem
# Login sebagai root atau sudo
su -
# atau:
sudo -i
Update package list
apt update
Upgrade semua packages
apt upgrade -y
Install necessary tools
apt install -y sudo vim nano curl wget htop net-tools
2. Konfigurasi Sudo
# Add user ke sudo group
usermod -aG sudo admin
Atau edit /etc/sudoers
visudo
Tambahkan:
admin ALL=(ALL:ALL) ALL
Alternatif: passwordless sudo (HATI-HATI!)
admin ALL=(ALL) NOPASSWD: ALL
3. Konfigurasi Network (Static IP)
Edit /etc/network/interfaces:
# Untuk dhcp (default)
auto eth0
iface eth0 inet dhcp
Untuk static IP
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
Atau gunakan NetworkManager:
# Install NetworkManager
apt install -y network-manager
Create connection profile
nmcli connection add type ethernet con-name "static-eth0" ifname eth0 ip4 192.168.1.100/24 gw4 192.168.1.1
nmcli connection modify "static-eth0" ipv4.dns "8.8.8.8,8.8.4.4"
nmcli connection up "static-eth0"
4. Security Hardening
Disable Root Login SSH
# Edit sshd_config
nano /etc/ssh/sshd_config
Ubah atau tambahkan:
PermitRootLogin no
PasswordAuthentication no # Setelah setup key-based auth
PubkeyAuthentication yes
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Restart SSH
systemctl restart ssh
Setup SSH Key Authentication
# Generate key di client
ssh-keygen -t ed25519 -C "admin@server"
Copy key ke server
ssh-copy-id [email protected]
Test login dengan key
Install dan Konfigurasi Fail2Ban
“`bash
Install fail2ban
apt install -y fail2ban
Create local config
cat > /etc/fail2ban/jail.local <<EOF
[DEFAULT]
bantime = 3600
findtime = 600
maxretry = 3
[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
Ditulis oleh
Hendra Wijaya