Qemu安装NeoKylin on Aarch64
环境:CentOS7U6 on x86_64
QEMU版本:qemu-4.1.0
客户机系统:中标麒麟高级服务器操作系统软件(ARM64版)V7.0
1,安装qemu-system-aarch64
从qemu.org上下载qemu-4.1.0版本,使用编译安装方式进行安装,使用root用户操作:
1 2 3 4 5 6 7 | [root@localhost ~] # wget https: //download .qemu.org /qemu-4 .1.0. tar .xz [root@localhost ~] # tar -xJf qemu-4.1.0.tar.xz [root@localhost ~] # cd qemu-4.1.0 [root@localhost ~] # ./configure --target-list=aarch64-softmmu [root@localhost ~] # make [root@localhost ~] # make install |
configure过程中可能会提示缺少依赖包,如:
1 | ERROR: glib-2.40 gthread-2.0 is required to compile QEMU |
使用以下解决
1 | [root@localhost ~] # yum install gtk2-devel |
Qemu-4.1.0 需要python 3支持
1 | [root@localhost ~] # yum install python3 python3-devel |
2,UEFI固件下载
1 | [root@localhost ~] # wget http://releases.linaro.org/components/kernel/uefi-linaro/16.02/release/qemu64/QEMU_EFI.fd |
3, 创建虚拟硬盘
创建儿独立的目录用于qemu虚拟机,这里使用NeoKylin_ARM64,将UEFI固件也放在此目录下。虚拟硬盘使用qcow2格式,大小为20GB
1 | [root@localhost NeoKylin_ARM64] # qemu-img create -f qcow2 neokylin_arm64.qcow2 20G |
4,虚拟机安装
将操作系统镜像文件一起复制到NeoKylin_ARM64目录下,编写qemu启动参数脚本,进行安装
1 2 3 4 | [root@localhost NeoKylin_ARM64] # ls neokylin_arm64.qcow2 NeoKylin-Server-7.0-aarch64-Release-Build06.07-lic-20190920.iso QEMU_EFI.fd run.sh |
run.sh脚本内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 | #!/bin/bash SYSTEMISO=$( ls *.iso) DISKFILE=$( ls *.qcow2) qemu-system-aarch64 -m 2048 -cpu cortex-a72 -smp 4 -M virt \ -bios QEMU_EFI.fd -nographic \ -drive if =none, file =${DISKFILE}, id =hd0 \ -device virtio-blk-device,drive=hd0 \ -drive if =none, file =${SYSTEMISO}, id =cdrom,media=cdrom \ -device virtio-scsi-device \ -device scsi- cd ,drive=cdrom \ -net nic -net user,hostfwd=tcp::50022-:22 |
执行run.sh进行安装(安装过程中相对缓慢),操作系统安装是字符界面的,过程与图形化界面类似。
以下是过程中的一些截图:
开始安装
安装选项中与图形化安装时类似,!表示需要处理,x表示已经选择好。输入r刷新、b开始安装(需要无!)
其中的网络设置,qemu默认使用用户模式(有类似于NAT),客户机的地址为10.0.2.15
全部确认后开始安装,这里选择了默认的最小化安装
完成安装,重启到命令行界面
注:在关闭虚拟机后,重新启动时,会从光盘启动。在界面中按 c 进入交互界面
grup> 输入exit,将进从硬盘启动
已有 4 条评论