Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Latest commit

 

History

History
163 lines (109 loc) · 2.91 KB

KVM.org

File metadata and controls

163 lines (109 loc) · 2.91 KB

KVM

Install

Host

Debian

sudo apt install -y qemu-kvm libvirt-clients libvirt-daemon-system
sudo adduser $USER libvirt
sudo adduser $USER libvirt-qemu
sudo adduser $USER kvm
sudo su -l $USER

Arch

sudo pacman -S virt-viewer virt-manager virt-install qemu

Centos 7

sudo yum install -y qemu-kvm qemu-img libvirt libvirt-python libvirt-client virt-install
sudo usermod -aG libvirt,kvm,qemu $USER

sudo systemctl start libvirtd
sudo systemctl status libvirtd
sudo systemctl enable libvirtd
sudo rmmod kvm_intel
sudo rmmod kvm
sudo modprobe kvm
sudo modprobe kvm_intel

启动

sudo systemctl start libvirtd
sudo systemctl status libvirtd
sudo systemctl enable libvirtd

Windows Hyper-V Enlightenments

Host

sudo virt-xml $VMNAME --edit --features hyperv_relaxed=on,hyperv_vapic=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=8191
sudo virt-xml $VMNAME --edit --clock hypervclock_present=yes

Clock

Host (Virsh)

似乎过不了xml检查,但是好像也没事

Block

Host (Virt Manager)

  • PCI Bus 选 Virtio SCSI
  • Block Device 选 Virtio

Guest

安装 viostor 和 vioscsi

内存

Guest

安装 Balloon

显示、拖拽、剪贴板:Spice

Host (Virt Manager)

  • Enable Spice Channel and Spice server
  • Graphics: use QXL
  • Enable resize on Virt Manager

让 Windows 虚拟机认可 Linux 宿主机的键位

Guest

  • 在Windows内装上 keytweak
  • 把里面键位调得和外面一样
  • 我不知道为什么这件事要做两次,大概VM拿到的按键信息是 原始键位 和 Host键位 的混合

声音

Host (Virt Manager)

Arch 教程

然后我选ich6(和电脑上比较像)

Windows Guest 共享文件:samba

在Linux上搭samba太麻烦了,windows自带,只在内网开启。这样虽然Windows无法访问Linux文件,但是Linux可以。 其实有spice的拖拽,这个方向是不需要samba的……

Windows Guest

Host

Gnome系

sudo pacman -S gvfs-smb

Nautilus

ctrl + l 然后输入 smb://$ip

虚拟机线下迁移

原宿主机

DOMAIN=
sudo dd if=x | gzip | ssh oldhost bash -c 'gunzip -c | sudo dd of=y'
sudo virsh dumpxml $DOMAIN >$DOMAIN.xml
# 做必要的修改

新宿主机

sudo virsh define $DOMAIN.xml

虚拟机Console

grub

console=ttyS0

IPv6 Macvtap

virsh edit $domain
<interface type='direct' trustGuestRxFilters='yes'>

IOMMU

sudo dmesg | grep -e DMAR -e IOMMU

SPICE for windows

https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe