温馨提示×

怎样制作ubuntu启动镜像

小樊
57
2026-09-13 08:03:25
栏目: 智能运维

制作 Ubuntu 启动镜像(U 盘启动盘) 通常有两种常见需求:

  1. 把 Ubuntu ISO 写成可启动 U 盘(用于安装系统)
  2. 定制自己的 Ubuntu 镜像(修改内容后重新生成 ISO)

下面分别说明。


一、把 Ubuntu ISO 制作成启动 U 盘(最常见)

方法 1:使用 Rufus(Windows)

适合在 Windows 下制作:

  1. 下载 Ubuntu ISO
    https://ubuntu.com/download
  2. 下载 Rufus
    https://rufus.ie
  3. 插入 U 盘(≥8GB)
  4. 打开 Rufus:
    • 设备:选择 U 盘
    • 引导类型:选择 Ubuntu ISO
    • 分区方案:
      • 新电脑:GPT + UEFI
      • 老电脑:MBR + BIOS
  5. 点击「开始」
  6. 完成后重启,从 U 盘启动

方法 2:使用 balenaEtcher(Win / macOS / Linux)

最简单、跨平台:

  1. 下载
    https://www.balena.io/etcher
  2. 打开 Etcher
  3. 选择 Ubuntu ISO
  4. 选择 U 盘
  5. 点击 Flash

方法 3:Linux 命令行(dd)

⚠️ 有风险,会清空整个 U 盘

lsblk
sudo dd if=ubuntu-22.04.iso of=/dev/sdX bs=4M status=progress
sync

/dev/sdX 是你的 U 盘,不要写错成系统盘


二、定制 Ubuntu 启动镜像(高级)

如果你是想 修改 Ubuntu 镜像内容(比如预装软件、改配置):

基本思路

  1. 挂载 ISO
  2. 解包 filesystem.squashfs
  3. 修改系统
  4. 重新打包
  5. 生成新 ISO

简化流程示例(Ubuntu 22.04)

# 安装工具
sudo apt install squashfs-tools xorriso

# 挂载 ISO
mkdir iso
sudo mount -o loop ubuntu.iso iso

# 复制内容
mkdir live
cp -r iso/* live/

# 解包系统
unsquashfs live/casper/filesystem.squashfs
sudo chroot squashfs-root

# 在这里修改系统(装软件、改配置)
apt update
apt install vim -y
exit

# 重新打包
mksquashfs squashfs-root live/casper/filesystem.squashfs -comp xz

# 生成 ISO
xorriso -as mkisofs \
  -iso-level 3 \
  -full-iso9660-filenames \
  -volid "Ubuntu-Custom" \
  -eltorito-boot boot/grub/i386-pc/eltorito.img \
  -eltorito-catalog boot/grub/boot.cat \
  -output ubuntu-custom.iso \
  live

三、常见问题

U 盘不启动?

  • 确认 BIOS 中关闭 Secure Boot(部分情况)
  • 用 GPT + UEFI 或 MBR + BIOS 匹配主板
  • 换 U 盘或接口

苹果 Mac?

  • 用 Etcher
  • Intel Mac 可直接启动
  • Apple Silicon 不支持传统 Ubuntu ISO

如果你能说明:

  • 装系统 还是 做定制镜像
  • 使用的 操作系统(Win / macOS / Linux)

我可以给你更精确的步骤。

0