740 字
4 分钟
Pve部署黑苹果

因为搞了PVE所以黑苹果肯定少不了,又因为上次测试完忘记做笔记,还得重新做个黑苹果部署手册。

本次用到的环境:PVE8.3、Debian12

1、安装准备

Terminal window
# 解决编辑器BUG
root@debian:~# echo "set nocompatible" >> /etc/vim/vimrc.tiny
root@debian:~# echo "set backspace=2" >> /etc/vim/vimrc.tiny
Terminal window
root@debian:~# systemctl stop iptable firewalld
root@debian:~# cat > /etc/apt/sources.list << EOF
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
EOF
root@debian:~# apt-get update
root@debian:~# apt-get install -y qemu-system uml-utilities virt-manager git \
wget libguestfs-tools p7zip-full make dmg2img tesseract-ocr \
tesseract-ocr-eng genisoimage vim net-tools screen
root@debian:~# git clone --depth 1 --recursive https://github.com/kholia/OSX-KVM.git

2、用工具转换镜像

Terminal window
root@debian:~# cd OSX-KVM/
root@debian:~/OSX-KVM# dmg2img -i BaseSystem.dmg BaseSystem.img
# 这里的104是指我debian的ID号,下面这个命令是把我们转换后的镜像传到pve的ISO的镜像中
root@debian:~/OSX-KVM# pct pull 104 /root/OSX-KVM/BaseSystem.img /var/lib/vz/template/iso/MacOS13.img

image-20250109004641975

3、创建虚拟机

ID默认

image-20250109010941172

镜像选择引导镜像OpenCore,类别Other

image-20250109011033295

根据图上修改,EFI存储和存储根据自己环境进行调整

image-20250109011141543

image-20250109011238840

核心这里看自己资源分配,类别选择host

image-20250109011336749

内存这边就16G起步

image-20250109011400823

网卡模型要修改vmxnet3

image-20250109011419886

查看无误完成

image-20250109011441609

进入虚拟机新建CD驱动盘

image-20250109011533019

image-20250109011617040

然后进去PVE的shell中,修改110虚拟机的配置文件

image-20250109011701160

因为我是英特尔处理器,在配置文件开头增加这行命令:args: -device isa-applesmc,osk=“ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc” -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -global nec-usb-xhci.msi=off -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off -cpu host,vendor=GenuineIntel,+invtsc,+hypervisor,kvm=on,vmware-cpuid-freq=on

AMD处理器增加这个:args: -device isa-applesmc,osk=“ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc” -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -global nec-usb-xhci.msi=off -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off -cpu Haswell-noTSX,vendor=GenuineIntel,+invtsc,+hypervisor,kvm=on,vmware-cpuid-freq=on

增加完后把ide0和ide2的media=cdrom替换成cache=unsafe,修改完成后保存退出即可

image-20250109012232079

回到110虚拟机上进入控制台并启动虚拟机

image-20250109012328354

选中第一个回车,等待进度条跑完

image-20250109012420321

然后进入第四个Disk Utility

image-20250109012659813

选择左边的虚硬盘然后点击右上角的分区按钮,并自己命名名称

image-20250109012823441

成功分区

image-20250109012915329

点击左上红色按钮关闭窗口

image-20250109012936292

选择第二行安装系统

image-20250109012956490

继续

image-20250109013027494

同意协议

image-20250109013121140

image-20250109013129833

选择安装位置

image-20250109013142862

安装时间会比较旧,安装期间会重启几次系统

第一次重启选择第二个macOS installer

image-20250109020643211

image-20250109020654334

第二次重启还是选择第二个macOS installer

image-20250109022412145

第三次重启选择Mac13

image-20250109022940521

第四次重启选择Mac13

image-20250109023110338

进来之后选择语言

image-20250109023542091

之后就一直继续就行

这一步要选择不迁移数据

image-20250109023846713

选择不登陆然后跳过skip

image-20250109181020569

image-20250109181032335

同意许可

image-20250109181109918

点击agree

image-20250109181132881

创建用户名和密码

image-20250109181237310

继续

image-20250109181432591

image-20250109181456819

位置自己选一下

image-20250109181512338

数据分析不发送

image-20250109181557816

稍后测试

image-20250109181618992

自己选就行了

image-20250109181634700

设置键盘

image-20250109181716926

根据提示分别按对应的键盘

image-20250109181742860

image-20250109181758358

image-20250109181805347

到此pve搭建的虚拟机就结束了

image-20250109181834283

镜像资源:**https://cloud.xpled.icu/alist_share/%E5%AE%9E%E8%AE%AD%E5%AE%A4%20PVE%E9%83%A8%E7%BD%B2Black%20Apple**(已经提供转换后的img镜像不用再去git和转换镜像)

Pve部署黑苹果
http://blog.xeu.asia/posts/pve平台/pve部署黑苹果/
作者
Xeu
发布于
2025-01-07
许可协议
CC BY-NC-SA 4.0