在Debian系統中,為了避免性能下降,可以采取以下一些技巧進行系統清理和優化:
sudo apt update && sudo apt upgrade -y
sudo apt install linux-generic-lts-xenial
dpkg --get-selections | grep -v deinstall
sudo apt autoremove --purge
sudo apt clean
sudo rm -rf /tmp/*
systemctl list-unit-files --type=service
sudo systemctl disable <service_name>
df -h
du -sh * | sort -rh | head -n 10
journalctl --vacuum-size=100M
調整swappiness:
sudo sysctl vm.swappiness=10
(將交換空間的使用傾向降低到10%)
調整文件描述符限制:
編輯 /etc/security/limits.conf
文件,增加以下內容:
* soft nofile 65536
* hard nofile 65536
htop
、top
、iotop
和 vmstat
來監控系統性能,及時發現并解決問題。通過以上這些技巧,可以有效地保持Debian系統的性能和穩定性。記得在進行任何重大更改之前備份重要數據。