2025-03-25 14:47:17 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								layout: post
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								title: 在UTM中使用苹果虚拟化的各种尝试
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								tags: [虚拟化, 苹果, UTM]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  用官方的方式做非官方的事!<!-- more -->     
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# 起因
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  在几年前刚[收到MacBook Pro ](/2023/02/03/mbp.html )的时候,我曾安装过虚拟机软件[UTM ](https://github.com/utmapp/UTM )。但是因为我的Mac内存很小, , 装过一台黑苹果 ](/2024/06/16/hackintosh.html ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  最近正好由于某些原因我需要在macOS上安装虚拟机, , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# 在UTM中使用苹果虚拟化框架安装Windows
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  如果用过UTM的话应该知道, , Virtualization.framework ](https://developer.apple.com/documentation/Virtualization )( ) , Hypervisor.framework ](https://developer.apple.com/documentation/hypervisor )( ) , , , , , , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  那么现在我想安装Windows, , ? , ( ) ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  我想起来之前[让没用的主机感染木马 ](/2024/11/02/trojan.html )的文章中使用了[一键DD/重装脚本 ](https://github.com/bin456789/reinstall )把我服务器的Linux系统重装成了Windows系统, ? , 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 15:05:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								  我在这之前已经安装过了一个用了VZ的Ubuntu虚拟机, , , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								python3 -m http.server
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  开启一个文件服务器,然后在虚拟机中执行   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								bash reinstall.sh windows --image-name "Windows 10 Pro" --iso "http://192.168.64.1:8000/windows.iso"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  就可以了, , , , , ? , , , , Windows App ](https://apps.apple.com/us/app/windows-app/id1295203466 )( ) , , , 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 14:47:17 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  不过屏幕不能亮是真的没有驱动吗? , , , virtio-win ](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/ )里是有的, , ? , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  再接下来我就需要验证一下它的性能是不是最好的, , , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  至于其他方面, , ,  , , , , , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# 在macOS 12中的UTM使用苹果虚拟化框架安装Linux
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  虽然在刚刚的测试中, , , , , ( ) , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  当然从零开始有点难, , , , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  安装好之后从“/boot”目录中把“vmlinuz”和“initrd.img”复制出来, , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  至于启动参数,可以看“/boot/grub/grub.cfg”中内核后面跟的那串, , , , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  不过这样启动的话在系统中所有对内核以及对initramfs的更新就全都不会生效了, , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# 感想
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  看来苹果的“不支持”不代表真的不支持, , , , , , , , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  不过随着macOS的更新, , ,