Konfigurasi Debian Server Kelas XI
Konfigurasi Server Debian — Kelas XI TKJ
Section titled “Konfigurasi Server Debian — Kelas XI TKJ”Ini materi praktek server Debian, dari instalasi sampai konfigurasi layanan yang sering keluar di ujian.
1. Instalasi Debian Server
Section titled “1. Instalasi Debian Server”Persiapan:
Section titled “Persiapan:”- ISO Debian (download dari debian.org)
- VM (VirtualBox/VMware) atau PC fisik
- RAM minimal 512 MB, disk minimal 10 GB
Langkah Instalasi:
Section titled “Langkah Instalasi:”- Boot dari ISO Debian
- Pilih Install (bukan Graphical Install untuk server)
- Pilih bahasa: English
- Pilih lokasi: Indonesia
- Konfigurasi keyboard: American English
- Set hostname:
server-tkj - Set domain:
tkj.local - Set root password:
(isi password kuat) - Buat user biasa:
admin - Pilih partisi: Guided - use entire disk
- Software selection: hanya centang SSH server dan Standard system utilities (jangan install desktop)
- Install GRUB bootloader: Yes
Setelah Install:
Section titled “Setelah Install:”# Login sebagai root, lalu update sistemapt update && apt upgrade -y
# Install tools dasarapt install -y vim curl wget net-tools2. Konfigurasi IP Statik
Section titled “2. Konfigurasi IP Statik”Debian menggunakan file /etc/network/interfaces untuk konfigurasi jaringan.
# Lihat interface yang tersediaip addr show# atauifconfig -a
# Edit file konfigurasi jaringannano /etc/network/interfacesIsi file /etc/network/interfaces:
# Interface loopbackauto loiface lo inet loopback
# Interface eth0 (sesuaikan nama interface)auto eth0iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 8.8.4.4# Restart networkingsystemctl restart networking
# atauifdown eth0 && ifup eth0
# Verifikasi IPip addr show eth0
# Test konektivitasping -c 4 8.8.8.8ping -c 4 google.comDebian 10+ (menggunakan enp3s0 / ens33):
Section titled “Debian 10+ (menggunakan enp3s0 / ens33):”# Nama interface bisa berbeda, cek duluip link show
# Edit sesuai nama interface yang munculnano /etc/network/interfaces3. DHCP Server (isc-dhcp-server)
Section titled “3. DHCP Server (isc-dhcp-server)”Instalasi:
Section titled “Instalasi:”apt install -y isc-dhcp-serverKonfigurasi utama:
Section titled “Konfigurasi utama:”Edit /etc/dhcp/dhcpd.conf:
nano /etc/dhcp/dhcpd.confIsi konfigurasi:
# Global optionsoption domain-name "tkj.local";option domain-name-servers 192.168.1.10, 8.8.8.8;
default-lease-time 600;max-lease-time 7200;
# Authoritative untuk network iniauthoritative;
# Subnet LANsubnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.100 192.168.1.200; option routers 192.168.1.1; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option domain-name-servers 192.168.1.10, 8.8.8.8; default-lease-time 600; max-lease-time 7200;}
# Static IP untuk host tertentuhost pc-guru { hardware ethernet AA:BB:CC:DD:EE:FF; fixed-address 192.168.1.50;}Konfigurasi interface DHCP:
Section titled “Konfigurasi interface DHCP:”Edit /etc/default/isc-dhcp-server:
nano /etc/default/isc-dhcp-server# Tentukan interface yang akan melayani DHCPINTERFACESv4="eth0"# Start dan enable servicesystemctl start isc-dhcp-serversystemctl enable isc-dhcp-server
# Cek statussystemctl status isc-dhcp-server
# Lihat log errorjournalctl -u isc-dhcp-server -n 50
# Lihat leases yang aktifcat /var/lib/dhcp/dhcpd.leases4. DNS Server (BIND9)
Section titled “4. DNS Server (BIND9)”Instalasi:
Section titled “Instalasi:”apt install -y bind9 bind9utils bind9-docKonfigurasi BIND9:
Section titled “Konfigurasi BIND9:”Edit /etc/bind/named.conf.options:
nano /etc/bind/named.conf.optionsoptions { directory "/var/cache/bind";
// Forwarder ke DNS publik forwarders { 8.8.8.8; 8.8.4.4; };
// Izinkan query dari semua allow-query { any; };
// Recursion untuk LAN allow-recursion { 192.168.1.0/24; localhost; };
dnssec-validation auto; listen-on-v6 { any; };};Edit /etc/bind/named.conf.local:
nano /etc/bind/named.conf.local// Zone forward (nama ke IP)zone "tkj.local" { type master; file "/etc/bind/db.tkj.local";};
// Zone reverse (IP ke nama)zone "1.168.192.in-addr.arpa" { type master; file "/etc/bind/db.192.168.1";};Buat file zone forward /etc/bind/db.tkj.local:
nano /etc/bind/db.tkj.local$TTL 604800@ IN SOA server.tkj.local. root.tkj.local. ( 2026010101 ; Serial (YYYYMMDDNN) 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL
; Name Servers@ IN NS server.tkj.local.
; A Recordsserver IN A 192.168.1.10router IN A 192.168.1.1www IN A 192.168.1.10ftp IN A 192.168.1.10Buat file zone reverse /etc/bind/db.192.168.1:
nano /etc/bind/db.192.168.1$TTL 604800@ IN SOA server.tkj.local. root.tkj.local. ( 2026010101 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL
; Name Servers@ IN NS server.tkj.local.
; PTR Records (IP terakhir saja)10 IN PTR server.tkj.local.1 IN PTR router.tkj.local.# Cek syntax konfigurasinamed-checkconfnamed-checkzone tkj.local /etc/bind/db.tkj.localnamed-checkzone 1.168.192.in-addr.arpa /etc/bind/db.192.168.1
# Start BIND9systemctl start bind9systemctl enable bind9systemctl status bind9
# Test DNSnslookup server.tkj.local 192.168.1.10dig @192.168.1.10 server.tkj.localdig @192.168.1.10 -x 192.168.1.105. Web Server (Apache2)
Section titled “5. Web Server (Apache2)”Instalasi:
Section titled “Instalasi:”apt install -y apache2
# Start dan enablesystemctl start apache2systemctl enable apache2systemctl status apache2Virtual Host:
Section titled “Virtual Host:”# Buat direktori untuk websitemkdir -p /var/www/tkj-web/public_html
# Buat halaman web sederhanacat > /var/www/tkj-web/public_html/index.html << 'EOF'<!DOCTYPE html><html><head> <title>Website TKJ SMK</title></head><body> <h1>Selamat Datang di Website TKJ!</h1> <p>Server Debian berhasil dikonfigurasi.</p></body></html>EOF
# Set permissionchown -R www-data:www-data /var/www/tkj-webchmod -R 755 /var/www/tkj-webBuat Virtual Host config:
nano /etc/apache2/sites-available/tkj-web.conf<VirtualHost *:80> ServerName www.tkj.local ServerAlias tkj.local DocumentRoot /var/www/tkj-web/public_html
ErrorLog ${APACHE_LOG_DIR}/tkj-web-error.log CustomLog ${APACHE_LOG_DIR}/tkj-web-access.log combined
<Directory /var/www/tkj-web/public_html> Options -Indexes +FollowSymLinks AllowOverride All Require all granted </Directory></VirtualHost># Aktifkan virtual hosta2ensite tkj-web.conf
# Disable default sitea2dissite 000-default.conf
# Reload Apachesystemctl reload apache2
# Test konfigurasiapache2ctl configtest6. FTP Server (vsftpd)
Section titled “6. FTP Server (vsftpd)”Instalasi:
Section titled “Instalasi:”apt install -y vsftpd
systemctl start vsftpdsystemctl enable vsftpdKonfigurasi /etc/vsftpd.conf:
Section titled “Konfigurasi /etc/vsftpd.conf:”# Backup config aslicp /etc/vsftpd.conf /etc/vsftpd.conf.bak
nano /etc/vsftpd.confKonfigurasi penting:
# Izinkan akses anonymous (tidak disarankan untuk produksi)anonymous_enable=NO
# Izinkan login user lokallocal_enable=YES
# Izinkan uploadwrite_enable=YES
# Chroot user ke home directorychroot_local_user=YESallow_writeable_chroot=YES
# Passive mode (untuk FTP di NAT)pasv_enable=YESpasv_min_port=10000pasv_max_port=10100
# Loggingxferlog_enable=YESxferlog_file=/var/log/vsftpd.log# Buat user FTPuseradd -m -s /bin/bash ftpuserpasswd ftpuser
# Restart vsftpdsystemctl restart vsftpdsystemctl status vsftpd
# Test dari clientftp 192.168.1.107. Samba File Sharing
Section titled “7. Samba File Sharing”Instalasi:
Section titled “Instalasi:”apt install -y samba samba-common-bin
# Backup konfigurasicp /etc/samba/smb.conf /etc/samba/smb.conf.bakKonfigurasi /etc/samba/smb.conf:
Section titled “Konfigurasi /etc/samba/smb.conf:”nano /etc/samba/smb.conf[global] workgroup = WORKGROUP server string = %h server (Samba, Ubuntu) dns proxy = no log file = /var/log/samba/log.%m max log size = 1000 syslog = 0 panic action = /usr/share/samba/panic-action %d server role = standalone server passdb backend = tdbsam obey pam restrictions = yes unix password sync = yes passwd program = /usr/bin/passwd %u pam password change = yes map to guest = bad user usershare allow guests = yes
# Share public (bisa diakses semua orang)[Public] path = /srv/samba/public comment = Folder Publik TKJ browseable = yes read only = no guest ok = yes create mask = 0666 directory mask = 0777
# Share private (butuh password)[Data-TKJ] path = /srv/samba/data comment = Data TKJ browseable = yes read only = no valid users = admin, ftpuser create mask = 0660 directory mask = 0770# Buat direktori sharemkdir -p /srv/samba/public /srv/samba/datachmod 777 /srv/samba/publicchmod 770 /srv/samba/datachown -R root:sambashare /srv/samba/data
# Tambah user Sambasmbpasswd -a admin
# Restart Sambasystemctl restart smbd nmbdsystemctl enable smbd nmbd
# Test dari terminalsmbclient //192.168.1.10/Public -Nsmbclient //192.168.1.10/Data-TKJ -U admin
# Test dari Windows# Explorer: \\192.168.1.10\Public8. SSH Server
Section titled “8. SSH Server”SSH sudah terinstall di Debian saat kita pilih “SSH server” waktu install. Berikut konfigurasi keamanannya.
Konfigurasi /etc/ssh/sshd_config:
Section titled “Konfigurasi /etc/ssh/sshd_config:”# Backup dan editcp /etc/ssh/sshd_config /etc/ssh/sshd_config.baknano /etc/ssh/sshd_configKonfigurasi penting:
# Port SSH (default 22, bisa diganti untuk keamanan)Port 22
# Tidak izinkan login root langsungPermitRootLogin no
# Izinkan password authentication (sementara)PasswordAuthentication yes
# Izinkan public key authPubkeyAuthentication yes
# Batasi user yang boleh SSHAllowUsers admin ftpuser
# Timeout idle sessionClientAliveInterval 300ClientAliveCountMax 3# Restart SSHsystemctl restart sshd
# Test koneksi dari clientssh admin@192.168.1.10
# Buat SSH key (lebih aman dari password)ssh-keygen -t rsa -b 4096
# Copy public key ke serverssh-copy-id admin@192.168.1.109. Rangkuman & Checklist
Section titled “9. Rangkuman & Checklist”Checklist Konfigurasi Server:
Section titled “Checklist Konfigurasi Server:”- IP statik sudah dikonfigurasi
- Hostname dan domain sudah di-set
- DHCP server berjalan dan memberikan IP ke client
- DNS server bisa resolve nama lokal dan forward ke internet
- Web server menampilkan halaman website
- FTP server bisa diakses dari client
- Samba share bisa diakses dari Windows
- SSH bisa digunakan untuk remote login
Troubleshooting Umum:
Section titled “Troubleshooting Umum:”# Cek service yang berjalansystemctl list-units --type=service --state=running
# Cek port yang terbukass -tlnp# ataunetstat -tlnp
# Cek firewall (jika aktif)iptables -L -n
# Cek log sistemjournalctl -xe
# Cek log aplikasi spesifiktail -f /var/log/syslogtail -f /var/log/apache2/error.logtail -f /var/log/vsftpd.log