| 282 | = 【補充: 安裝 windows (使用 HVM 模式)】 = |
| 283 | * 檢查硬體(CPU)是否支援 |
| 284 | {{{ |
| 285 | // Intel CPU |
| 286 | grep --color vmx /proc/cpuinfo |
| 287 | |
| 288 | // AMD CPU |
| 289 | grep --color svm /proc/cpuinfo |
| 290 | }}} |
| 291 | * 檢查 BIOS 是否 enabled (有些主機板預設會 disable) |
| 292 | |
| 293 | * 製作 Windows Image |
| 294 | {{{ |
| 295 | // 放到光碟到光碟機,製作 iso 檔 |
| 296 | $ cd /home/domains |
| 297 | $ sudo dd if=/dev/cdrom of=windows7.iso |
| 298 | }}} |
| 299 | * 製作虛擬機器的 Image |
| 300 | {{{ |
| 301 | $ sudo dd if=/dev/zero of=xenwin.img bs=1024k seek=10000 count=0 |
| 302 | }}} |
| 303 | |
| 304 | * 編輯設定檔 |
| 305 | {{{ |
| 306 | $ sudo gedit xenwin.cfg |
| 307 | }}} |
| 308 | {{{ |
| 309 | #!sh |
| 310 | import os, re |
| 311 | arch = os.uname()[4] |
| 312 | if re.search('64', arch): |
| 313 | arch_libdir = 'lib64' |
| 314 | else: |
| 315 | arch_libdir = 'lib' |
| 316 | |
| 317 | kernel = "/usr/lib/xen-3.2-1/boot/hvmloader" |
| 318 | builder='hvm' |
| 319 | memory = 1024 |
| 320 | |
| 321 | # Should be at least 2KB per MB of domain memory, plus a few MB per vcpu. |
| 322 | shadow_memory = 8 |
| 323 | name = "xenwin" |
| 324 | vif = [ 'type=ioemu, bridge=eth0' ] |
| 325 | acpi = 1 |
| 326 | apic = 1 |
| 327 | disk = [ 'file:/home/domains/xenwin.img,hda,w', 'file:/home/domains/windows.iso,hdc:cdrom,r' ] |
| 328 | |
| 329 | device_model = '/usr/lib/xen-3.2-1/bin/qemu-dm' |
| 330 | |
| 331 | #----------------------------------------------------------------------------- |
| 332 | # boot on floppy (a), hard disk (c) or CD-ROM (d) |
| 333 | # default: hard disk, cd-rom, floppy |
| 334 | boot="dc" |
| 335 | sdl=0 |
| 336 | vnc=1 |
| 337 | vncconsole=1 |
| 338 | vncpasswd='' |
| 339 | |
| 340 | serial='pty' |
| 341 | usbdevice='tablet' |
| 342 | }}} |
| 343 | |
| 344 | * 啟動 xenwin |
| 345 | {{{ |
| 346 | $ sduo xm create xenwin.cfg |
| 347 | }}} |
| 348 | ---- |