【原文链接】基于x86架构的CentOS7虚拟机通过qemu安装ARM架构OpenEuler虚拟机
(1)首先需要有一台CentOS虚拟机,如没有可参考 VMWare安装CentOS7操作系统的虚拟机 安装一台CentOS虚拟机
(2)安装基础命令
yum install -y net-tools
yum install -y wget
(3)下载ARM架构的centos7操作系统镜像
mkdir -p /opt/os
cd /opt/os
wget https://repo.openeuler.org/openEuler-22.03-LTS/ISO/aarch64/openEuler-22.03-LTS-aarch64-dvd.iso --no-check-certificate
chmod 777 /opt/os/openEuler-22.03-LTS-aarch64-dvd.iso
(4)下载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
(5)安装基础依赖
yum install -y kvm qemu virt-viewer virt-manager libvirt libvirt-python python-virtinst
yum install libguestfs-tools -y
yum install virt-install.noarch -y
systemctl enable libvirtd
systemctl start libvirtd
usermod -aG libvirt $(whoami)
yum install virt-install virt-viewer virt-manager -y
(6)修改qemu配置文件
vi /etc/libvirt/qemu.conf
将如下两行放开注释
(7)重启虚拟机
reboot
(8)下载qemu
cd /opt
wget https://download.qemu.org/qemu-4.2.0.tar.xz
(9)安装基础依赖
yum install python2 zlib-devel glib2-devel pixman-devel gcc -y
(10)将qemu解压
cd /opt/
tar xf qemu-4.2.0.tar.xz
(11)安装qemu
cd qemu-4.2.0/
./configure --target-list=aarch64-softmmu --prefix=/usr
make -j8
make install
(12)创建磁盘
rm -rf /var/lib/libvirt/images/test.img
qemu-img create /var/lib/libvirt/images/test.img 30G
(13)启动虚拟机
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/openEuler-22.03-LTS-aarch64-dvd.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
(14)选择“Troubleshutiing”,然后输入 -e
(15)然后将 console=tty0 删除
(16)然后使用快捷键 ctrl + x 进入安装界面,回车后开始安装
(17)然后按照提示设置安装选项即可
(18)安装完成后,输入root 和密码,即可登录了