Windows 上的虚拟化
Table of Contents
1 HyperV 虚拟化
1.1 激活 Windows 系列虚拟机
如果用的是 windows server 正版系统,标准版和数据中心版分别可以安装 2 个和无限个正版的虚拟机。
Hyper V 虚拟机的激活需要用到 AVMA 密钥,执行 slmgr /ipk <AVMA_key>
。
对 Windows Server 2019 使用以下 AVMA 密钥:
- Datacenter: H3RNG-8C32Q-Q8FRX-6TDXV-WMBMW
- Standard: TNK62-RXVTB-4P47B-2D623-4GF74
- Essentials: 2CTP7-NHT64-BP62M-FV6GG-HFV28
对 Windows Server 版本 1909, 1903 和 1809 使用以下 AVMA 密钥:
- Datacenter: H3RNG-8C32Q-Q8FRX-6TDXV-WMBMW
- Standard: TNK62-RXVTB-4P47B-2D623-4GF74
对 Windows Server 版本 1803 和 1709 使用以下 AVMA 密钥:
- Datacenter: TMJ3Y-NTRTM-FJYXT-T22BY-CWG3J
- Standard: C3RCX-M6NRP-6CXC9-TW2F2-4RHYD
对 Windows Server 2016 使用以下 AVMA 密钥:
- Datacenter: TMJ3Y-NTRTM-FJYXT-T22BY-CWG3J
- Standard: C3RCX-M6NRP-6CXC9-TW2F2-4RHYD
- Essentials: B4YNW-62DX9-W8V6M-82649-MHBKQ
可以针对 Windows Server 2012 R2 使用以下 AVMA 密钥:
- Datacenter: Y4TGP-NPTV9-HTC2H-7MGQ3-DV4TW
- Standard: DBGBW-NPF86-BJVTX-K3WKJ-MTB6V
- Essentials: K2XGM-NMBT3-2R6Q8-WF2FK-P36R2
2 VMWare Workstation 桌面虚拟化
2.1 物理机不能复制文件或文本到虚拟机
VMWare Workstation 有个 Copy and Paste Feature 特性,效果是在物理机上 copy 文件或者文本,可以直接 paste 到虚拟机中。
这个特性的配置方式如下:
- 虚拟机 -> 设置 -> 选项 -> 客户机隔离的两个 check box 都打勾;
- 如果 Linux 虚拟机不带桌面,安装
open-vm-tools
;虚拟机带桌面,安装open-vm-tools-desktop
。
但是这个特性的启用需要满足官方文档给出的条件 ( VMWare workstation 15 ):
- You must install VMware Tools in a virtual machine to use the copy and paste feature.
- The copy and paste feature works with Linux and Windows hosts and Linux, Windows, and Solaris 10 guests only.
- The copy and paste feature requires Linux hosts and guests to run X Windows and Solaris 10 guests to run an Xorg X server and JDS/Gnome.
- Copying and pasting email attachments is restricted to images or files smaller than 4 MB.
- Copying and pasting plain text and formatted text (including the formatting) is restricted to amounts less than 4MB.
- Copying and pasting text is restricted to text in languages that can be represented by Unicode characters.
- Workstation Pro uses the PNG format to encode images that are copied and pasted. Copying and pasting images is restricted to images smaller than 4 MB after conversion to PNG format.
- You cannot copy and paste files between virtual machines.
注意 The copy and paste feature requires Linux hosts and guests to run X Windows 这句,跑在软件内的 Linux 虚拟机只有使用 x-windows 作为桌面底层技术才能启用这个特性。
而 Debian 系统从 Debian 10 开始用的 Gnome 桌面的底层是 wayland,所以从 Debian 10 开始使用 Gnome 桌面的虚拟机不能使用这个特性。
Ubuntu 直到 20.04 LTS 使用的 Gnome 桌面的底层还是 x11,所以可以使用这个特性。Debian 10 使用的 xfce 底层也用了 x11。
启用桌面的条件下,在终端执行 `echo $XDG_SESSION_TYPE` 可以查看目前桌面用的是 wayland 还是 x-windows ( 目前是 x11 )。
2.2 与 VirtualBox 共存时,使用桥接网络的虚拟机断网
在 VMware Workstation 界面上,点击 编辑 -> 虚拟网络编辑器 ( -> 更改设置 -> ) -> 选中类型为 桥接模式 的条目 -> 已桥接至 改成实际上连接到网络的网卡即可。