无限星辰工作室-客户无限互联网动力之源

标题: KVM安装MAC系统流程 [打印本页]

作者: crx349    时间: 2018-4-28 23:46
标题: KVM安装MAC系统流程
系统环境:Ubuntu 16.04
1.先安装好KVM 不属于本教程内容2.使用 https://github.com/kholia/OSX-KVM 方案
3.创建磁盘空间
  1. qemu-img create -f qcow2 /kvm/mac/mac1012.img 200G
复制代码

4.kvm安装MAC配置文件
  1. <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  2.   <name>OSX_KVM</name>
  3.   <title>OSX-KVM</title>
  4.   <description># echo 1 > /sys/module/kvm/parameters/ignore_msrs</description>
  5.   <memory unit='KiB'>4194304</memory>
  6.   <currentMemory unit='KiB'>4194304</currentMemory>
  7.   <vcpu placement='static'>2</vcpu>
  8. <uuid>c757b31e-115f-4d1a-b574-0ae7b3cc8a58</uuid>
  9.   <os>
  10.     <type arch='x86_64' machine='pc-q35-2.4'>hvm</type>
  11.     <kernel>/Install_macOS_Sierra_OS_X_10.12/enoch_rev2839_boot</kernel>
  12.   </os>
  13.   <features>
  14.     <acpi/>
  15.     <kvm>
  16.       <hidden state='on'/>
  17.     </kvm>
  18.   </features>
  19.   <cpu mode='custom' match='exact'>
  20.     <model fallback='allow'>Penryn</model>
  21.   </cpu>
  22.   <devices>
  23.     <emulator>/usr/bin/qemu-system-x86_64</emulator>
  24.     <disk type='file' device='disk'>
  25.       <driver name='qemu' type='qcow2'/>
  26.       <source file='/kvm/mac/mac1012.img'/>
  27.       <target dev='sda' bus='sata'/>
  28.       <boot order='1'/>
  29.       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
  30.     </disk>
  31.     <interface type='network'>
  32.       <source network='default'/>
  33.       <model type='e1000-82545em'/>
  34. <mac address='52:54:00:3d:f8:25'/>
  35.       <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
  36.     </interface>
  37.     <input type='mouse' bus='usb'/>
  38.     <input type='keyboard' bus='usb'/>
  39.     <graphics type='vnc' port='5996' autoport='no' listen='127.0.0.1' keymap='en-us'>
  40.       <listen type='address' address='127.0.0.1'/>
  41.     </graphics>
  42.     <video>
  43.       <model type='vmvga' vram='16384' heads='1'/>
  44.       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
  45.     </video>
  46.     <memballoon model='none'/>
  47.   </devices>
  48.   <qemu:commandline>
  49.     <qemu:arg value='-device'/>
  50.     <qemu:arg value='isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc'/>
  51.     <qemu:arg value='-smbios'/>
  52.     <qemu:arg value='type=2'/>
  53.     <qemu:arg value='-k'/>
  54.     <qemu:arg value='en-us'/>
  55.     <qemu:arg value='-cpu'/>
  56.     <qemu:arg value='Penryn,vendor=GenuineIntel'/>
  57.     <qemu:arg value='-device'/>
  58.     <qemu:arg value='ide-drive,bus=ide.1,drive=MacDVD'/>
  59.     <qemu:arg value='-drive'/>
  60.     <qemu:arg value='id=MacDVD,if=none,snapshot=on,file=/Install_macOS_Sierra_OS_X_10.12/Install_macOS_Sierra_(OS_X_10.12).iso'/>
  61.   </qemu:commandline>
  62. </domain>
复制代码

保存为 macOS-libvirt.xml终端运行:
  1. virsh define /KVM/macOS-libvirt.xml
复制代码

5.终端运行:
  1. echo 1 > /sys/module/kvm/parameters/ignore_msrs
复制代码


开机执行
  1. vim /etc/rc.local
  2. echo 1 > /sys/module/kvm/parameters/ignore_msrs
复制代码


6.安装selinux 并设置重启
  1. sudo apt-get install selinux
  2. #设置selinux=permissive
  3. reboot
复制代码
7.kvm控制台启动OSX-KVM选磁盘工具
(, 下载次数: 1134)
格式磁盘

(, 下载次数: 1117)

退出磁盘工具,打开终端
(, 下载次数: 1131)

执行:
  1. cp -av /Extra /Volumes/KVMDisk
复制代码
9.退出终端,按提示安装mac
10.关闭mac
11.使用配置文件创建mac虚拟机
  1. <domain type='kvm' xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
  2.   <name>sierra</name>
  3.   <description># echo 1 > /sys/module/kvm/parameters/ignore_msrs</description>
  4.   <memory unit='KiB'>4194304</memory>
  5.   <currentMemory unit='KiB'>4194304</currentMemory>
  6.   <vcpu placement='static'>2</vcpu>
  7.   <os>
  8.     <type arch='x86_64' machine='pc-q35-2.4'>hvm</type>
  9.     <kernel>/Install_macOS_Sierra_OS_X_10.12/enoch_rev2839_boot</kernel>
  10.   </os>
  11.   <features>
  12.     <acpi/>
  13.     <kvm>
  14.       <hidden state='on'/>
  15.     </kvm>
  16.   </features>
  17.   <cpu mode='custom' match='exact'>
  18.     <model fallback='allow'>Penryn</model>
  19.   </cpu>
  20.   <devices>
  21.     <emulator>/usr/bin/kvm-spice</emulator>
  22.     <disk type='file' device='disk'>
  23.       <driver name='qemu' type='qcow2'/>
  24.       <source file='/kvm/mac/mac1012.img'/>
  25.       <target dev='sda' bus='sata'/>
  26.       <boot order='1'/>
  27.       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
  28.     </disk>
  29.     <interface type='bridge'>
  30.       <source bridge='br0'/>
  31.       <model type='e1000-82545em'/>
  32.       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
  33.     </interface>
  34.     <input type='mouse' bus='usb'/>
  35.     <input type='keyboard' bus='usb'/>
  36.     <graphics type='vnc' port='5996' autoport='no' listen='127.0.0.1' keymap='en-us'>
  37.       <listen type='address' address='127.0.0.1'/>
  38.     </graphics>
  39.     <video>
  40.       <model type='vmvga' vram='16384' heads='1'/>
  41.       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
  42.     </video>
  43.     <memballoon model='none'/>
  44.   </devices>
  45.   <qemu:commandline>
  46.     <qemu:arg value='-device'/>
  47.     <qemu:arg value='isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc'/>
  48.     <qemu:arg value='-smbios'/>
  49.     <qemu:arg value='type=2'/>
  50.     <qemu:arg value='-k'/>
  51.     <qemu:arg value='en-us'/>
  52.     <qemu:arg value='-cpu'/>
  53.     <qemu:arg value='Penryn,vendor=GenuineIntel'/>
  54.   </qemu:commandline>
  55. </domain>
复制代码
保存为sierra.xml
7.执行:
  1. virsh define /KVM/sierra.xml
复制代码


8.运行虚拟机,就可以快乐的玩MAC咯~(vnc后可以远程协助哦)

9.设置服务器开机自动启动虚拟机
  1. virsh autostart sierra
复制代码








欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://xmspace.net/) Powered by Discuz! X3.4