debootstrap制作纯净ubutnu-armhf系统

debootstrap是debian/ubuntu下的一个工具,用来构建一套基本的系统(根文件系统)。生成的目录符合Linux文件系统标准(FHS),即包含了/boot、/etc、/bin、/usr等等目录,它生成的系统比发行版本的Linux体积小很多,当然功能也没那么强大,因此,只能说是“基本的系统”。

前面我写了一篇华为悦盒安装debian9系统的文章,其中系统就是debootstrap生成的

安装debootstrap

1
sudo apt install debootstrap arch-install-scripts

构建系统

1
sudo debootstrap --arch armhf focal /mnt/ubuntu https://mirrors.ustc.edu.cn/ubuntu-ports/

其中 --arch 指定系统平台,本文是在armhf平台构建,其他平台步骤也大概是这些,focal 指ubuntu20.04LTS,/mnt/ubuntu 指定安装目录,最后一个是镜像,如果构建时报错No such script: /usr/share/debootstrap/scripts.. ,则需要下载前往https://packages.ubuntu.com/jammy/debootstrap 下载最新的debootstrap,安装后再运行

1
sudo debootstrap --arch armhf jammy /mnt/ubuntu https://mirrors.ustc.edu.cn/ubuntu-ports/

构建完成后,使用 arch-chroot /mnt/ubuntu 进入系统进行配置

配置

修改/etc/hosts,添加 127.0.0.1 hostname其中hostname替换为/etc/hostname里的内容

编辑软件源添加 universe ,后面安装软件时需要,然后 apt update 更新软件列表

1
deb https://mirrors.ustc.edu.cn/ubuntu-ports jammy main universe

安装基本软件,这些是确保ssh能用的基础软件

1
apt install iptables network-manager ifupdown ethtool openssh-server

配置网络,编辑 /etc/network/interfaces.d/eth0,添加

1
2
auto eth0
iface eth0 inet dhcp

配置ssh,编辑/etc/ssh/sshd_config,添加 PermitRootLogin yes

添加用户ubuntu,useradd -m ubuntu,修改其默认shell为bash usermod --shell /bin/bash

然后passwd ubuntu,passwd分别给ubuntu和root用户设置密码

清理apt cleanhistory -c

完成这些步骤后一个最最基本的ubuntu系统就配置完成了,可以尝试启动了

打赏
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2021-2025 lorzzn
  • 访问人数: | 浏览次数:

      请我喝杯咖啡吧~

      支付宝
      微信