之前搭过很多次,这次又忘光光了,花了很久才搞定,遇到的问题是死活登录不进去
主要参考
dd if=/dev/zero of=flash0.img bs=1M count=64
dd if=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd of=flash0.img conv=notrunc
dd if=/dev/zero of=flash1.img bs=1M count=64
sudo virt-customize -a ubuntu-18.04-server-cloudimg-arm64.img --root-password password:root
qemu-img resize ubuntu-18.04-server-cloudimg-arm64.img +10G
qemu-system-aarch64 -smp 8 -m 8192 -cpu cortex-a57 -M virt -nographic -pflash flash0.img \
-pflash flash1.img -drive if=none,file=ubuntu-18.04-server-cloudimg-arm64.img,id=hd0 \
-device virtio-blk-device,drive=hd0 \
-device e1000,netdev=net0 -netdev user,id=net0,hostfwd=tcp::5555-:22
登陆账号/密码
root/root
修改 /etc/ssh/sshd_config
PasswordAuthentication no
改为
PasswordAuthentication yes
再执行
systemctl restart ssh
root登录后可以随意修改ubuntu账户的密码,host可以通过
ssh -p 5555 ubuntu@localhost
输入密码登录