找回密码
 立即注册

QQ登录

只需一步,快速开始

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选磁盘工具
513b6918-61b2-11e6-91f2-026d953cbe0b.png
格式磁盘

51373d48-61b2-11e6-8740-69c86bf92d31.png

退出磁盘工具,打开终端
5136ad6a-61b2-11e6-84cd-cb7851119292.png

执行:
  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
复制代码




本教程由无限星辰工作室CRX349独家整理和提供,转载请注明地址,谢谢。本文地址:https://www.xmspace.net/thread-603-1-1.html
无限星辰工作室  好集导航 Discuz全集下载  星辰站长网  集热爱361  一品文学  手机小游戏合集   海外空间网 星辰api  星辰支付二维码管理平台 阿里云服务器 腾讯云服务器
服务Discuz!建站|DiscuzQ配置|二开|小程序|APP|搬家|挂马清理|防护|Win/Linux环境搭建|优化|运维|
服务理念:专业 诚信 友好QQ842062626 服务项目 Q群315524225

发表于 2018-4-28 23:46:01 | 显示全部楼层 |阅读模式

回复 | 使用道具 举报

该帖共收到 0 条回复!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

美图秀

    • fastadmin 后台界面使用字段数组类型
    • Discuz!x3.5 修改标题高亮颜色
    • Discuz!x3.5 应用中心 下载应用一直下载中
    • 帖子定时显示
    • 论坛辅助审核
拖动客服框
Online Service
点击这里给我发消息
点击这里联系我们
微信扫一扫
在线客服
快速回复 返回顶部 返回列表