debian系统打包(live build)

该文档用于记录一些指令,不涉及原理解读

系统:debian12.6

1.config

bash 复制代码
sudo lb config \
	--binary-images iso-hybrid \
	--compression xz \
	--iso-volume "debian" \
	--architecture amd64 \
	--distribution bookworm \
	--archive-areas "main contrib non-free" \
	--mirror-bootstrap "http://mirrors.aliyun.com/debian/" \
	--mirror-chroot "http://mirrors.aliyun.com/debian/" \
	--mirror-chroot-security "http://mirrors.aliyun.com/debian-security/" \
	--mirror-binary "http://mirrors.aliyun.com/debian/" \
	--mirror-binary-security "http://mirrors.aliyun.com/debian-security/" \
	--parent-mirror-bootstrap "http://mirrors.aliyun.com/debian/" \
	--parent-mirror-chroot "http://mirrors.aliyun.com/debian/" \
	--parent-mirror-chroot-security "http://mirrors.aliyun.com/debian-security/"

2.build

`sudo lb build`

lb build指令分解如下:

bash 复制代码
# 阶段1:清理旧构建残留(可选,建议执行) 
sudo lb clean --stage all 

# 阶段2:bootstrap(构建基础根文件系统) 
# 作用:下载debian基础包,创建最小根文件系统 
sudo lb bootstrap 2>&1 | tee bootstrap.log 

# 阶段3:chroot(配置根文件系统,安装自定义包/复制配置) 
# 作用:进入chroot环境,安装你在package-lists中定义的包,同步includes.chroot配置 
sudo lb chroot 2>&1 | tee chroot.log 

# 阶段4:binary(生成二进制镜像文件) 
# 作用:构建ISO的二进制核心(内核、initramfs、启动脚本等) 
sudo lb binary 2>&1 | tee binary.log 

# 阶段5:source(生成源码镜像,可选,按需执行) 
# 作用:若需要源码ISO则执行,仅需二进制ISO可跳过 
sudo lb source 2>&1 | tee source.log 

# 阶段6:build(整合所有文件生成最终ISO) 
# 作用:将binary阶段的文件打包为iso-hybrid格式 
sudo lb build 2>&1 | tee final-build.log 

# (可选)阶段7:验证ISO完整性 
sudo isohybrid live-image-amd64.hybrid.iso 
# 确保ISO支持U盘启动

3.执行无报错后生成一个文件*.iso,这个文件可以直接使用vm虚拟机启动(如果需要定制化系提供还需要其他的设置,在`工作文件/config/`中进行设置)

ps:目前直接将系统配置复制到对应的文件夹下无法起作用,正在探索中····

相关推荐
欧云服务器6 天前
怎么让脚本命令可以同时在centos、debian、ubuntu执行?
ubuntu·centos·debian
~远在太平洋~6 天前
Debian系统如何删除多余的kernel
linux·网络·debian
~远在太平洋~7 天前
debian系统已安装python3.12却无法执行python命令
chrome·python·debian
木子欢儿10 天前
在 Debian 13(以及 12)上安装和配置 tightvncserver 并让普通用户使
运维·前端·debian
l1t17 天前
在debian 13.1容器中安装使用redrock postgresql
运维·postgresql·debian
木子欢儿17 天前
debian 13 安装配置ftp 创建用户admin可以访问 /mnt/Data/
linux·运维·服务器·数据库·debian
地球空间-技术小鱼18 天前
搜罗Linux桌面环境(Desktop Environments)列表
linux·运维·服务器·笔记·学习·ubuntu·debian
木子欢儿18 天前
Debian挂载飞牛OS创建的RAID分区和Btrfs分区指南
运维·debian
市安20 天前
基于Debain构建Ngxin镜像
运维·nginx·docker·云原生·容器·debian·镜像
henry10101020 天前
Debian/Ubuntu EC2实例上一键部署WireGuard
ubuntu·云计算·debian·aws