centos7 使用virt-install安装虚拟机

时间:2024-10-27 07:23:48

1、首先查看你的服务器的cpu是否支持虚拟化。#egrep "svm|vmx" /proc/cpuinfo |uniq

centos7 使用virt-install安装虚拟机

2、有输出信息说明支持虚拟化。然后安装libvitd#yum -y install libvirt安装完成后,查看是否安装成功。#yum list installed libvirt

centos7 使用virt-install安装虚拟机

3、安装qemu-kvm#yum -y install qemu-kvm安装完成后,查看是否安装成功。

centos7 使用virt-install安装虚拟机

4、启动libvitd服务#systemctl enable libvirtd#systemctl start libvirtd

centos7 使用virt-install安装虚拟机

5、查看libvirt 状态。#systemctl status libvirtd启动成功。

centos7 使用virt-install安装虚拟机

6、执行命令安装虚拟机。virt-install --connect qemu:///system -n $name -r $mem --vcpus=$cores --disk path=/root/img/$name.img,cache=writeback,size=$size -c /root/iso/CentOS-7-x86_64-Minimal-1511.iso --vnc --vnclisten=0.0.0.0 --vncport=$port --noautoconsole --os-type linux --accelerate --network bridge=bridge -d其中$name 是你的虚拟机名称$mem 是内存大小$cores 是cpu设置$name.img 是镜像名字$size 是系统盘大小$port是vnc端口设置为你自己的就可以了。bridge是桥接网卡名字。-d是debug输出信息。

centos7 使用virt-install安装虚拟机

7、创建完成直接可以使用vnc链接,进行安装了。

© 手抄报圈