- 创建磁盘镜像
cd /mnt/data
dd if=/dev/zero of=alpine.img bs=1M count=1024
mkfs.ext4 alpine.img
mkdir /alpine
mount alpine.img /alpine
- 安装alpine
cd /alpine
#wget ${mirror}/latest-stable/main/${arch}/apk-tools-static-${version}.apk
wget http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/aarch64/apk-tools-static-2.10.4-r2.apk
#tar -xzf apk-tools-static-*.apk
tar -xzf apk-tools-static-2.10.4-r2.apk
#./sbin/apk.static -X ${mirror}/latest-stable/main -U --allow-untrusted --root ${chroot_dir} --initdb add alpine-base
./sbin/apk.static -X http://dl-cdn.alpinelinux.org/latest-stable/main -U --allow-untrusted --root /alpine --initdb add alpine-base
- 进入alpine环境
mount -o bind /dev /alpine/dev
mount -o bind /dev/pts /alpine/dev/pts
mount -o bind /proc /alpine/proc
mount -o bind /sys /alpine/sys
mkdir -p /alpine/etc/apk
echo "http://dl-cdn.alpinelinux.org/latest-stable/main" > /alpine/etc/apk/repositories
chroot /alpine /bin/sh -i
- alpine环境下
apk update