debian install kvm qemu
2016-06-26 10:23
363 查看
1 首先要查看CPU是否支持虚拟化:
egrep '^flags.*(vmx|svm)' /proc/cpuinfo2 KVM与qemu的关系:
KVM是Linux kernel的一个模块,可以用命令modprobe去加载KVM模块。加载了该模块后,才能进一步通过工具创建虚拟机。但是仅有KVM模块是不够的。因为用户无法直接控制内核去做事情,还必须有一个运行在用户空间的工具才行。这个用户空间的工具,kvm开发者选择了已经成型的开源虚拟化软件QEMU。说起来QEMU也是一个虚拟化软件。它的特点是可虚拟不同的CPU。比如说在x86的CPU上可虚拟一个power的CPU,并可利用它编译出可运行在power上的CPU,并可利用它编译出可运行在power上的程序。KVM使用了QEMU的一部分,并稍加改造,就成了可控制KVM的用户空间工具了。所以你会看到,官方提供的KVM下载有两大部分(qemu和kvm)三个文件(KVM模块、QEMU工具以及二者的合集)。也就是说,你可以只升级KVM模块,也可以只升级QEMU工具。这就是KVM和QEMU的关系。(转)
3 安装KVM qemu
sudo apt-get install qemu-kvm qemu uml-utilities libvirt-bin libvirt-dev加载内核模块:
modprobe kvm_intel #or kvm_amd
安装图形界面管理工具:
sudo apt-get install virt-manager
添加到开机启动:
systemctl enable libvirtd.service
启动服务:
systemctl restart libvirtd.service
添加现有虚拟机出现错误:“ 'internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied failed to initialize KVM: Permission denied”
处理方式:
编辑/etc/libvirt/qemu.conf
user = "root"
# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
group = "root"
# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.
# Set to 0 to disable file ownership changes.
dynamic_ownership = 0
把 user group dynamic_owership 前面的注释去掉
重启服务:
systemctl restart libvirtd.service
4 常用命令:
创建虚拟磁盘:kvm-img create -f qcow2
centos.img 30G
virsh # list # 查看已经运行的虚拟机
virsh # list --all # 查看所有虚拟机
quit # 退出virsh命令模式
快照管理:
create:
virsh snapshot-create-as Server08 snap1
list:
virsh snapshot-list Server08
reverse:
virsh snapshot-revert --domain Server08 snap1
del:
virsh snapshot-delete Server08 snap1
相关文章推荐
- Linux下三大免费桌面虚拟机评测
- convert(一)—— 部署managed
- convirt(二)—— 创建第一台虚机
- QEMU 1: 使用QEMU创建虚拟机
- QEMU 2: 参数解析
- 虚拟磁盘空间不足虚拟电脑运行发生错误的原因及解决
- KVM 虚拟机创建快照
- 搭建CloudStack
- 基于Docker快速搭建多节点Hadoop集群
- KVM网络性能测试(1)
- KVM网络性能测试(2)
- KVM网络性能测试(3)
- 某虚拟化项目中思科与华为交换机链路聚合互连案例
- centos7.3 kvm console下安装网络安装centos7.3
- KVM虚拟磁盘添加
- KVM虚拟机在线添加网卡
- KVM调整cpu和内存