1. ARM架构Ubuntu安装
1.1. 环境
Windows 11
QEMU
ubuntu 16.04
1.2. 步骤
使用链接时请将所有http-s替换为正确的链接前缀
1.2.1. 安装QEMU,安装Ubuntu
参考文档:[http-s://gist.github.com/billti/d904fd6124bf6f10ba2c1e3736f0f0f7]
qemu安装包下载地址: [http-s://qemu.weilnetz.de/w64/]
Ubuntu16.04镜像下载地址: [http-s://cloud-images.ubuntu.com/releases/16.04/release/]
QEMU_EFI.fd下载地址: [http-s://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/]
user-data.img下载地址:[http-s://stackoverflow.com/a/53373376]
将上诉文件放到同一工作目录
1.2.2. 启动Ubuntu
我存放镜像的工作目录是C:\software\Linux
cd C:\software\Linux
#启动命令
qemu-system-aarch64 -m 4096 -cpu cortex-a72 -smp 4 -M virt -nographic -bios QEMU_EFI.fd -drive if=none,file=ubuntu-16.04-server-cloudimg-arm64-uefi1.img,id=hd0 -device virtio-blk-device,drive=hd0 -drive file=user-data.img,format=raw -device virtio-net-device,netdev=net0 -netdev user,hostfwd=tcp:127.0.0.1:2222-:22,id=net0
#进入Ubuntu
ssh ubuntu@localhost -p 2222
1.2.3. 替换阿里镜像源
cd /etc/apt
mv source.list source.list.bak
vim source.list
插入对应的16.04版本的镜像源
deb http-s://mirrors.aliyun.com/ubuntu-ports/ xenial main
deb-src http-s://mirrors.aliyun.com/ubuntu-ports/ xenial main
deb http-s://mirrors.aliyun.com/ubuntu-ports/ xenial-updates main
deb-src http-s://mirrors.aliyun.com/ubuntu-ports/ xenial-updates main
deb http-s://mirrors.aliyun.com/ubuntu-ports/ xenial universe
deb-src http-s://mirrors.aliyun.com/ubuntu-ports/ xenial universe
deb http-s://mirrors.aliyun.com/ubuntu-ports/ xenial-updates universe
deb-src http-s://mirrors.aliyun.com/ubuntu-ports/ xenial-updates universe
deb http-s://mirrors.aliyun.com/ubuntu-ports/ xenial-security main
deb-src http-s://mirrors.aliyun.com/ubuntu-ports/ xenial-security main
deb http-s://mirrors.aliyun.com/ubuntu-ports/ xenial-security universe
deb-src http-s://mirrors.aliyun.com/ubuntu-ports/ xenial-security universe
镜像源地址(我们安装的arm架构,镜像源要选ubuntu-ports的而不是ubuntu):[http-s://developer.aliyun.com/mirror/ubuntu-ports?spm=a2c6h.13651104.d-1008.12.94f64763N5Dbng]
1.2.4. 配置DNS
vim /etc/resolv.conf,在行末加入
nameserver 8.8.8.8
nameserver 114.114.114.114
1.2.5. 磁盘扩容
先关闭vm,然后扩容20G
qemu-img resize ubuntu-16.04-server-cloudimg-arm64-uefi1.img +20G
重新启动并进入vm
sudo growpart /dev/vda 1 # 假设分区1需要扩展
sudo resize2fs /dev/vda1 # 扩展文件系统
reboot