ABDURROZAK
HOME ABOUT ME MICROSITE KONTAK PERSEMBAHAN HELP
ABDURROZAK.MY.ID // DEBIAN LINUX SERVER FUNDAMENTAL

INSTALASI DEBIAN SERVERDARI NOL SAMPAI JADI

Volume 02 dari seri Debian Linux Server Fundamental. Panduan step-by-step install Debian Server dari bootable media hingga sistem siap pakai. Setiap tahap installer dijelaskan detail dengan screenshot mockup, penjelasan parameter, dan tips troubleshooting. Termasuk partisi disk, konfigurasi network, user management, repository, dan instalasi SSH Server.

VOLUME02 / 17
SUB-BAB15
BACA120 MENIT
OSDebian 12
ABDUR ROZAK, S.Kom. Web Developer & System Administrator - abdurrozak.my.id
VOLUME 02 / 17

INSTAL DEBIAN SERVER DARI NOL

Panduan lengkap instalasi Debian Server step-by-step. Dari persiapan hardware, boot dari media, konfigurasi installer, partisi disk (guided & manual), setup user & password, pemilihan software, instalasi GRUB, first boot, konfigurasi repository, update sistem, hingga instalasi SSH Server. Setiap langkah dijelaskan detail dengan penjelasan command dan parameter.
SUB-BAB15 LEVELInstallation WAKTU120 MENIT
01
SUB-BAB 01 PREPARATION

PERSIAPAN INSTALASI

Checklist Persiapan

Sebelum mulai instalasi, pastikan semua persiapan berikut sudah selesai:

HARDWARE SIAP
Server/VM dengan spek minimum terpenuhi (CPU 1GHz, RAM 512MB, Storage 2GB)
ISO DEBIAN
ISO netinst Debian 12 sudah didownload & checksum verified
BOOTABLE MEDIA
USB bootable atau ISO mounted di VM
BACKUP DATA
Data penting di-backup (jika install di physical server)
INFO NETWORK
Catat IP, gateway, DNS (untuk static IP)
CATATAN KONFIGURASI
Siapkan catatan: hostname, domain, user, password

Spesifikasi Minimum vs Recommended

KOMPONENMINIMUMRECOMMENDEDUNTUK
CPU1 GHz2+ cores, 2+ GHzServer production
RAM512 MB2+ GBWeb server, database
Storage2 GB20+ GB SSDServer dengan data
Network1 NIC2+ NIC (redundancy)High availability

Template Catatan Instalasi

TEMPLATE
# Catat informasi berikut sebelum instalasi: Hostname : web-server Domain : example.com FQDN : web-server.example.com Root Password : [password kuat 12+ karakter] User Name : admin User Password : [password kuat] User Full Name : Administrator Network Config : Method : Static / DHCP IP Address : 192.168.1.10 Netmask : 255.255.255.0 Gateway : 192.168.1.1 DNS : 8.8.8.8, 1.1.1.1 Timezone : Asia/Jakarta Locale : en_US.UTF-8 Keyboard : English (US) Partitioning : Guided / Manual Filesystem : ext4 / xfs Use LVM : Yes / No Encrypt : Yes / No
TIPS: Simpan catatan ini di tempat aman! Password root dan user sulit di-reset jika lupa. Pertimbangkan gunakan password manager seperti Bitwarden atau KeePass.
KOMPETENSI SUB-BAB 01
  • Memahami checklist persiapan instalasi
  • Menentukan spesifikasi hardware yang sesuai
  • Mampu menyiapkan template catatan instalasi
02
SUB-BAB 02 BOOT

BOOT DARI MEDIA INSTALASI

Langkah Boot

1
MASUK BIOS/UEFI

1. Nyalakan server/VM.

2. Tekan tombol masuk BIOS/UEFI:

BRANDTOMBOL BIOSTOMBOL BOOT MENU
DellF2F12
HPF10 / EscF9
LenovoF1 / F2F12
AsusF2 / DelF8 / Esc
AcerF2 / DelF12
VirtualBoxHost+DHost+F12
VMwareF2Esc
2
SET BOOT ORDER

1. Di BIOS, cari menu Boot atau Boot Order.

2. Set USB/CD sebagai first boot device.

3. Atau gunakan Boot Menu (one-time boot) untuk pilih device tanpa ubah BIOS.

4. Save & Exit (biasanya F10).

3
PILIH INSTALLER MODE

Setelah boot dari media, akan muncul GRUB menu Debian Installer:

GNU GRUB version 2.06
* Install
Graphical Install
Advanced options...
Expert install
Rescue mode
Check disc for defects

Pilihan menu:

MENUFUNGSIREKOMENDASI
InstallInstaller text mode (default)✓ Gunakan ini (paling stabil)
Graphical InstallInstaller dengan GUIAlternatif jika punya monitor
Expert installInstaller dengan semua opsiAdvanced users
Rescue modeRescue system yang rusakTroubleshooting
Check discVerifikasi integritas mediaPertama kali install

Pilih Install (text mode) dan tekan Enter.

TIPS: Text mode lebih ringan dan stabil dibanding Graphical Install. Untuk server yang headless (tanpa monitor), text mode adalah pilihan terbaik.
KOMPETENSI SUB-BAB 02
  • Mampu masuk BIOS/UEFI dan set boot order
  • Memahami pilihan menu GRUB Debian Installer
  • Memilih mode instalasi yang tepat
03
SUB-BAB 03 CONFIG

KONFIGURASI AWAL INSTALLER

Language Selection

Langkah pertama installer adalah memilih bahasa. Untuk server, direkomendasikan English agar pesan error dan dokumentasi sesuai.

Select a language
* English
Bahasa Indonesia
Deutsch
Español
Français

Location & Keyboard

Select your location
United States
other
Asia
Indonesia
Configure the keyboard
Country of origin: United States
Keyboard layout: English (US)
Detect keyboard layout? No
REKOMENDASI: Gunakan English (US) untuk keyboard layout. Layout ini universal dan memudahkan saat konfigurasi server via SSH dari berbagai client.

Loading Components

Installer akan me-load komponen dasar:

Detecting hardware
Mendeteksi CPU, RAM, disk, network card
Loading additional components
Load driver dan tools yang dibutuhkan
Configuring network
Detect network interfaces, DHCP/autoconfig
KOMPETENSI SUB-BAB 03
  • Mampu memilih language, location, keyboard
  • Memahami proses loading komponen installer
04
SUB-BAB 04 NETWORK

KONFIGURASI NETWORK

Detect Network Interfaces

Installer akan mendeteksi network interfaces yang tersedia:

Network interface selection
Network interfaces found:
eth0 - eth0
eth1 - eth1
No network interfaces found

Pilih interface yang akan digunakan (biasanya eth0 atau ens33 untuk VM).

DHCP vs Static IP

Configure the network
Network configuration method:
Auto (DHCP)
Manual
Do not configure the network at this time

Opsi 1: DHCP (Recommended untuk Belajar)

Pilih Auto (DHCP). Installer akan otomatis dapat IP dari DHCP server.

DHCP successful
Network configuration:
IP address : 192.168.1.100
Netmask : 255.255.255.0
Gateway : 192.168.1.1
DNS servers : 192.168.1.1
Domain : local

Opsi 2: Manual (Static IP)

Pilih Manual untuk set IP static. Cocok untuk server production.

IP address
Netmask
Gateway
Name server addresses
TIPS: Untuk server production, selalu gunakan Static IP. IP yang berubah-ubah akan menyulitkan akses remote dan konfigurasi service. Untuk belajar, DHCP sudah cukup.

Hostname & Domain

Setelah network dikonfigurasi, installer minta hostname dan domain:

Hostname
Domain name
(Leave empty if not part of a domain)
HOSTNAME RULES: Gunakan huruf kecil, angka, dan dash (-). Tidak boleh spasi atau karakter khusus. Contoh valid: web-server, db01, mail-server.
KOMPETENSI SUB-BAB 04
  • Mampu pilih network interface
  • Membedakan DHCP dan Static IP
  • Mampu konfigurasi network manual
  • Mampu set hostname dan domain
05
SUB-BAB 05 HOSTNAME

HOSTNAME & DOMAIN

Apa Itu Hostname?

Hostname adalah nama unik yang mengidentifikasi server dalam jaringan. Seperti nama orang, hostname memudahkan kita mengenali server tanpa harus hafal IP address.

KOMPONENCONTOHDESKRIPSI
Hostnameweb-serverNama singkat server
Domainexample.comDomain name
FQDNweb-server.example.comFully Qualified Domain Name (hostname + domain)

Konfigurasi Hostname (Setelah Install)

Setelah instalasi selesai, kamu bisa ubah hostname dengan command berikut:

BASH
# Lihat hostname saat ini hostnamectl ↳ Menampilkan hostname, kernel, OS, architecture, dll # Static hostname: web-server # Icon name: computer-vm # Chassis: vm # Operating System: Debian GNU/Linux 12 (bookworm) # Kernel: Linux 6.1.0-18-amd64 # Ganti hostname sudo hostnamectl set-hostname new-web-server ↳ Set hostname baru (perlu reboot atau relogin untuk apply) # Edit /etc/hosts sudo nano /etc/hosts ↳ File mapping hostname ke IP # Isi file: 127.0.0.1 localhost 127.0.1.1 web-server.example.com web-server ::1 localhost ip6-localhost ip6-loopback # Verifikasi hostname baru hostname # new-web-server hostname -f ↳ -f = FQDN (Fully Qualified Domain Name) # new-web-server.example.com
PENTING: Setelah ganti hostname, edit juga /etc/hosts agar hostname baru bisa di-resolve. Jika tidak, beberapa service (seperti sudo, SSH) bisa error.
KOMPETENSI SUB-BAB 05
  • Memahami perbedaan hostname, domain, FQDN
  • Mampu cek dan ganti hostname dengan hostnamectl
  • Mampu edit /etc/hosts
06
SUB-BAB 06 USER

USER & PASSWORD

Root Password

Installer akan minta password untuk user root (superuser). Root memiliki akses penuh ke sistem - bisa melakukan apa saja termasuk merusak sistem!

Root password
Re-enter password to verify
PERINGATAN: Password root harus SANGAT KUAT! Minimal 12 karakter, kombinasi huruf besar/kecil, angka, simbol. Jangan gunakan password yang mudah ditebak!

User Account Biasa

Setelah root password, installer minta buat user account biasa. User ini untuk日常 penggunaan (bukan root).

Full name for the new user
Username for your account
Choose a password for the new user
Re-enter password to verify

Konfigurasi User Setelah Install

BASH
# Lihat user yang ada cat /etc/passwd ↳ File berisi info semua user ↳ Format: username:password:UID:GID:comment:home:shell # Lihat user dengan UID >= 1000 (user biasa) awk -F: '$3 >= 1000 {print $1}' /etc/passwd ↳ UID >= 1000 adalah user biasa (bukan system user) # Tambah user ke group sudo (agar bisa pakai sudo) sudo usermod -aG sudo admin ↳ -aG = append to group (tambah ke group tanpa hapus dari group lain) ↳ sudo = group yang punya akses sudo # Verifikasi group user groups admin # admin : admin sudo # Ganti password user sudo passwd admin ↳ Ganti password untuk user admin # Ganti password root sudo passwd root ↳ Ganti password root # Test sudo sudo whoami ↳ Minta password user, lalu tampilkan "root" # root

Tips Password Kuat

KRITERIACONTOH LEMAHCONTOH KUAT
Panjang12345678Min 12 karakter
KompleksitaspasswordP@ssw0rd!2026#Server
Personal Infoadmin2026Tidak ada nama/tgl lahir
Kamusadmin, rootRandom phrase: K0p!Susu#B4ngunPgi
ReuseSama dengan emailUnik per server
TIPS: Gunakan passphrase daripada password. Passphrase adalah kalimat yang mudah diingat tapi sulit ditebak. Contoh: Kopi-Susu-Pagi-Hari-2026!
KOMPETENSI SUB-BAB 06
  • Mampu set root password yang kuat
  • Mampu buat user account biasa
  • Mampu tambah user ke group sudo
  • Mengenal kriteria password kuat
07
SUB-BAB 07 PARTITION

PARTISI DISK - GUIDED

Apa Itu Partisi?

Partisi adalah pembagian disk menjadi beberapa bagian logis. Setiap partisi bisa diformat dengan filesystem berbeda dan digunakan untuk tujuan berbeda (/, /home, /var, swap, dll).

Guided Partitioning (Recommended)

Installer akan tanya metode partisi:

Partition disks
Partitioning method:
Guided - use entire disk
Guided - use entire disk and set up LVM
Guided - use entire disk and encrypt with LUKS
Manual
METODEDESKRIPSIUSE CASE
Guided - entire diskPartisi otomatis, simplePemula, VM testing
Guided - LVMDengan Logical Volume ManagerProduction server, fleksibel
Guided - LUKSEncrypted LVMHigh security requirement
ManualPartisi manual full controlAdvanced users
1
PILIH DISK
Select disk to partition
SCSI1 (0,0,0) (sda) - 21.5 GB VMware

Pilih disk yang akan dipartisi. Hati-hati pilih yang benar!

2
PARTITIONING SCHEME
Partitioning scheme
All files in one partition (recommended for new users)
Separate /home partition
Separate /home, /var, and /tmp partitions
SCHEMEPARTISIUSE CASE
All files in one/ + swapSimple, untuk pemula
Separate /home/ + /home + swapUser data terpisah
Separate /home, /var, /tmp/ + /home + /var + /tmp + swapServer production (RECOMMENDED)
3
CONFIRM & WRITE
Write the changes to disks?
Yes
No

Installer akan format disk dan buat partisi sesuai skema yang dipilih.

Hasil Partisi (All files in one)

PARTISISIZEMOUNT POINTFILESYSTEM
/dev/sda1~512 MB/boot/efiFAT32 (UEFI)
/dev/sda2Remaining/ext4
/dev/sda3~2x RAM[swap]swap
UEFI vs BIOS: Jika boot dari UEFI, akan ada partisi EFI (FAT32). Jika boot dari BIOS legacy, tidak ada partisi EFI. Installer otomatis detect.
KOMPETENSI SUB-BAB 07
  • Memahami konsep partisi disk
  • Membedakan metode partisi (guided vs manual)
  • Mampu pilih partitioning scheme yang tepat
08
SUB-BAB 08 PARTITION

PARTISI DISK - MANUAL

Kapan Pakai Manual?

Pilih Manual jika kamu butuh kontrol penuh atas partisi. Cocok untuk:

SERVER PRODUCTION
Pemisahan /var, /home, /tmp untuk security & backup
DATABASE SERVER
Partisi terpisah untuk data database
FLEKSIBILITAS
Resize partisi tanpa reinstall
SECURITY
Mount /tmp dengan noexec,nosuid

Langkah Partisi Manual

1
PILIH MANUAL
Partitioning method
Guided - use entire disk
Guided - use entire disk and set up LVM
Manual
2
CREATE PARTITION TABLE
SCSI1 (0,0,0) (sda) - 21.5 GB VMware
Create new empty partition table on this device

Konfirmasi Yes untuk buat partition table baru (akan hapus semua data!).

3
CREATE PARTITIONS

Buat partisi satu per satu dengan klik FREE SPACECreate a new partition:

PARTISISIZETYPEMOUNT POINTOPTIONS
sda1512 MBPrimary/boot/efiEFI System
sda21 GBPrimary/bootext4
sda320 GBPrimary/ext4
sda420 GBPrimary/varext4
sda510 GBLogical/tmpext4, noexec,nosuid,nodev
sda6RemainingLogical/homeext4
sda72x RAMLogical[swap]swap area
Create a new partition (sda)
Type: Primary / Logical
Location: Beginning / End
Partition settings
Use as: Ext4 journaling file system
Mount point: / - the root file system
Mount options: defaults
Done setting up the partition
4
FINISH & WRITE

Setelah semua partisi dibuat, pilih Finish partitioning and write changes to disk.

Write the changes to disks?
Yes

Rekomendasi Layout untuk Server

MOUNT POINTMIN SIZERECOMMENDEDALASAN
/boot500 MB1 GBKernel & bootloader files
/10 GB20 GBRoot filesystem, OS files
/var10 GB20-50 GBLogs, databases, mail spool
/tmp5 GB10 GBTemporary files, bisa di-mount noexec
/home10 GBRemainingUser data
swap1x RAM2x RAMVirtual memory
TIPS: Untuk server production, pisahkan /var agar log yang membesar tidak memenuhi root partition. Pisahkan /home agar data user aman saat reinstall OS.
KOMPETENSI SUB-BAB 08
  • Mampu partisi disk secara manual
  • Mengenal mount point dan filesystem
  • Mampu merancang layout partisi untuk server
09
SUB-BAB 09 SOFTWARE

SOFTWARE SELECTION

Tasksel - Software Selection

Installer akan tanya software apa yang akan diinstall. Gunakan spasi untuk pilih/lepas, tab untuk navigasi, enter untuk konfirmasi.

Software selection
Choose software to install:
[ ] Debian desktop environment
... GNOME
... Xfce
... KDE
[*] web server
[*] SSH server
[*] standard system utilities
[ ] print server

Rekomendasi untuk Server

SOFTWAREINSTALL?ALASAN
Debian desktop environment❌ NOServer tidak butuh GUI
... GNOME/XFCE/KDE❌ NODesktop environment
web server✓ YESJika butuh web server (Apache/Nginx)
SSH server✓ YESWAJIB untuk remote access
standard system utilities✓ YESTools dasar (curl, wget, nano, dll)
print server❌ NOKecuali butuh print server
TIPS: Untuk server production, hanya install yang dibutuhkan. Semakin sedikit package, semakin kecil attack surface dan semakin stabil sistem.

Proses Instalasi Package

Installer akan download dan install package yang dipilih. Proses ini bisa memakan waktu beberapa menit tergantung kecepatan internet.

Installing the base system
Installing base system...
[================> ] 50%
Current: base-files
KOMPETENSI SUB-BAB 09
  • Mampu pilih software yang tepat untuk server
  • Memahami tasksel dan package selection
  • Mengetahui proses instalasi package
10
SUB-BAB 10 BOOTLOADER

GRUB BOOTLOADER

Install GRUB

GRUB (GRand Unified Bootloader) adalah bootloader yang memuat kernel Linux saat boot. Installer akan tanya apakah install GRUB ke Master Boot Record (MBR).

Install the GRUB boot loader to the master boot record?
Yes
No
Continue without boot loader
Device for boot loader installation
/dev/sda
Enter device manually
PENTING: Pilih /dev/sda (disk), BUKAN /dev/sda1 (partisi). GRUB harus diinstall ke MBR disk, bukan partisi.

Finish Installation

Setelah GRUB terinstall, installer akan selesai:

Finish the installation
Installation complete
Continue

Sistem akan reboot. Cabut USB/CD sebelum reboot agar tidak boot kembali ke installer.

KOMPETENSI SUB-BAB 10
  • Memahami fungsi GRUB bootloader
  • Mampu install GRUB ke MBR
  • Mengetahui proses finish installation
11
SUB-BAB 11 FIRST BOOT

FIRST BOOT

Login Pertama

Setelah reboot, kamu akan melihat login prompt:

CONSOLE
Debian GNU/Linux 12 web-server tty1 web-server login: admin Password: •••••••• Linux web-server 6.1.0-18-amd64 #1 SMP ... The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. admin@web-server:~$

Cek Informasi Sistem

BASH
# Lihat versi Debian cat /etc/debian_version # 12.5 # Lihat info lengkap OS lsb_release -a # Distributor ID: Debian # Description: Debian GNU/Linux 12 (bookworm) # Release: 12 # Codename: bookworm # Lihat kernel version uname -r # 6.1.0-18-amd64 # Lihat hostname hostnamectl # Static hostname: web-server # Icon name: computer-vm # Operating System: Debian GNU/Linux 12 (bookworm) # Kernel: Linux 6.1.0-18-amd64 # Lihat IP address ip addr show # 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 # inet 192.168.1.10/24 brd 192.168.1.255 scope global eth0 # Lihat disk usage df -h # Filesystem Size Used Avail Use% Mounted on # /dev/sda3 20G 2.1G 17G 11% / # /dev/sda4 20G 600M 18G 4% /var # /dev/sda6 15G 120M 14G 1% /home # Lihat memory usage free -h # total used free shared buff/cache available # Mem: 1.9Gi 220Mi 1.4Gi 4.0Mi 320Mi 1.6Gi # Swap: 2.0Gi 0B 2.0Gi # Lihat uptime uptime # 10:30:15 up 5 min, 1 user, load average: 0.08, 0.03, 0.01
KOMPETENSI SUB-BAB 11
  • Mampu login ke sistem baru
  • Mampu cek informasi sistem (OS, kernel, IP, disk, memory)
  • Memahami struktur output command dasar
12
SUB-BAB 12 REPOSITORY

KONFIGURASI REPOSITORY

Apa Itu Repository?

Repository adalah server yang menyimpan ribuan package Debian. Saat kamu install software dengan apt install, package didownload dari repository ini.

File sources.list

Konfigurasi repository ada di /etc/apt/sources.list:

BASH
# Lihat isi sources.list cat /etc/apt/sources.list # deb http://deb.debian.org/debian/ bookworm main # deb http://deb.debian.org/debian/ bookworm-updates main # deb http://security.debian.org/debian-security bookworm-security main # Edit sources.list sudo nano /etc/apt/sources.list # Format baris repository: # deb [URL] [distribution] [components] # deb = binary package # deb-src = source package (untuk compile) # Components: # main = Free software (DFSG-compliant) # contrib = Free software but depends on non-free # non-free = Non-free software # non-free-firmware = Non-free firmware (Debian 12+)

Konfigurasi Repository Lengkap

BASH
# Backup sources.list asli sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup # Edit sources.list dengan nano sudo nano /etc/apt/sources.list # Ganti isi dengan: # Debian 12 (Bookworm) - Official Repository deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware # Simpan: Ctrl+O, Enter, Ctrl+X # Gunakan mirror Indonesia (lebih cepat) sudo nano /etc/apt/sources.list # Ganti URL dengan mirror Indonesia: deb http://kartolo.sby.datautama.net.id/debian/ bookworm main contrib non-free non-free-firmware deb http://kartolo.sby.datautama.net.id/debian/ bookworm-updates main contrib non-free non-free-firmware deb http://kartolo.sby.datautama.net.id/debian-security bookworm-security main contrib non-free non-free-firmware # Mirror Indonesia populer: # - http://kartolo.sby.datautama.net.id/debian/ # - http://kebo.pens.ac.id/debian/ # - http://mirror.poliwangi.ee.itb.ac.id/debian/ # - http://mirror.pdii.lipi.go.id/debian/ # Update package list sudo apt update ↳ Download daftar package terbaru dari repository # Hit:1 http://kartolo.sby.datautama.net.id/debian bookworm InRelease # Hit:2 http://kartolo.sby.datautama.net.id/debian bookworm-updates InRelease # Hit:3 http://kartolo.sby.datautama.net.id/debian-security bookworm-security InRelease # Reading package lists... Done # Building dependency tree... Done # All packages are up to date.
TIPS: Gunakan mirror Indonesia untuk download lebih cepat. Jika mirror lambat, bisa kembali ke official repository deb.debian.org.
KOMPETENSI SUB-BAB 12
  • Memahami konsep repository Debian
  • Mampu edit /etc/apt/sources.list
  • Mampu konfigurasi mirror Indonesia
  • Mampu jalankan apt update
13
SUB-BAB 13 UPDATE

UPDATE & UPGRADE SISTEM

Perbedaan Update vs Upgrade

COMMANDFUNGSIKAPAN PAKAI
apt updateUpdate daftar package dari repositorySebelum install/upgrade
apt upgradeUpgrade package ke versi terbaruSetelah apt update
apt dist-upgradeUpgrade + smart dependency handlingUpgrade besar, bisa remove/install package
apt full-upgradeSama dengan dist-upgradeAlternatif nama

Langkah Update Sistem

BASH
# 1. Update package list (WAJIB pertama) sudo apt update ↳ Download daftar package terbaru dari repository ↳ Tidak upgrade package, hanya update daftar # 2. Upgrade package sudo apt upgrade -y ↳ -y = auto-yes, tidak tanya konfirmasi ↳ Upgrade semua package ke versi terbaru ↳ Tidak akan remove/install package baru # 3. Dist-upgrade (opsional, untuk upgrade besar) sudo apt dist-upgrade -y ↳ Upgrade dengan smart dependency handling ↳ Bisa remove/install package jika perlu ↳ Gunakan dengan hati-hati! # 4. Autoremove (hapus package tidak terpakai) sudo apt autoremove -y ↳ Hapus package yang tidak lagi dibutuhkan ↳ Membersihkan dependency lama # 5. Autoclean (hapus cached package) sudo apt autoclean ↳ Hapus cached .deb files yang obsolete # 6. Reboot (jika kernel diupdate) sudo reboot ↳ Wajib reboot jika kernel diupdate # Cek apakah perlu reboot sudo ls /var/run/reboot-required ↳ Jika file ada, berarti perlu reboot

Script Update Lengkap

SCRIPT
#!/bin/bash # Script update Debian Server # Simpan di: /usr/local/bin/update-server.sh echo "=== Update Package List ===" sudo apt update echo "=== Upgrade Packages ===" sudo apt upgrade -y echo "=== Autoremove Unused Packages ===" sudo apt autoremove -y echo "=== Autoclean Cache ===" sudo apt autoclean echo "=== Check Reboot Required ===" if [ -f /var/run/reboot-required ]; then echo "Reboot required! Please reboot soon." else echo "No reboot required." fi echo "=== Update Complete ==="
BASH
# Buat script executable sudo nano /usr/local/bin/update-server.sh # Paste script di atas, simpan sudo chmod +x /usr/local/bin/update-server.sh # Jalankan script sudo /usr/local/bin/update-server.sh
TIPS: Jalankan update script secara berkala (misal setiap minggu) untuk menjaga sistem tetap aman dengan security updates terbaru.
KOMPETENSI SUB-BAB 13
  • Memahami perbedaan apt update, upgrade, dist-upgrade
  • Mampu update sistem dengan benar
  • Mampu buat script update otomatis
14
SUB-BAB 14 SSH

INSTALASI SSH SERVER

Apa Itu SSH?

SSH (Secure Shell) adalah protokol untuk remote access ke server secara aman (encrypted). SSH menggantikan Telnet yang tidak aman. Dengan SSH, kamu bisa:

REMOTE TERMINAL
Akses command line server dari mana saja
FILE TRANSFER
SCP/SFTP untuk transfer file aman
ENCRYPTED
Semua data terenkripsi, aman dari sniffing
KEY-BASED AUTH
Login tanpa password dengan SSH key

Install SSH Server

BASH
# 1. Install OpenSSH Server sudo apt install openssh-server -y ↳ Install package openssh-server ↳ -y = auto-yes # Reading package lists... Done # The following NEW packages will be installed: # ncurses-term openssh-server openssh-sftp-server # 0 upgraded, 3 newly installed, 0 to remove # 2. Cek status SSH service sudo systemctl status ssh ↳ Lihat status SSH service # ● ssh.service - OpenBSD Secure Shell server # Loaded: loaded (/lib/systemd/system/ssh.service; enabled) # Active: active (running) since ... # Docs: man:sshd(8) # 3. Enable SSH start on boot sudo systemctl enable ssh ↳ SSH akan otomatis start saat boot # Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service # 4. Start SSH (jika belum running) sudo systemctl start ssh # 5. Cek port SSH sudo ss -tulpn | grep ssh ↳ -t = TCP, -u = UDP, -l = listening, -p = program, -n = numeric # tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=...)) # 6. Allow SSH di firewall (jika UFW aktif) sudo ufw allow ssh ↳ Allow SSH (port 22) # Rules updated # Atau allow specific port sudo ufw allow 22/tcp

Konfigurasi SSH

BASH
# Backup config asli sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup # Edit SSH config sudo nano /etc/ssh/sshd_config # Konfigurasi penting: Port 2222 ↳ Ubah port SSH (default 22) untuk security by obscurity PermitRootLogin no ↳ Disable root login via SSH (security) PasswordAuthentication no ↳ Disable password auth (pakai key saja) PubkeyAuthentication yes ↳ Enable key-based authentication AllowUsers admin deploy ↳ Hanya user tertentu yang bisa SSH AllowGroups sshusers ↳ Hanya group tertentu yang bisa SSH MaxAuthTries 3 ↳ Max percobaan login sebelum disconnect ClientAliveInterval 300 ↳ Keep-alive interval (detik) ClientAliveCountMax 2 ↳ Max missed keep-alive sebelum disconnect # Restart SSH setelah edit config sudo systemctl restart ssh # Cek status setelah restart sudo systemctl status ssh

Test SSH Connection

DARI CLIENT LAIN
# SSH ke server (dari Windows/Linux/Mac) ssh admin@192.168.1.10 ↳ Login sebagai user admin ke server # admin@192.168.1.10's password: # Linux web-server 6.1.0-18-amd64 ... # admin@web-server:~$ # SSH dengan port custom ssh -p 2222 admin@192.168.1.10 ↳ -p 2222 = specify port # SSH dengan verbose mode (debug) ssh -v admin@192.168.1.10 ↳ -v = verbose, tampilkan detail koneksi # Copy file ke server (SCP) scp file.txt admin@192.168.1.10:/home/admin/ ↳ Copy file.txt ke /home/admin/ di server # Copy file dari server scp admin@192.168.1.10:/home/admin/file.txt . ↳ Copy file.txt dari server ke current directory # Copy directory (recursive) scp -r dir/ admin@192.168.1.10:/home/admin/ ↳ -r = recursive, copy directory beserta isinya
TIPS: Untuk production server, selalu: (1) Ubah port default, (2) Disable root login, (3) Pakai SSH key, (4) Batasi user yang bisa SSH, (5) Pakai fail2ban untuk proteksi brute force.
KOMPETENSI SUB-BAB 14
  • Mampu install dan konfigurasi SSH server
  • Mampu hardening SSH (disable root, change port)
  • Mampu test SSH connection dari client
  • Mampu transfer file dengan SCP
15
SUB-BAB 15 VERIFICATION

VERIFIKASI & TROUBLESHOOTING

Checklist Verifikasi

VERIFICATION
# 1. Cek versi Debian cat /etc/debian_version # 12.5 # 2. Cek hostname hostnamectl # Static hostname: web-server # 3. Cek IP address ip addr show # inet 192.168.1.10/24 ... # 4. Cek connectivity ping -c 4 8.8.8.8 # 4 packets transmitted, 4 received, 0% packet loss ping -c 4 google.com # 4 packets transmitted, 4 received, 0% packet loss # 5. Cek DNS resolution dig google.com # ;; ANSWER SECTION: # google.com. 300 IN A 142.250.1.100 # 6. Cek SSH service sudo systemctl status ssh # Active: active (running) # 7. Cek SSH port sudo ss -tulpn | grep :22 # tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* # 8. Cek disk usage df -h # 9. Cek memory usage free -h # 10. Cek user id # uid=1000(admin) gid=1000(admin) groups=1000(admin),27(sudo)

Troubleshooting Umum

MASALAHGEJALASOLUSI
Tidak bisa SSH Connection refused / timeout Cek SSH service running, cek firewall, cek port
Tidak ada internet Ping 8.8.8.8 gagal Cek IP, gateway, DNS. Cek ip route
DNS tidak resolve Ping google.com gagal, ping 8.8.8.8 OK Cek /etc/resolv.conf, isi DNS server
Repository error apt update gagal Cek /etc/apt/sources.list, cek koneksi internet
Disk full No space left on device Cek df -h, hapus file besar, clean apt cache
Service tidak start systemctl status failed Cek journalctl -u service, perbaiki config

File Konfigurasi Penting

FILEFUNGSI
/etc/hostnameHostname server
/etc/hostsHostname to IP mapping
/etc/network/interfacesNetwork configuration (ifupdown)
/etc/resolv.confDNS configuration
/etc/apt/sources.listAPT repository configuration
/etc/ssh/sshd_configSSH server configuration
/etc/passwdUser account information
/etc/fstabFilesystem mount configuration
SELAMAT! Kamu telah menyelesaikan Volume 02 - Instalasi Debian Server. Server kamu sekarang siap digunakan! Di Volume 03, kita akan belajar Command Line Essentials lebih mendalam. Sampai jumpa!
KOMPETENSI SUB-BAB 15
  • Mampu verifikasi instalasi berhasil
  • Mampu troubleshoot masalah umum
  • Mengenal file konfigurasi penting
VOLUME 02 SELESAI

SELAMAT!

Kamu telah menyelesaikan Volume 02 - Instalasi Debian Server dari nol. Dari persiapan hardware, boot media, konfigurasi installer, partisi disk, setup user & password, pemilihan software, instalasi GRUB, first boot, konfigurasi repository, update sistem, hingga instalasi SSH Server. Server Debian kamu sekarang siap digunakan untuk berbagai service. Di Volume 03, kita akan dalami Command Line Essentials. Sampai jumpa!
SUB-BAB15 LEVELINSTALLATION NEXTCommand Line
ABDURROZAK.MY.ID // TERHUBUNG

JARINGAN SOSIAL

Temukan saya di berbagai platform digital