четверг, 5 января 2017 г.

Detailed Arch Linux installation for beginners.

1. Preparation
First of all we need to get the latest installation CD:

https://www.archlinux.org/download/ - here we can get it via torrent or download directly from one of Arch Linux mirrors.

After successfull download it is nesessary to burn it to DVD or prepare USB-stick.

for Linux users:

$ md5sum isoimage.iso
after calculating the result should be the same for source *.iso and for burned one!

burn DVD through terminal:
$ growisofs -dvd-compat -Z /dev/sr0=isoimage.iso | md5sum
dvd+rw-tools package contains this command
or use any other DVD-burning application: brasero, xfburn etc.

prepare a stick:
# dd if=isoimage.iso of=/dev/sdX status=progress | md5sum

for Windows users:

burn DVD through any DVD-burning application

prepare stick with "win32 disk imager"

for macOS users:

burn DVD through any DVD-burning application

prepare a stick:
insert USB-stick
open Terminal
$ sudo -s
# diskutil list (find your stick)
# umount /dev/diskX
# dd if=isoimage.iso of=/dev/diskX

2. Boot installation media

In my article I will use UEFI, so please keep in mind that on older hardware some steps won't work!
Also it is recommended to disable CSM in your UEFI-bios.

This is what you should see if the previous step was made correctly:
By default the first entry will boot.

When the boot process is completed a shell with blinking cursor should appear:

First of all it is nesessary to check if the network is up to be able to proceed with installation:
# ifconfig -a
On the picture we can see that we got ip address via dhcp (by default), if you have non-standard configuration of you network or wish to connect via Wi-Fi - please read the "Setup network" section of my article. Otherwise let's proceed to the preparation of our storage for the installation.

3. Prepare storage

Important! Always check carefully that the disk with which you are working is selected correctly, otherwise you can loose your data!

# ls /dev | grep sd
This command shows all the contents of /dev directory containing letters "sd"
In my case the result is:
sda
It means that I have 1 physical drive with no partitions. Partitioned drives are shown as sdX1, sdX2, ..

Let's choose and write partition table:
# gdisk /dev/sda
o (it will create clean GPT partition table)
w (it will write all changes to the media)

The next step is to create some partitions:
# cgdisk /dev/sda
[New] - Enter - 128M - ef00 - EFI (create special EFI partition for bootloader)
Select free space after - [New] - Enter - 10G - 8300 - System (root "/" partition)
Select free space after - [New] - Enter - 1G - 8200 - Swap (swap partition)
Select free space after - [New] - Enter - 4G - 8300 - Var ("/var" partition)
Select free space after - [New] - Enter - Enter - 8300 - Home ("/home" partition)
[Write]
[Quit]

Now let's choose and format our partitions:
# mkfs.fat -F32 -v /dev/sda1 -n EFI
# mkfs.ext4 -L System /dev/sda2
# mkswap -L Swap /dev/sda3
# mkfs.ext4 -L Var /dev/sda4
# mkfs.ext4 -L Home /dev/sda5
# swapon /dev/sda3

You can create as many partitions as you want, but you should understand what each partition will be used for! For better understanding please read http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/

4. Creating mountpoints
It is important to mount our root "/" filesystem and then to create some directories to be able to proceed with the installation:

# mount /dev/sda2 /mnt
# mkdir /mnt/{boot,var,home}
# mount /dev/sda1 /mnt/boot
# mount /dev/sda4 /mnt/var
# mount /dev/sda5 /mnt/home

Please check that the mounted filesystems and mountpoints are correct with the:
# lsblk

5. Basic system installation

In Arch Linux pacstrap command is used to download and install packages during basic installation:
# pacstrap /mnt base base-devel sudo syslinux traceroute openssh mc docbook-xsl pv srm efibootmgr p7zip dosfstools ntfs-3g acpid net-tools usbip btrfs-progs cpulimit dmidecode zip unzip unarj unace unrar ethtool hexedit cabextract hfsprogs atool atftp lm_sensors gpm hddtemp hdparm sdparm cifs-utils bridge-utils dnsutils cronie xmlto pkgfile rsync nbtscan ico2xpm gptfdisk gpart parted mtools smartmontools tree xdg-user-dirs dvd+rw-tools gif2png nrg2iso ccd2iso mdf2iso bin2iso squashfs-tools exfat-utils pm-utils hwinfo f2fs-tools fsarchiver lsof strace htop inotify-tools cdrkit cdparanoia dnsmasq icoutils

Not all of these pacakges are strictly needed but they can be very handy in the future.
TIP: if it is difficult for you to manually enter the whole list of packages - you can connect from any other PC to your installation via SSH-protocol using putty in Windows or terminal in Linux or macOS. For this enter:
# passwd
Enter your root password twice!
# systemctl restart sshd
# ifconfig (find what IP-address you have)
Connect remotely: root@<ip-address>
Enter "Yes" to accept RSA key
Enter root password
Now you can read this article and paste necessary commands in the ssh-terminal!

If all packages were downloaded and installed successfully we can proceed.

6. Basic setup

Now we need to inform our system about partitions and filesystems: to which mountpoint each partitin should be mounted to. So we need to enter:

# genfstab -U -p /mnt >> /mnt/etc/fstab

It will generate special file called "fstab" with the list of our partitions and mountpoints and the option "-U" will help to mount them using UUID 

# cat /mnt/etc/fstab (check if everything is OK)
# arch-chroot /mnt (enter the newly installed system via chroot)

Locales

# nano /etc/locale.gen (edit additional locales, in my case English, Russian)
en_US.UTF-8 UTF-8
ru_RU.UTF-8 UTF-8

Ctrl+X, Enter (This will save changed document)

# nano /etc/locale.conf
LANG=ru_RU.UTF-8

# nano /etc/vconsole.conf
KEYMAP=ru
FONT=cyr-sun16

# locale-gen

Time

# date
# hwclock --set --date "MM/DD/YYYY hh:mm:ss" (set date and time if it is nesessary)
# hwclock --systohc (sync system clock to hardware clock - optional)
# hwclock --hctosys (sync hardware clock to system clock - optional)

# nano /etc/adjtime
LOCAL (or UTC)

# ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime

Hostname

# nano /etc/hostname
ARCH-TEST

Repositories

# nano /etc/pacman.conf
[archlinuxfr]
SigLevel = Optional
Server = http://repo.archlinux.fr/$arch

This is the largest repository in Arch Linux where you can download extra packages not included in official repositories.

# pacman -Syu (update package database)
# pacman -Scc (clean local package database)

Bootloader (UEFI)

# mkdir -p /boot/EFI/syslinux
# cp -r /usr/lib/syslinux/efi64/* /boot/EFI/syslinux
# efibootmgr -c -d /dev/sda -p 1 -l /EFI/syslinux/syslinux.efi -L "UEFI: Arch Test"
(This command should be executed very carefully, check the disk and the partition number!)

# blkid /dev/sda2
(You should get all info about partition: Name, UUID, PARTUUID etc.) Write down, remember or copy via ssh the UUID or PARTUUID!

# nano /boot/syslinux/syslinux.cfg
Find string:
APPEND root=/dev/... rw 
and replace it with:
APPEND root=PARTUUID=<paste_here_your_PARTUUID> rw

The same should be repeated for "LABEL archfallback"
It will prevent your installation from boot errors if you forgot some usb-stick in the port and rebooted your PC. For extra options please read: https://wiki.archlinux.org/index.php/syslinux

Kernel modules
# nano /etc/mkinitcpio.conf
(This file contains modules and hooks for early boot stage, it is strictly nesessary to edit it if you need something to be configured before the root file system is mounted)

# mkinitcpio -p linux (if you made changes and want to apply them)

Services
Also we need to setup and enable some services:

# systemctl enable sshd.service (SSH Daemon)
# systemctl enable acpid.service (ACPI Subsystem)
# systemctl enable gpm.service (Enable mouse support in terminal)
# systemctl enable cronie.service (Schedule tasks)
# systemctl enable atftpd (Advanced TFTP daemon)

# chown nobody:users /srv/atftp (set correct rights to our TFTP directory)

Users
# passwd
(Change root password)
# useradd -m -g users -s /bin/bash -G audio,video,network,optical,storage,lp,scanner,uucp,wheel -c "User" user (create new user and add him to several system groups)
# passwd user (change user password)

Reboot

# exit
# umount /mnt/{boot,var,home}
# umount /mnt
# reboot

Final steps

If you did everything right a fresh Arch Linux system should successfully boot.
You should be able to see console and move mouse in it, also if your network is up - you will be able to connect to your PC remotely via SSH (as user NOT as root!) for further setup!

7. Network

Wired

# ifconfig -a
If you have wired ethernet connection you should find something like enp0s6 (in my case)
In Arch Linux netctl daemon controls network connections, so first of all we should choose what type of connection we want to setup:

# ls /etc/netctl/examples
Here are some example configuration files. In my case it will be ethernet-static.
# cp /etc/netctl/examples/ethernet-static /etc/netctl/

Now change these lines, according to your "ifconfig -a" output:
# nano /etc/netctl/ethernet-static
Interface=enp0s6
Address=('192.168.1.115/24')
Gateway='192.168.1.1'
DNS=('192.168.1.1')

# netctl enable ethernet-static
# netctl start ethernet-static
# ping google.com
If you did everything correctly you will see ping responses from google.com
The setup of other types of wired connections is indentical.

Wireless

# rfkill list all (display all locked/unlocked/turned off wireless, bluetooth devices)
# rfkill unblock all (unblock all locked/unlocked/turned off wireless, bluetooth devices)
# iw dev (some usefull information about your wireless device)
# iw dev wlp2s0 link (check if you're connected to the network)
# ip link set wlp2s0 up (set your wireless interface up)
# ip link show wlp2s0 (check if the wireless interface is up)
# iw dev wlp2s0 scan | less (display available SSIDs)
# iw dev wlp2s0 connect SSID (no encryption)
# iw dev wlp2s0 connect SSID key 0:WEP_KEY
# iw dev wlp2s0 connect SSID key d:2:WEP_KEY (ASCII WEP key)
# wpa_supplicant -B -i wlp2s0 -c <(wpa_passphrase SSID WPA_KEY)
# nano /etc/wpa_supplicant.conf (this is for hidden SSIDs)
network={

                ssid="HIDDEN_SSID"
                scan_ssid=1
                psk="PASSWORD"
                mode=0
                proto=WPA2
                key_mgmt=WPA-PSK
                pairwise=CCMP
                group=CCMP
                auth_alg=OPEN
                id_str="ARCH-TEST"
                priority=1
}
# wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant.conf
# dhcpcd wlp2s0
# ping google.com

Now you should be able to access Internet through your wireless network!

8. Graphical environment
Xorg server


Let's setup Xorg server to be able to use more user-friendly interface:
# pacman -S xorg
(Here you can either choose only some components or if you're not sure install all of them)
# cp /usr/share/X11/xorg.conf.d/* /etc/X11/xorg.conf.d/
# nano /etc/X11/xorg.conf.d/10-evdev.conf
(Here it is nessesary to add some options to have server keyboard layouts and to be able to change them)
Add these lines in the section with Identifier "evdev keyboard catchall":
                Option "XkbLayout" "us,ru"
Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"
Save the document.

# cd /etc/fonts/conf.d
# ln -s ../conf.avail/XX-foo.conf (this is for proper font hinting)
# pacman -S xorg-xinit evtest ttf-liberation (some extra useful packages)
Now you have installed basic graphical environment.

MATE Desktop
# pacman -S mate mate-extra
(Here you can choose to install all or separate components)

# pacman -S gtk-engines gtk-engine-murrine xdg-user-dirs-gtk pulseaudio ossp alsa-plugins alsa-utils pulseaudio-alsa lightdm lightdm-gtk-greeter tigervnc ffmpegthumbnailer gtk-recordmydesktop pavucontrol gvfs-smb gvfs-mtp gvfs-gphoto2 gnome-disk-utility gparted transmission-gtk gnome-schedule chromium python2-blueman obexftp obextool cups
networkmanager modemmanager ppp usb_modeswitch network-manager-applet 
(This is some basic packages which can help you)
# netctl disable <you-ethernet-connection>
(to be able to configure networks through Network Manager)
# systemctl enable NetworkManager
# systemctl enable bluetooth
# systemctl enable org.cups.cupsd.service (Printing subsystem)
# systemctl enable cups-browsed.service
# systemctl enable lightdm (Enable display manager)
# reboot
If you did everything correctly you will see login screen:

Enter your password and you are on your own graphical MATE desktop!
Congratulations!

Now you can read official Arch Linux documentaion and try to install some more packages:
Open Applications -> System -> MATE Terminal and enter:
$ su
Enter your root password
# pacman -S libreoffice-fresh
# pacman -S yaourt (to be able to get packages from AUR repository)



среда, 30 января 2013 г.

Arch Linux 01.2013 Installation



Знаю, что Arch Linux, в основном, выбор опытных пользователей, но возможно, просто будет удобно держать все параметры и саму конфигурацию установки в одном месте:

# Arch Install 01/2013

------BOOT FROM FLASH------

cfdisk

mkfs.reiserfs /dev/sdXy -l <label>

mount /dev/sdXy /mnt

pacstrap /mnt base base-devel grub-bios cifs-utils bridge-utils lm_sensors hddtemp gpm openssh net-tools dosfstools ntfsprogs

genfstab -p /mnt >> /mnt/etc/fstab -U

arch-chroot /mnt

nano /etc/fstab
# change /dev/sdXy to /dev/disk/by-uuid/<uuid>
# cifs //<ip>/<shared-folder> /<mount>/<point> cifs uid=<uid>,gid=<gid>,username=<username>,password=<password>,workgroup=<WORKGROUP>,ip=<ip>,suid,user,noauto 0 0

nano /etc/hostname
<hostname>

ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime

nano /etc/adjtime
LOCAL

nano /etc/locale.gen
ru_RU.UTF-8

nano /etc/locale.conf
LANG=ru_RU.UTF-8

nano /etc/vconsole.conf
KEYMAP="ru"
FONT="cyr-sun16"

locale-gen

nano /etc/mkinitcpio.conf

MODULES="<modules> <modules>" #example: MODULES="i915 tun bridge fuse kvm kvm-intel pci-stub pci-hotplug virtio-pci virtio-blk virtio-net"

mkinitpcio -p linux

nano /etc/modprobe.d/modprobe.conf
#example:
blacklist nouveau
blacklist radeon
blacklist snd-hda-codec-hdmi

nano /etc/default/grub
#example:
GRUB_CMDLINE_LINUX_DEFAULT="quiet ipv6.disable=1 intel_iommu=on"
GRUB_GFXMODE=800x600
#GRUB_GFXPAYLOAD_LINUX=keep
GRUB_COLOR_NORMAL="green/black"
GRUB_COLOR_HIGHLIGHT="black/green"

grub-mkconfig -o /boot/grub/grub.cfg

nano /boot/grub/grub/.cfg
set lang=ru

grub-install /dev/sdX

passwd

useradd -m -g users -s /bin/bash -G audio,video,optical,network,lp,scanner,storage,uucp,wheel <username>

passwd <username>

systemctl enable gpm.service

cp /etc/network.d/examples/bridge /etc/network.d/bridge
nano /etc/network.d/bridge
#example:
BRIDGE_INTERFACES="enp5s0"

systemctl enable netcfg@bridge.service

nano /etc/ssh/ssh_config
ForwardX11 yes
ForwardX11Trusted yes

nano /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

systemctl enable sshd.service

exit

umount /mnt

reboot


------BOOT FROM HDD------

nano /etc/pacman.conf

[archlinuxfr]
Server = http://repo.archlinux.fr/$arch

[mate}
Server = http://repo.mate-desktop.org/archlinux/$arch

pacman -Syu

pacman -S xorg

#example: 1,2,3... or 1-100

cd /etc/fonts/conf.d
ln -s ../conf.avail/XX-foo.conf

pacman -S ttf-liberation xcursor-neutral

nano /etc/X11/xorg.conf.d/10-evdev.conf
Option "XkbLayout" "us,ru"
Option "XkbOptions" "grp:alt_shift_toggle"

nano /etc/X11/xorg.conf.d/50-joystick.conf
Option "StartKeysEnabled" "false"
Option "StartMouseEnabled" "false"

su <user>
nano .xinitrc
exec <name-of-the-session>

#example: exec mate-session

pacman -S slim mate mate-extra

systemctl enable slim.service

mkdir /usr/share/icons/default
nano /usr/share/icons/default/index.theme
[Icon Theme]
Inherits=Neutral


------Intel SNA------
nano /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
   Option      "AccelMethod"  "sna"
EndSection

------MATE Compiz------
mateconf-editor
/desktop/mate/session/required_components/windowmanager
marco -> compiz

pacman -S compiz-core compiz-fusion-plugins-main compiz-fusion-plugins-extra ccsm emerald emerald-themes

ccsm:
Common Settings: Virtual Desktop Size 1x1
Effects: Window Decorations command: emerald
Shift Switcher X
Change window size X
Move Window X

nano /usr/share/applications/compiz.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Compiz
Exec=/usr/bin/compiz ccp  #Make sure ccp is included so that Compiz loads your previous settings.
NoDisplay=true
# name of loadable control center module
X-GNOME-WMSettingsModule=compiz
# autostart phase
##-> the folloing line cause gnome-session warning and slow startup, so try not to enable this
# X-GNOME-Autostart-Phase=WindowManager
X-GNOME-Provides=windowmanager
# name we put on the WM spec check window
X-GNOME-WMName=Compiz
# back compat only
X-GnomeWMSettingsLibrary=compiz

chmod a+x /usr/share/applications/compiz.desktop


------x11vnc------
pacman -S x11vnc
mkdir ~/.x11vnc
$ x11vnc -storepasswd <password> ~/.x11vnc/passwd
$ x11vnc -display :0 -many -rfbauth ~/.x11vnc/passwd

вторник, 29 января 2013 г.

Виртуальная машина Qemu-KVM с OSX Mountain Lion 10.8.2

Сегодня хочу поделиться с вами способом создания Qemu-KVM виртуальной машины с OSX 10.8.2 в качестве гостевой операционной системы.

Итак приступим!

Нам понадобится CPU и материнская плата c поддержкой VT-x и VT-d. В моем случае - это ASRock Z77 Exreme 6 с процессором Intel Core i5 3470. Так же для работы с qemu-kvm необходим установленный дистрибутив Linux (например я использую Arch Linux).

Так как у меня не получилось запустить OSX с помощью штатного пакета qemu-kvm в составе Arch Linux, я решил попробовать собрать самостоятельно более новую версию Qemu версии 1.3.1.

yaourt -S celt spice cegui-0.6 texi2html

cegui-0.6 - для успешной сборки необходимо добавить в PKBUILD lua51 в зависимости сборки

wget http://wiki.qemu.org/download/qemu-1.3.1.tar.bz2

(md5: 5dbc6c22f47efca71dfaae0dd80dcf9e)

tar -jxvf qemu-1.3.1.tar.bz2 qemu

cd qemu

./configure --python=/usr/bin/python2 --sysconfdir=/etc --enable-kvm --audio-drv-list=pa,alsa,sdl --audio-card-list=ac97,sb16,es1370,hda --enable-spice --enable-vhost-net --enable-guest-agent --enable-mixemu --libexecdir=/usr/lib/qemu --target-list=i386-softmmu,x86_64-softmmu,arm-softmmu,i386-linux-user,x86_64-linux-user,arm-linux-user,armeb-linux-user --enable-docs

make

make install

Далее мы соберем seabios из git для устранения бага с крахом окна "about this mac":

yaourt -S iasl git wget

export LANG=en_US.UTF-8

git clone git://git.seabios.org/seabios.git

wget http://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/seabios-mac-20121206.patch

nano seabios-mac-20121206.patch #Тут нам понадобится немного отредактировать содержимое файла, удалив все до 60 строки.

cd seabios

patch -p1 < ../seabios-mac-20121206.patch

make #у меня появилась необходимость сделать ln -s /usr/bin/python2 /usr/bin/python

su -c 'cp out/bios.bin /usr/share/qemu' #удалите или создайте резервную копию оригинального bios.bin, если это необходимо

(готовый PKGBUILD qemu.install seabios.bin qemu-1.3.1.pkg.tar.xz)


https://docs.google.com/file/d/0B6OXm8m4bGkWSDI0YlhjV0tOUTA/edit
https://docs.google.com/file/d/0B6OXm8m4bGkWMFZva04wR214LTQ/edit
https://docs.google.com/file/d/0B6OXm8m4bGkWYjJmbFdvOF9sNVE/edit
https://docs.google.com/file/d/0B6OXm8m4bGkWejc1ay1VV0VwOXc/edit





Теперь установим libvirt и вспомогательные утилиты для удобства управления нашими виртуальными машинами:

yaourt -S libvirt

systemctl enable libvirtd.service

yaourt -S spice-gtk gtk-vnc-git gnome-common automake-1.12

во время сборки gtk-vnc-git вы можете отредактировать PKGBUILD и удалить все зависимости
 gtk3, если есть такая необходимость

yaourt -S virt-viewer #LANG=en_US.UTF-8 в PKGBUILD

для включения поддержки IOMMU в /etc/default/grub добавить
GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on"

grub-mkconfig -o /boot/grub/grub.cfg

nano /etc/mkinitcpio.conf
MODULES="tun bridge kvm kvm-intel pci-hotplug pci-stub"

mkinitcpio -p linux

nano /etc/modprobe.d/modprobe.conf
blacklist radeon/nouveau/snd-hda-codec-hdmi... #(здесь вам необходимо заблокировать загрузку модулей ядра тех устройств, которые вы планируете пробрасывать в виртуальную машину)

Перезагрузите компьютер

На этом настройка хост-системы закончена.
-----------------------------------------------------------------------------------------------------------
Для создания установочного образа с OSX 10.8.2 нам понадобится оригинальный образ OSX и Chameleon.pkg.

http://www.insanelymac.com/forum/topic/277015-guide-installing-mountain-lion/
http://forum.appleinsider.ru/topic/1634-sozdaem-ustanovochnii-disk-s-os-x-lion/

------------------------------------------------------------------------------------------------------------

 Содержимое папки /Extra/Extensions у меня получилось следующим:

ACHIPortInjector.kext
AppleACPIPS2Nub.kext
ApplePS2Controller.kext
ApplePS2Keyboard.kext
ApplePS2Mouse.kext
ATAPortInjector.kext
FakeSMC.kext
IOACHIBlockStorageInjector.kext
NullCPUPowerManagement.kext
SuperIOFamily.kext
virtio-net.kext

Профиль smbios: MacPro3,1

Параметры загрузки Chameleon:

CSTUsingSystemIO=Yes
EnableC3State=Yes
EthernetBuiltIn=Yes
ForceHPET=Yes
GUI=No
GenerateCStates=Yes
GeneratePStates=Yes
Graphics Mode=1280x800x32
Kernel Flags npci=0x2000 darkwake=0
Legacy Logo=Yes
PciRoot=1
QuietBoot=Yes
RestartFix=No
SystemType=1
USBBusFix=Yes

Дополнительные используемые мной утилиты в /Extra/Utils:
Chameleon Wizard
Chameleon-2.1svn-2069.pkg
Kext Utility
lspci V1.1
Multibeast 5.1.3-1
ShowHiddenFiles

https://docs.google.com/file/d/0B6OXm8m4bGkWd3dpSkVZbzIybms/edit - все необходимое ~ 30Mb
------------------------------------------------------------------------------------------------------------
yaourt -S dmg2img #сконвертируем установочный образ OSX в .img (dmg2img in.dmg out.img)
qemu-img create -f raw "/путь/до/*.img" 20G
------------------------------------------------------------------------------------------------------------
Сейчас мы создадим .xml файл с конфигурацией нашей виртуальной машины с OSX:


<domain type='kvm'>
  <name>osx</name>
  <uuid>91848507-02ce-7d89-1ef4-40039265bbf9</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-1.3'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <vendor>Intel</vendor>
    <topology sockets='1' cores='2' threads='2'/>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/qemu/osx/osx-install.img'/>  #путь до установочного образа!
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/qemu/osx/osx.img'/> #путь до образа виртуального диска ВМ!
      <target dev='hdb' bus='ide'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:bf:39:f3'/>
      <source bridge='virbr0'/> #Можно так же создать bridge через netcfg (br0)
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' autoport='yes'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' vram='65536' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
  </devices>
</domain>

------------------------------------------------------------------------------------------------------------


теперь от суперпользователя выполним:
virsh define '</путь/до/.xml>'

virsh start osx
virt-viewer osx

------------------------------------------------------------------------------------------------------------
Далее выполняем установку OSX, подготовив жесткий диск Дисковой Утилитой установщика

После установки не отмонтируя установочный образ загружаем OSX в виртуальной машине и копируем содержимое папки Extra в корень установленной системы и выполняем установку Chameleon.pkg c опциями по-умолчанию. Далее приводим файлы smbios.plist и org.chameleon.Boot.plist в должный вид с помощью Chameleon Wizard.

ВНИМАНИЕ! В данный момент виртуальная машина с OSX не может получить IP-адрес и не поддерживается аудио-кодек, так же иногда при выключении - машина не останавливается, в этом случае следует использовать команду virsh destroy osx от супер-пользователя.

------------------------------------------------------------------------------------------------------------
После описанных выше действий мы можете отмонтировать установочный образ через EDITOR=nano virsh edit osx и удалить


    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/qemu/osx/osx-install.img'/>  #путь до установочного образа!
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

Система должна загрузиться как положено (используйте флаг -v для вывода подробной информации или -s для загрузки в однопользовательский режим).
------------------------------------------------------------------------------------------------------------

Проброс GPU в виртуальную машину:
В данный момент хорошо пробрасываются только GPU производства AMD или Intel, в моем случае - это AMD Sapphire Radeon 6450 1024Mb (она хорошо поддерживается OSX). Желательно иметь для такого эксперимента монитор с 2 видео-входами - т.к. вы сможете переключаться с реального компьютера на виртуальный нажатием кнопки на мониторе и выбором соответствующего входа.

На хосте: lspci | grep VGA
Смотрим адрес шины нашего GPU (в моем случае - это 01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Caicos [Radeon HD 6450])

EDITOR=nano virsh edit osx

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0' multifunction='on'/>
    </hostdev>

virsh start osx
virt-viewer osx

Опции Chameleon Wizard для включения поддержки нашего GPU:
AtiConfig=Duckweed
Graphics Enabler=No

После установки этих значений загрузчика необходимо запустить Kext Utility для исправления всех прав в /S/L/E и перезагрузить ВМ.

Признаком удачного проброса должен стать стандартный серый фон экрана входа пользователя в OSX и появившееся изображение на втором входе вашего монитора или втором мониторе, подключенном к ВМ)

http://savepic.org/2678452.png - вот такой, 

ну и полупрозрачная верхняя панель.
Так же можно проверить доступность проброшенного GPU через "Об этом Mac" или "Информацию о системе"

Ну вот и всё! Желаю вам удачного эксперимента и жду замечаний и подсказок по улучшению данной статьи! :-)