【原文链接】基于x86架构的CentOS7虚拟机通过qemu安装ARM架构CentOS7虚拟机
(1)首先需要有一台CentOS虚拟机,如没有可参考 VMWare安装CentOS7操作系统的虚拟机 安装一台CentOS虚拟机
(2安装基础命令
yum install -y net-toolsyum install -y wget
(2)下载ARM架构的centos7操作系统镜像
mkdir -p /opt/oscd /opt/oswget http://mirror.nju.edu.cn/centos-altarch/7.9.2009/isos/aarch64/CentOS-7-aarch64-Minimal-2009.iso --no-check-certificatechmod 777 /opt/os/CentOS-7-aarch64-Minimal-2009.iso
(3)下载ARM架构的EFI
路径为 /usr/share/AAVMF/AAVMF_CODE.fd
yum install -y http://mirror.centos.org/altarch/7/os/aarch64/Packages/AAVMF-20180508-6.gitee3198e672e2.el7.noarch.rpm
(4)安装基础依赖
yum groupinstall 'Development Tools' -yyum groupinstall "Virtualization Host" -yyum install -y kvm qemu virt-viewer virt-manager libvirt libvirt-python python-virtinstyum install libguestfs-tools -yyum install virt-install.noarch -ysystemctl enable libvirtdsystemctl start libvirtdusermod -aG libvirt $(whoami)yum install virt-install virt-viewer virt-manager -y
(5)修改qemu配置文件
vi /etc/libvirt/qemu.conf
将如下两行放开注释
(6)重启虚拟机
reboot
(7)下载qemu
cd /optwget https://download.qemu.org/qemu-4.2.0.tar.xz
(8)安装基础依赖
yum install python2 zlib-devel glib2-devel pixman-devel -y
(9)将qemu解压
cd /opt/tar xf qemu-4.2.0.tar.xz
(10)安装qemu
cd qemu-4.2.0/./configure --target-list=aarch64-softmmu --prefix=/usrmake -j8make install
(11)创建磁盘
rm -rf /var/lib/libvirt/images/test.imgqemu-img create /var/lib/libvirt/images/test.img 30G
(12)启动虚拟机
qemu-system-aarch64 -m 1024 -cpu cortex-a57 -smp 2 -M virt -bios /usr/share/AAVMF/AAVMF_CODE.fd -nographic -drive if=none,file=/opt/os/CentOS-7-aarch64-Minimal-2009.iso,id=cdrom,media=cdrom -device virtio-scsi-device -device scsi-cd,drive=cdrom -drive if=none,file=/var/lib/libvirt/images/test.img,id=hd0 -device virtio-blk-device,drive=hd0
(13)如下设置主机名
(14)如下设置网络为dhcp模式
(15)设置磁盘挂载,这里简单处理了
(16)设置root用户的密码
(17)在设置时区,待如下位置没有叹号了,则继续安装
(18)安装完成后,按回车开始重启
(19)然后即可通过设置的root的密码登录了