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

TROUBLESHOOTINGDEBIAN SERVER

Volume 17 dari seri Debian Linux Server Fundamental. Panduan komprehensif teknik troubleshooting server. Setiap command dan script dijelaskan detail dengan penjelasan per baris. Dari server tidak bisa diakses, masalah jaringan, masalah DNS, service gagal berjalan, disk penuh, permission denied, CPU dan RAM tinggi, hingga analisis log.

VOLUME17 / 17
SUB-BAB8
BACA90 MENIT
TROUBLESHOOTING100%
ABDUR ROZAK, S.Kom. Web Developer & Network Educator - abdurrozak.my.id
VOLUME 17 / 17

TEKNIK TROUBLESHOOTING SERVER

Panduan lengkap Troubleshooting Debian Server. 8 sub-bab mencakup server tidak bisa diakses, masalah jaringan, masalah DNS, service gagal berjalan, disk penuh, permission denied, CPU dan RAM tinggi, hingga analisis log. Setiap command dan script disertai penjelasan detail per baris.
SUB-BAB8 LEVELTroubleshooting WAKTU90 MENIT
01
SUB-BAB 01 AKSES

SERVER TIDAK BISA DIAKSES

Diagnosa Server Tidak Bisa Diakses

Ketika server tidak bisa diakses, ada beberapa kemungkinan penyebab: server down, jaringan bermasalah, firewall memblokir, atau service tidak berjalan.

Langkah Diagnosa

DIAGNOSA
# 1. Ping server dari client ping server-ip # Jika timeout, server mungkin down atau firewall memblokir ICMP # 2. Traceroute untuk cek jalur traceroute server-ip # Lihat di hop mana koneksi terputus # 3. Cek port yang terbuka nmap server-ip # Lihat port mana yang terbuka # 4. Cek port spesifik nmap -p 22,80,443 server-ip # Cek port SSH, HTTP, HTTPS # 5. Cek koneksi ke port spesifik telnet server-ip 22 # Cek koneksi ke SSH nc -zv server-ip 22 # Cek koneksi ke SSH dengan netcat # 6. Cek DNS resolution nslookup server-domain dig server-domain # 7. Cek dari server (jika bisa akses) sudo systemctl status ssh sudo systemctl status nginx sudo systemctl status apache2 # 8. Cek log SSH sudo tail -f /var/log/auth.log # 9. Cek firewall sudo ufw status sudo iptables -L # 10. Cek service yang berjalan sudo systemctl list-units --type=service --state=running

Solusi Berdasarkan Gejala

GEJALAPOSSIBLE CAUSESOLUSI
Ping timeout Server down / firewall block ICMP Cek server, cek firewall, allow ICMP
Connection refused Service tidak berjalan Start service, cek log
Connection timed out Firewall block / network issue Cek firewall, cek network
Host not found DNS issue Cek DNS, cek /etc/hosts
Permission denied Permission issue Cek permission, cek user
KOMPETENSI SUB-BAB 01
  • Mampu diagnosa server tidak bisa diakses
  • Mampu gunakan ping, traceroute, nmap
  • Mampu identifikasi penyebab masalah
  • Mampu apply solusi yang tepat
02
SUB-BAB 02 JARINGAN

MASALAH JARINGAN

Diagnosa Masalah Jaringan

DIAGNOSA JARINGAN
# 1. Cek status interface ip addr show ip link show # 2. Cek routing ip route show route -n # 3. Cek DNS cat /etc/resolv.conf nslookup google.com dig google.com # 4. Cek koneksi ke gateway ping gateway-ip # 5. Cek koneksi ke internet ping 8.8.8.8 ping google.com # 6. Cek DNS resolution nslookup google.com dig google.com host google.com # 7. Cek port listening ss -tulpn netstat -tulpn # 8. Cek koneksi aktif ss -tunap netstat -tunap # 9. Cek firewall sudo ufw status sudo iptables -L -n sudo iptables -L -n -v # 10. Cek network statistics ip -s link ip -s addr

Solusi Masalah Jaringan

SOLUSI JARINGAN
# 1. Restart network service sudo systemctl restart networking sudo systemctl restart NetworkManager # 2. Restart interface sudo ip link set eth0 down sudo ip link set eth0 up # 3. Flush IP address sudo ip addr flush dev eth0 # 4. Renew DHCP sudo dhclient -r eth0 sudo dhclient eth0 # 5. Flush DNS cache sudo systemd-resolve --flush-caches sudo resolvectl flush-caches # 6. Restart DNS service sudo systemctl restart systemd-resolved # 7. Reset firewall sudo ufw disable sudo ufw enable # 8. Flush iptables sudo iptables -F sudo iptables -X sudo iptables -t nat -F # 9. Restart firewall service sudo systemctl restart ufw sudo systemctl restart firewalld # 10. Cek network configuration cat /etc/network/interfaces cat /etc/netplan/*.yaml
KOMPETENSI SUB-BAB 02
  • Mampu diagnosa masalah jaringan
  • Mampu gunakan command network troubleshooting
  • Mampu restart network service
  • Mampu flush DNS cache
03
SUB-BAB 03 DNS

MASALAH DNS

Diagnosa Masalah DNS

DIAGNOSA DNS
# 1. Cek DNS configuration cat /etc/resolv.conf # 2. Test DNS resolution nslookup google.com dig google.com host google.com # 3. Test dengan specific DNS server nslookup google.com 8.8.8.8 dig @8.8.8.8 google.com # 4. Test DNS resolution verbose dig +trace google.com # 5. Cek DNS cache sudo resolvectl statistics # 6. Flush DNS cache sudo systemd-resolve --flush-caches sudo resolvectl flush-caches # 7. Restart DNS service sudo systemctl restart systemd-resolved # 8. Cek DNS service status sudo systemctl status systemd-resolved # 9. Cek DNS log sudo journalctl -u systemd-resolved # 10. Test reverse DNS dig -x 8.8.8.8

Solusi Masalah DNS

SOLUSI DNS
# 1. Update DNS configuration sudo nano /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 # 2. Flush DNS cache sudo systemd-resolve --flush-caches # 3. Restart DNS service sudo systemctl restart systemd-resolved # 4. Test DNS resolution nslookup google.com dig google.com # 5. Test dengan specific DNS server nslookup google.com 8.8.8.8 # 6. Check DNS service status sudo systemctl status systemd-resolved # 7. Enable DNS service sudo systemctl enable systemd-resolved # 8. Check DNS log sudo journalctl -u systemd-resolved -f # 9. Test reverse DNS dig -x 8.8.8.8 # 10. Test DNS with verbose dig +trace google.com
KOMPETENSI SUB-BAB 03
  • Mampu diagnosa masalah DNS
  • Mampu gunakan nslookup, dig, host
  • Mampu flush DNS cache
  • Mampu restart DNS service
04
SUB-BAB 04 SERVICE

SERVICE GAGAL BERJALAN

Diagnosa Service Gagal

DIAGNOSA SERVICE
# 1. Cek status service sudo systemctl status service-name sudo systemctl status ssh sudo systemctl status nginx sudo systemctl status apache2 sudo systemctl status mysql sudo systemctl status postgresql # 2. Cek log service sudo journalctl -u service-name sudo journalctl -u ssh sudo journalctl -u nginx sudo journalctl -u apache2 # 3. Cek log real-time sudo journalctl -u service-name -f # 4. Cek log sejak boot sudo journalctl -u service-name -b # 5. Cek log dengan priority sudo journalctl -u service-name -p err # 6. Cek service configuration sudo systemctl cat service-name # 7. Cek service dependencies sudo systemctl list-dependencies service-name # 8. Cek service status detail sudo systemctl show service-name # 9. Reload service sudo systemctl daemon-reload # 10. Restart service sudo systemctl restart service-name

Solusi Service Gagal

SOLUSI SERVICE
# 1. Start service sudo systemctl start service-name # 2. Restart service sudo systemctl restart service-name # 3. Reload service sudo systemctl reload service-name # 4. Enable service sudo systemctl enable service-name # 5. Disable service sudo systemctl disable service-name # 6. Cek log untuk error sudo journalctl -u service-name -p err # 7. Cek configuration sudo systemctl cat service-name # 8. Edit configuration sudo systemctl edit service-name # 9. Reload daemon sudo systemctl daemon-reload # 10. Restart service sudo systemctl restart service-name # 11. Cek service status sudo systemctl status service-name # 12. Cek log real-time sudo journalctl -u service-name -f
KOMPETENSI SUB-BAB 04
  • Mampu diagnosa service gagal berjalan
  • Mampu cek log service
  • Mampu start/restart/reload service
  • Mampu edit service configuration
05
SUB-BAB 05 DISK

DISK PENUH

Diagnosa Disk Penuh

DIAGNOSA DISK
# 1. Cek disk usage df -h # 2. Cek disk usage per directory du -h /path/to/directory # 3. Cek disk usage sorted by size du -h /path/to/directory | sort -hr # 4. Cek top 10 largest directories du -h /path/to/directory | sort -hr | head -n 10 # 5. Cek top 10 largest files find /path/to/directory -type f -exec du -h {} + | sort -hr | head -n 10 # 6. Cek inode usage df -i # 7. Cek inode usage per directory find /path/to/directory -xdev -printf '%h\n' | cut -d/ -f-2 | sort | uniq -c | sort -k1 -n # 8. Cek large files find / -type f -size +100M # 9. Cek large files in specific directory find /var/log -type f -size +100M # 10. Cek disk usage by user du -h /home/* | sort -hr

Solusi Disk Penuh

SOLUSI DISK PENUH
# 1. Clean package cache sudo apt clean sudo apt autoclean # 2. Remove old kernels sudo apt autoremove --purge # 3. Clean journal logs sudo journalctl --vacuum-time=7d sudo journalctl --vacuum-size=500M # 4. Clean old log files sudo find /var/log -type f -name "*.log" -mtime +30 -delete # 5. Clean old log files with rotation sudo logrotate /etc/logrotate.conf # 6. Clean temporary files sudo rm -rf /tmp/* sudo rm -rf /var/tmp/* # 7. Clean old backup files sudo find /backup -type f -mtime +30 -delete # 8. Clean Docker (if installed) sudo docker system prune -a # 9. Clean old kernels manually dpkg --list | grep linux-image sudo apt remove --purge linux-image-X.X.X-XX # 10. Clean apt cache sudo apt clean sudo apt autoclean sudo apt autoremove # 11. Check disk usage after cleanup df -h # 12. Check inode usage after cleanup df -i
KOMPETENSI SUB-BAB 05
  • Mampu diagnosa disk penuh
  • Mampu gunakan df dan du
  • Mampu clean package cache
  • Mampu clean old files
06
SUB-BAB 06 PERMISSION

PERMISSION DENIED

Diagnosa Permission Denied

DIAGNOSA PERMISSION
# 1. Cek file permission ls -la /path/to/file # 2. Cek directory permission ls -la /path/to/directory # 3. Cek file owner stat /path/to/file # 4. Cek directory owner stat /path/to/directory # 5. Cek current user whoami id # 6. Cek file ACL getfacl /path/to/file # 7. Cek directory ACL getfacl /path/to/directory # 8. Cek SELinux status (if enabled) getenforce sestatus # 9. Check file context (SELinux) ls -Z /path/to/file # 10. Check directory context (SELinux) ls -Z /path/to/directory

Solusi Permission Denied

SOLUSI PERMISSION
# 1. Change file permission chmod 644 /path/to/file chmod 755 /path/to/directory # 2. Change file owner chown user:group /path/to/file chown -R user:group /path/to/directory # 3. Change permission recursively chmod -R 755 /path/to/directory # 4. Change owner recursively chown -R user:group /path/to/directory # 5. Use sudo sudo command # 6. Add user to group sudo usermod -aG groupname username # 7. Set ACL setfacl -m user:username:rwx /path/to/file # 8. Set default ACL setfacl -d -m user:username:rwx /path/to/directory # 9. Remove ACL setfacl -x user:username /path/to/file # 10. Remove all ACL setfacl -b /path/to/file # 11. Check permission after change ls -la /path/to/file # 12. Check SELinux context ls -Z /path/to/file
KOMPETENSI SUB-BAB 06
  • Mampu diagnosa permission denied
  • Mampu gunakan chmod dan chown
  • Mampu gunakan ACL
  • Mampu check permission setelah change
07
SUB-BAB 07 CPU/RAM

CPU DAN RAM TINGGI

Diagnosa CPU dan RAM Tinggi

DIAGNOSA CPU/RAM
# 1. Cek CPU dan RAM usage top htop # 2. Cek CPU usage per core mpstat -P ALL # 3. Cek CPU usage real-time mpstat 1 # 4. Cek RAM usage free -h free -m # 5. Cek top processes by CPU ps aux --sort=-%cpu | head -n 10 # 6. Cek top processes by RAM ps aux --sort=-%mem | head -n 10 # 7. Cek process tree pstree # 8. Cek process detail ps -p PID -f # 9. Cek process children pstree -p PID # 10. Kill process kill PID kill -9 PID # 11. Kill process by name killall process-name # 12. Check system load uptime w

Solusi CPU dan RAM Tinggi

SOLUSI CPU/RAM
# 1. Identify top processes top htop # 2. Kill problematic process kill PID kill -9 PID # 3. Restart service sudo systemctl restart service-name # 4. Check service logs sudo journalctl -u service-name # 5. Check system logs sudo journalctl -p err # 6. Clear cache sudo sync sudo sysctl -w vm.drop_caches=3 # 7. Check swap usage free -h # 8. Add swap (if needed) sudo fallocate -l 2G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile # 9. Check processes using swap for file in /proc/*/status; do awk '/VmSwap|Name/{printf $2 " " $2}END{ print ""}' $file; done | sort -k 2 -n -r | head # 10. Kill processes using swap kill PID # 11. Check system load uptime # 12. Check top processes top
KOMPETENSI SUB-BAB 07
  • Mampu diagnosa CPU dan RAM tinggi
  • Mampu gunakan top dan htop
  • Mampu kill problematic process
  • Mampu add swap jika needed
08
SUB-BAB 08 LOG

ANALISIS LOG

Analisis Log Sistem

ANALISIS LOG
# 1. Cek system log sudo tail -f /var/log/syslog sudo tail -f /var/log/messages # 2. Cek auth log sudo tail -f /var/log/auth.log # 3. Cek service log sudo journalctl -u service-name sudo journalctl -u ssh sudo journalctl -u nginx sudo journalctl -u apache2 # 4. Cek log real-time sudo journalctl -f # 5. Cek log since boot sudo journalctl -b # 6. Cek log with priority sudo journalctl -p err sudo journalctl -p warning sudo journalctl -p crit # 7. Cek log with time range sudo journalctl --since "2024-01-01 00:00:00" --until "2024-01-02 00:00:00" # 8. Cek log with grep sudo journalctl | grep "error" sudo journalctl | grep "failed" # 9. Cek log with multiple patterns sudo journalctl | grep -E "error|failed|critical" # 10. Cek log with reverse sudo journalctl -r # 11. Cek log with output format sudo journalctl -o short-precise # 12. Cek log with no-pager sudo journalctl --no-pager

Analisis Log File

ANALISIS LOG FILE
# 1. Cek log file tail -f /var/log/syslog tail -f /var/log/auth.log tail -f /var/log/nginx/error.log tail -f /var/log/apache2/error.log # 2. Cek log file with grep grep "error" /var/log/syslog grep "failed" /var/log/auth.log # 3. Cek log file with multiple patterns grep -E "error|failed|critical" /var/log/syslog # 4. Cek log file with count grep -c "error" /var/log/syslog # 5. Cek log file with line number grep -n "error" /var/log/syslog # 6. Cek log file with context grep -C 5 "error" /var/log/syslog # 7. Cek log file with before context grep -B 5 "error" /var/log/syslog # 8. Cek log file with after context grep -A 5 "error" /var/log/syslog # 9. Cek log file with recursive grep -r "error" /var/log/ # 10. Cek log file with case-insensitive grep -i "error" /var/log/syslog # 11. Cek log file with invert grep -v "error" /var/log/syslog # 12. Cek log file with word grep -w "error" /var/log/syslog
KOMPETENSI SUB-BAB 08
  • Mampu analisis log sistem
  • Mampu gunakan journalctl
  • Mampu gunakan grep untuk analisis log
  • Mampu identifikasi error dari log
VOLUME 17 SELESAI

SELAMAT!

Kamu telah menyelesaikan Volume 17 - Troubleshooting Debian Server. Dari server tidak bisa diakses, masalah jaringan, masalah DNS, service gagal berjalan, disk penuh, permission denied, CPU dan RAM tinggi, hingga analisis log. Kamu sekarang menguasai teknik troubleshooting Debian Server. Seri Debian Linux Server Fundamental telah selesai!
SUB-BAB8 LEVELTroubleshooting STATUSSELESAI
ABDURROZAK.MY.ID // TERHUBUNG

JARINGAN SOSIAL

Temukan saya di berbagai platform digital