1. Download and unzip the ubuntu-base version
1. Download the minimum system Ubuntu Base 18.04.5 LTS (Bionic Beaver) CD images for Ubuntu Base 18.04.5 LTS (Bionic Beaver) from the official ubuntu http://cdimage.ubuntu.com/ubuntu-base/releases/18.04.5 /release/
2. Unzip
tar -xvf ubuntu-base-18.04.5-base-arm64.tar.gz
bin dev home media oem proc run srv tmp usr
boot etc lib mnt opt root sbin sys userdata var
2. Install the Qemu-User-Static tool
1. QEMU is a software specially designed to simulate different machine architectures. It is well supported in ubuntu. If you need to mount the ubuntu arm64 version of the file, you must install the qemu-user-static tool.
sudo apt-get install qemu-user-static
2. Copy the installed qemu-user-static tool to the ubuntu file system
cp /usr/bin/qemu-arm-static ./usr/bin/
3. Set software source and domain name resolution configuration
1. Set the software download source
vim ./binary/etc/apt/sources.list
Use the download source of the University of Science and Technology of China
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
2. The Ubuntu installation software is downloaded and installed from the Internet through apt-get. We need to specify the software source.
In order to create a successful root file system that can be connected to the Internet, you can directly copy the local dns configuration file to the corresponding location of the root file system and use the command "cp /etc/resolv.conf ./etc/resolv.conf"
cp /etc/resolv.conf ./etc/resolv.conf
4. Mount the root file system and chroot
1. First, mount the file system you just downloaded on the local machine. You need to mount proc, sys, dev, dev/pts and other file systems. Add the mount script using the command "vi mount.sh"
mount -t proc /proc binary/proc
mount -t sysfs /sys binary/sys
mount -o bind /dev binary/dev
mount -o bind /dev/pts binary/dev/pts
chroot binary
chmod 777 /tmp/
apt-get update
apt-get upgrade
5. Install the required software and environment
apt-get install ssh
apt-get install net-tools
apt-get install ethtool
apt-get install ifupdown
apt-get install psmisc
apt-get install nfs-common
apt-get install htop
apt-get install vim
apt-get install rsyslog
apt-get install iputils-ping
apt-get install language-pack-en-base
apt-get install sudo
apt-get install network-manager
Then use the command "passwd root" to set the root user password
passwd root
create user
adduser username
Next, use the following commands to set the host name and local IP
echo "ubuntu 18.04" > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "127.0.0.1 ubuntu 18.04" >> /etc/hosts
After setting, exit
6. Unmount the file system and make a mirror image
1. Unmount the ubuntu file system
umount binary/dev/pts
umount binary/dev
umount binary/sys
umount binary/proc
2. Make a file system image
./mk-image.sh