“Ubuntu From Scratch”(简称 UFS)通常指的是从零开始构建你自己的 Ubuntu 风格系统,而不是使用官方 ISO 安装。它和 LFS(Linux From Scratch)类似,但目标是得到一个 Ubuntu 兼容环境。
下面我按可行路线给你讲,从易到难。
Ubuntu 社区有一个项目叫 Ubuntu From Scratch (UFS),目标是教你从 debootstrap 开始构建一个 Ubuntu 系统。
适合:
用 debootstrap + chroot 自己搭。
那直接用:
ubuntu-minimal 包⚠️ 这不算 From Scratch,但很多人误以为这是。
sudo apt update
sudo apt install debootstrap schroot
你需要:
mkdir ~/ufs
cd ~/ufs
sudo debootstrap jammy ./rootfs http://archive.ubuntu.com/ubuntu
说明:
jammy = Ubuntu 22.04./rootfs = 新系统根目录sudo chroot ./rootfs
进入后你会看到一个“空 Ubuntu”。
apt update
apt install bash coreutils login passwd
设置 root 密码:
passwd
apt install linux-image-generic grub2
echo "myubuntu" > /etc/hostname
编辑 /etc/fstab(根据你的分区)
在 宿主机 中:
grub-install --root-directory=./rootfs /dev/sdX
官方资料:
流程大致是:
如果你是第一次: ✅ 先用 虚拟机(VirtualBox / QEMU) ✅ 不要直接在物理机上搞 ✅ 先理解:
| 项目 | LFS | Ubuntu FS |
|---|---|---|
| 源码编译 | ✅ | ❌ |
| 使用 apt | ❌ | ✅ |
| Ubuntu 兼容 | ❌ | ✅ |
| 难度 | 高 | 中 |
你可以告诉我:
我可以直接给你一份一步一步可复制命令的教程。