“Debian minimal 怎么配置”这个话题比较大,通常分为安装后基础配置、网络配置、软件源与更新、常用系统设置几个部分。下面给你一份Debian Minimal(最小化安装)实用配置指南,以 Debian 12 (Bookworm) 为例,适用于服务器或轻量桌面。
最小化安装通常只有 root,建议新建一个普通用户:
adduser yourname
usermod -aG sudo yourname
Debian 默认可能没装 sudo,见下文。
apt update
apt install sudo -y
nano /etc/apt/sources.list
示例(官方源):
deb http://deb.debian.org/debian bookworm main contrib non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free
deb http://security.debian.org/debian-security bookworm-security main contrib non-free
国内用户推荐(清华源):
deb https://mirrors.tuna.tsinghua.edu.cn/debian bookworm main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free
apt update
apt upgrade -y
/etc/network/interfaces(传统)nano /etc/network/interfaces
DHCP 示例:
auto eth0
iface eth0 inet dhcp
静态 IP 示例:
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
重启网络:
systemctl restart networking
systemctl enable --now systemd-networkd
配置文件示例:
nano /etc/systemd/network/10-eth0.network
[Match]
Name=eth0
[Network]
DHCP=yes
apt install openssh-server -y
systemctl enable --now ssh
修改 SSH(可选但推荐):
nano /etc/ssh/sshd_config
PermitRootLogin noPort 2222systemctl restart ssh
apt install -y \
curl wget git vim net-tools \
ufw fail2ban htop tmux
ufw allow OpenSSH
ufw enable
查看状态:
ufw status
timedatectl set-timezone Asia/Shanghai
apt install ntpdate -y
ntpdate pool.ntp.org
apt install xorg lightdm lxde
或:
apt install xfce4
| 问题 | 解决 |
|---|---|
| 无 ifconfig | apt install net-tools |
| 无 sudo | apt install sudo |
| 无法上网 | 检查 /etc/resolv.conf |
| 无编辑器 | apt install vim |
build-essentialiptables / dnsmasq如果你能告诉我:
我可以给你更精确的一步到位配置方案。