由于当前Ubuntu 22.04的公共镜像源没有自带常用工具包,无法通过挂载本地源方式进行文件系统配置,所以需要通过配置网络源手动下载常用Linux组件,定制Sample-root-filesystem-soc_ubuntu-22.04-aarch64.img。
unsquashfs ubuntu-server-minimal.squashfs
执行以下命令,在当前目录创建sources.list文件。
vim sources.list
网络源配置参考如下。
deb https://repo.huaweicloud.com/ubuntu-ports/ bionic main restricted universe multiverse deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic main restricted universe multiverse deb https://repo.huaweicloud.com/ubuntu-ports/ bionic-security main restricted universe multiverse deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic-security main restricted universe multiverse deb https://repo.huaweicloud.com/ubuntu-ports/ bionic-updates main restricted universe multiverse deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic-updates main restricted universe multiverse deb https://repo.huaweicloud.com/ubuntu-ports/ bionic-backports main restricted universe multiverse deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic-backports main restricted universe multiverse ## Not recommended # deb https://repo.huaweicloud.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse # deb-src https://repo.huaweicloud.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse
保存配置文件并退出。
执行以下命令,将sources.list文件复制到“squashfs-root/etc/apt”目录下。
cp sources.list squashfs-root/etc/apt/
执行如下命令,切换根系统。
chroot squashfs-root
apt-get update
若执行命令后报错“The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32”,请参见更新网络源时签名不可用。
apt-get install unzip -y
apt-get install vim -y
apt-get install sysstat -y
apt-get install libnuma1 -y
apt-get install dmidecode -y
apt-get install rsync -y
apt-get install net-tools -y
apt-get install psmisc -y
apt-get install parted -y
apt-get install arping -y
apt-get install ntpdate -y
apt-get install iproute2 -y
apt-get install iputils-ping -y
apt-get install mawk -y
apt-get install cracklib-runtime -y
apt-get install ethtool -y
apt-get install ntp -y
apt-get install fdisk -y
apt-get install libssl-dev -y
apt-get install libpam-cracklib -y
apt-get install logrotate -y
exit
cd squashfs-root
find . | cpio -o -H newc | gzip > ../Sample-root-filesystem-soc_ubuntu-22.04-aarch64.img
Sample-root-filesystem-soc_ubuntu-22.04-aarch64.img在Ubuntu 22.04镜像所在目录下。