首先要在bios中开启Intel-vt,KVM 的代码都并入Kernel了,所以安装也比较简单。
michael@homeserver:~$ sudo apt update michael@homeserver:~$ sudo apt install qemu qemu-kvm libvirt-bin bridge-utils virt-manager michael@homeserver:~$ service libvirtd start michael@homeserver:~$ update-rc.d libvirtd enable
配置Bridge 是难点默认是NAT,这样你就很难访问机器里的资源了, Ubuntu desktop 使用的是NetworkManager,我感觉它不是特别好用,卸载完NetworkMananger想换回原始的system-networkd 导致最终非常复杂,网都连不上了。系统也没有东西,为了省时。重装系统使用Netplan配置。
michael@homeserver:~$ cat /etc/netplan/01-network-manager-all.yaml # Let NetworkManager manage all devices on this system network: version: 2 renderer: NetworkManager ethernets: eno1: dhcp4: no dhcp6: no bridges: br0: interfaces: [eno1] dhcp4: no addresses: [192.168.200.5/24] gateway4: 192.168.200.1 nameservers: addresses: [192.168.1.1,192.168.200.1]
michael@homeserver:~$ sudo netplan --debug apply
不知道为什么,重启服务没有什么用,我最终重启了机器。
michael@homeserver:~$ ifconfig br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.200.5 netmask 255.255.255.0 broadcast 192.168.200.255 inet6 fe80::c4e1:3dff:fe5a:3b4 prefixlen 64 scopeid 0x20<link> ether 34:e6:d7:43:f6:e9 txqueuelen 1000 (Ethernet) RX packets 2767094 bytes 912150605 (912.1 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 860281 bytes 6305749082 (6.3 GB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 34:e6:d7:43:f6:e9 txqueuelen 1000 (Ethernet) RX packets 3696177 bytes 1556421623 (1.5 GB) RX errors 0 dropped 38 overruns 0 frame 0 TX packets 5155253 bytes 6569117858 (6.5 GB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 20 memory 0xf7200000-f7220000 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 722801 bytes 6280259738 (6.2 GB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 722801 bytes 6280259738 (6.2 GB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:79:1b:f0 txqueuelen 1000 (Ethernet) RX packets 583 bytes 89412 (89.4 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 352 bytes 313486 (313.4 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::fc54:ff:fe50:92eb prefixlen 64 scopeid 0x20<link> ether fe:54:00:50:92:eb txqueuelen 1000 (Ethernet) RX packets 161600 bytes 14098109 (14.0 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 272378 bytes 319406090 (319.4 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 michael@homeserver:~$ brctl show bridge name bridge id STP enabled interfaces br0 8000.34e6d743f6e9 yes eno1 vnet0 virbr0 8000.525400791bf0 yes virbr0-nic
安装Windows 10 的时候,发觉有两个鼠标,并且非常难控制。有人提了一句启动的时候加入,-usb -usbdevice tablet。 KVM并不是太懂,所以又查了查,有老外给了个解决方法,最终解决。
The equivalent for that is to open up the virtual machine details > Add Hardware > Input > EvTouch USB Graphics Tablet
目标的homeoffice 环境如下:
Reference:
https://www.linuxtechi.com/install-configure-kvm-ubuntu-18-04-server/
https://www.linuxquestions.org/questions/slackware-14/mouse-cursor-in-kvm-guest-4175575243/