# 安裝Debian 10之后需要注意的事情有哪些
Debian 10(代號"Buster")作為一款穩定、高效的Linux發行版,被廣泛用于服務器和桌面環境。然而,剛完成基礎安裝的系統往往需要進一步配置才能發揮其全部潛力。本文將詳細介紹安裝Debian 10后需要進行的20項關鍵設置和優化。
## 一、系統更新與基礎配置
### 1. 更新軟件源列表
安裝完成后首先應該更新軟件包索引:
```bash
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
使用以下命令檢查并設置時區:
sudo dpkg-reconfigure tzdata
永久修改主機名需要編輯兩個文件:
sudo nano /etc/hostname
sudo nano /etc/hosts
編輯網絡接口配置文件:
sudo nano /etc/network/interfaces
示例配置:
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
避免長期使用root賬戶:
adduser username
usermod -aG sudo username
編輯SSH配置文件:
sudo nano /etc/ssh/sshd_config
建議修改:
Port 2222
PermitRootLogin no
PasswordAuthentication no
重啟服務:
sudo systemctl restart ssh
安裝并配置UFW防火墻:
sudo apt install ufw
sudo ufw allow 2222/tcp
sudo ufw enable
安裝無人值守更新包:
sudo apt install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades
基礎工具集安裝:
sudo apt install vim git curl wget htop net-tools lm-sensors
優化內存使用:
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
對于高負載服務器:
echo '* soft nofile 65535' | sudo tee -a /etc/security/limits.conf
echo '* hard nofile 65535' | sudo tee -a /etc/security/limits.conf
安裝logrotate:
sudo apt install logrotate
基本GNOME桌面安裝:
sudo apt install task-gnome-desktop
對于NVIDIA顯卡:
sudo apt install nvidia-driver firmware-misc-nonfree
筆記本用戶建議安裝:
sudo apt install tlp tlp-rdw
sudo systemctl enable tlp
基礎開發包:
sudo apt install build-essential cmake gdb
安裝Python3及虛擬環境:
sudo apt install python3 python3-pip python3-venv
設置Docker CE:
sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
安裝Nginx或Apache:
# Nginx
sudo apt install nginx
# Apache
sudo apt install apache2
MySQL服務器安裝:
sudo apt install mysql-server
sudo mysql_secure_installation
安裝并配置rsync:
sudo apt install rsync
安裝常用監控工具:
sudo apt install glances sysstat
常用日志查看命令:
journalctl -xe
dmesg | tail -20
當出現依賴問題時:
sudo apt --fix-broken install
sudo apt autoremove
完成以上配置后,您的Debian 10系統將達到生產環境的基本要求。根據具體使用場景(開發工作站、家庭服務器或企業生產環境),可能還需要額外的專項配置。Debian的強大之處在于其穩定性和靈活性,通過合理的配置可以構建出適應各種需求的系統環境。
提示:所有配置修改前建議先備份原始文件,可使用
cp filename filename.bak
創建備份副本。 “`
這篇文章共計約2100字,采用Markdown格式編寫,包含代碼塊、列表和層級標題,適合技術文檔發布。內容涵蓋了從基礎配置到高級優化的完整流程,可根據實際需求調整具體細節。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。