三 文章首页 实时留言 网络邻居 开往 虫洞
返回

使用 debootstrap 构建 Debian 系根文件系统

2025-10-09 01:35:42
分类: Linux 标签: 系统运维,Debian

debootstrap 是一款专为 Debian 系衍生发行版(包括 Ubuntu)设计的命令行工具,用来构建一个基础根文件系统(rootfs)。

快速入门


Debian / Ubuntu 安装方式

sudo apt install debootstrap

使用传参:

sudo debootstrap [选项] <目标版本代号> <rootfs存放路径> [软件源地址]

常用选项参数:

参数作用
--arch=<架构>指定目标系统的架构如:amd64riscv64
--variant=<变体>指定系统的精简程度,minbase: 最小化,base: 标准,buildd: 含编译工具,fakechroot: 非特权(root)构建
--include=<包>额外安装指定软件包,如:sudovim
--exclude=<包>排除指定的软件包
--components=<组件>指定软件源组建,如:maincontribnon-free

ps: 参数可使用 --[选项] [传参]--[选项]=[传参] 两种格式。

参考例子


构建一个 x64 架构的 debian sid

sudo debootstrap --arch amd64 sid /path/to/debian/ https://deb.debian.org/debian

构建一个 x64 架构最小基础的 ubuntu 25

sudo debootstrap --arch amd64 --variant=minbase plucky ./ubuntu25_min/ https://mirrors.ustc.edu.cn/ubuntu/