QEMU

Iz projekta Ubuntu-RS Wiki
Idi na: navigacija, pretraga
(početak)
 
 
Linija 1: Linija 1:
== Running Windows Under Ubuntu 7.04 ==
+
{{Ažurirati}}
  
[http://fabrice.bellard.free.fr/qemu/ QEmu] vam omogućava da pokrenete OS unutar drugog OS-a - na primer, Windows pod Linuxom. ''QEmu koristi kqemu, an acceleration driver iz Ubuntu 7.04 Feisty Fawn da bi pokrenuo Windows na pristojnoj brzini.
+
== Pokretanje virtuelne mašine pod Ubuntuom 7.04 ==
  
Ubuntu 7.04 Feisty Fawn takođe ima i novu verziju rdesktop-a koja može da se koristi za pokretanje individualnih aplikacija iz VM ali na vašem desktopu. See SeamlessVirtualization.
+
[http://fabrice.bellard.free.fr/qemu/ QEmu] vam omogućava da pokrenete OS unutar drugog OS-a - na primer, Windows pod Linuxom. ''QEmu koristi kqemu, acceleration drajver iz Ubuntu 7.04 Feisty Fawn-a da bi pokrenuo Windows na pristojnoj brzini.
 +
 
 +
Ubuntu 7.04 Feisty Fawn takođe ima i novu verziju rdesktop-a koja može da se koristi za pokretanje individualnih aplikacija iz VM ali na vašem desktopu. Link: [https://help.ubuntu.com/community/SeamlessVirtualization SeamlessVirtualization].
  
 
https://help.ubuntu.com/community/WindowsXPUnderQemuHowTo?action=AttachFile&do=get&target=SeamlessVirtualizationWithThemingResized.png
 
https://help.ubuntu.com/community/WindowsXPUnderQemuHowTo?action=AttachFile&do=get&target=SeamlessVirtualizationWithThemingResized.png
  
Napomena: Većina računara kupljenih 2006 i noviji imaju podršku za VP ili Pacifica, tehnologije koje omogućavanju hardversku podršku virtuelizaciji. Da biste proverili da li vaš sistem ima ove tehnologije pokrenite sledeću naredbu u konzoli:
+
Napomena: Većina računara kupljenih 2006 i noviji imaju podršku za [http://en.wikipedia.org/wiki/AMD-V#Intel_VT_.28IVT.29 Intel-VT] ili [http://en.wikipedia.org/wiki/AMD-V#AMD_virtualization_.28AMD-V.29 AMD Pacifica (AMD-V)], tehnologije koje omogućavanju hardversku podršku virtuelizaciji. Da biste proverili da li vaš sistem ima ove tehnologije pokrenite sledeću naredbu u konzoli:
  
 
  grep -E '^flags.*(vmx|svm)' /proc/cpuinfo
 
  grep -E '^flags.*(vmx|svm)' /proc/cpuinfo
Linija 13: Linija 15:
 
Ako dobijete neki rezultat preporučujemo vam korišćenje [[KVM|Kernel Virtuelizacije]].
 
Ako dobijete neki rezultat preporučujemo vam korišćenje [[KVM|Kernel Virtuelizacije]].
  
Napomena: Even if you get no output from the above command, your computer may actually support virtualization in hardware. Some machines are delivered with a BIOS option switching off hardware virtualization. Other machines require updating to the latest BIOS for it to work correctly.
+
Napomena: Čak i ako ne dobijete rezultat ove komande vaš računar možda ima hardversku podršku virtuelizaciji. Neki računari se isporučuju sa isključenom opcijom hardverske virtuelizacije u BIOS-u dok druge mašine je koriste samo ako je BIOS ažuriran na najnoviju verziju.
  
== Installing Windows in QEmu with Feisty 7.04 ==
+
== Instalacija OS-a u QEmu sa Ubuntu Feisty 7.04 ==
While the following guide uses Windows XP, older versions of Windows work fine, and may be preferred due to their increased speed.
+
Iako ovaj vodič opisuje instalaciju Windows XP-a, bilo kog Linuxa ili BSD-a. Ranije verzije Windows-a rade fino, i možda su i preporučljivije s obzirom na brzinu kojom se izvršavaju.
 
    
 
    
1. First you need to  install qemu kqemu-source and module assistant from the Universe Repository.
+
1. Prvo treba da instalirate qemu kqemu-source, kqemu-common i module assistant iz Universe riznice.
2. Next you need to build the kqemu module from Ubuntu's package
+
 
 +
sudo apt-get install qemu kqemu-source module-assistant kqemu-common
 +
 
 +
2. Sledi pravljenje kqemu modula
  
 
  sudo module-assistant prepare
 
  sudo module-assistant prepare
Linija 25: Linija 30:
  
 
    
 
    
3. Next you need to configure udev to create the /dev/kqemu device node upon loading the kqemu module
+
3. Zatim treba podesiti udev da pravi /dev/kqemu device node nakon učitavanja kqemu modula
  
* Create /etc/udev/rules.d/60-kqemu.rules  
+
* Napravite /etc/udev/rules.d/60-kqemu.rules  
  
 
  gksu gedit /etc/udev/rules.d/60-kqemu.rules   
 
  gksu gedit /etc/udev/rules.d/60-kqemu.rules   
  
with the following content: (the order between GROUP and MODE seems to matter, be sure to add a newline at the end of the file)  
+
sa sledećim sadržajem: (redosled GROUP i MODE je izgleda bitan i obavezno napravite novi red na kraju fajla)  
  
 
  KERNEL=="kqemu", NAME="%k", GROUP="kqemu", MODE="0660"   
 
  KERNEL=="kqemu", NAME="%k", GROUP="kqemu", MODE="0660"   
  
4. Change the content of /etc/modprobe.d/kqemu to
+
4. Promenite sadržaj /etc/modprobe.d/kqemu u
  
 
  options kqemu major=0
 
  options kqemu major=0
  
5. Create a group "kqemu" and add all users who should be allowed to use QEMU with acceleration to this group
+
5. Napravite korisničku grupu "kqemu" i dodelite joj korisnike kojima će biti dozvoljeno korišćenje QEMU-a sa akceleratorom
  
 
  sudo addgroup --system kqemu
 
  sudo addgroup --system kqemu
 
  sudo adduser $USER kqemu  
 
  sudo adduser $USER kqemu  
  
* Make sure to update your environment before proceeding to reflect the fact, that your user is now part of the kqemu group (for example by logging in and out).
+
* Da bi vaš korisnički nalog bio deo grupe kqemu treba ažurirati okruženje, npr. odjavljivanje i ponovnim prijavljivanjem na sistem.
  
6. Load the kqemu module
+
6. Učitaćemo kqemu modul
  
 
  sudo modprobe kqemu
 
  sudo modprobe kqemu
  
7. Check that the permissions are right
+
7. Proverite da li su dozvole kako treba
  
 
  $ ls -l /dev/kqemu
 
  $ ls -l /dev/kqemu
 
  crw-rw---- 1 root kqemu 10, 62 2007-07-22 15:36 /dev/kqemu
 
  crw-rw---- 1 root kqemu 10, 62 2007-07-22 15:36 /dev/kqemu
  
* If the permissions are wrong, it is probably because your udev rule wasn't read properly. Try re-loading the module
+
* Ako ima problema sa dozvolama, najverovatnije udev nije pravilno učitan. Probajte da ga ponovo učitate kqemu modul
  
 
  sudo modprobe -r kqemu
 
  sudo modprobe -r kqemu
 
  sudo modprobe kqemu
 
  sudo modprobe kqemu
  
and see if that clears the problem. If not, add {{{OWNER="youruser"}}} to the end of the udev rule and try again
+
Ako i dalje imate isti problem dodajte '''OWNER="vašekorisničkoime"''' na kraju udev rule-a i probajte ponovo
  
8. If you want to load the kqemu module upon system start in the future, add "kqemu" to your /etc/modules file
+
8. Ako vam je potrebno da kqemu bude učitan pri svakom podizanju sistema, dodajte novi red sa '''kqemu''' u /etc/modules datoteku
  
 
  gksu gedit /etc/modules  
 
  gksu gedit /etc/modules  
  
9. Create a virtual drive for Windows
+
9. Napravićemo virtuelni hard disk od 2 Gb za OS virtuelne mašine
  
  qemu-img create -f qcow windows.img 2G
+
  qemu-img create -f qcow test.img 2G
  
 +
* Ovako se pravi virtuelni disk od 2GB koji će biti smešten u datoteku ubuntu-server.img u folderu u kom ste izvršili naredbu. Virtuelni disk će u početku biti mala datoteka pa će polako narasti kako budete dodavali podatke. Za pravljenje instalaciju BSD sistema nemojte koristiti "-f qcow" jer ćete imati problema sa alociranjem diska. Za Windows XP SP2 stavite min 3-4GB
  
* This creates a two gigabyte virtual drive, stored as a single file called windows.img in the location where you ran the command. Any size above 1.5GB (the minimum to run Windows XP) is fine. The virtual drive will start out as a small file, and only fill its the size you specified when it reaches capacity due to the qcow file format used.  
+
* '''Napomena''': Ako koristite qcow format, takvu datoteku nećete moći da prikačite direktno na Ubuntu. S druge strane, ako izostavite "-f qcow" i napravite datoteku koja može da se zakači na Ubuntuov sistem datoteka tada će veličina virtuelnog diska biti velika (onoliko koliko ste odredili) i fiksna. Instrukcije za konverziju raw virtuelnog diska u qcow možete naći na dnu ovog teksta.
  
* '''Note''': If you want to install Windows XP Service Pack 2 + Updates, 2 GB is not enough for the image size. Use at least 3-4 GB.
+
10. Instalirajte OS na virtuelnu mašinu. Stavite CD u uređaj i pokrenite:
  
* '''Note''': Consider using as much disk space as you can afford. Resizing NTFS partitions is a pain in the ass, but hard disk space is cheap.
+
qemu -localtime -cdrom /dev/cdrom -m 384 -boot d test.img
  
* '''Note''': If you use qcow images, you will not be able to mount the image within Ubuntu. You can omit '-f  qcow' and create a mountable image, but this will mean that the size of the virtual drive will be fixed and larger. Instructions to convert a raw drive to a qcow drive appear at the end of this page.
+
11. Ovako ćete pokrenuti QEmu sa časovnikom iz Ubuntu-a, test.img će predstavljati hard disk, /dev/cdrom predstavlja instalacioni CD, 384 MB sistemske memorije i podizanje sistema će biti sa CD-a.
  
10. Install Windows XP. Put the CD in the drive and run:
+
12. Alternativno, možete koristiti .iso slike
  
  qemu -localtime -cdrom /dev/cdrom -m 384 -boot d windows.img
+
  qemu -localtime -cdrom InstalacioniCD.iso -m 384 -boot d test.img
 
+
11. Ovako ćete pokrenuti QEmu sa časovnikom iz Ubuntu-a, windows.img će predstavljati hard disk, /dev/cdrom predstavlja instalacioni CD, 384 MB sistemske memorije (minimum za funkcionisanje XP-a) and will boot from the CD.
+
 
+
12. Alternativno, mo\ete koristiti .iso slike
+
 
+
qemu -localtime -cdrom cdimagefile.iso -m 384 -boot d windows.img
+
  
 
13. If you're having trouble creating the Windows partition during Windows installation, check that you have read and write access to the disk image. Use this command to set the file permissions for the windows.img file so that all users in the kqemu group can access the virtual disk  
 
13. If you're having trouble creating the Windows partition during Windows installation, check that you have read and write access to the disk image. Use this command to set the file permissions for the windows.img file so that all users in the kqemu group can access the virtual disk  
  
  chmod 660 windows.img
+
  chmod 660 test.img
  sudo chown $USER:kqemu windows.img
+
  sudo chown $USER:kqemu test.img
  
  
* '''Note to 64 bit users''': Use 'qemu-system-x86_64' instead of 'qemu'. Otherwise the "-kernel-kqemu" option will not work.
+
* '''Napomena za 64 bitne korisnike''': Koristite 'qemu-system-x86_64' umesto 'qemu'. Otherwise the "-kernel-kqemu" option will not work.
  
 
* '''Note for Windows 2000''':  Add the option '-win2k-hack'. Otherwise the install may fail with "Not enough disk space" even when that isn't the case.
 
* '''Note for Windows 2000''':  Add the option '-win2k-hack'. Otherwise the install may fail with "Not enough disk space" even when that isn't the case.
Linija 107: Linija 107:
 
16. Clicking on the QEmu window will take control of the Windows cursor. To go back to Linux, press Ctrl + Alt and to toggle fullscreen press Ctrl + Alt + F
 
16. Clicking on the QEmu window will take control of the Windows cursor. To go back to Linux, press Ctrl + Alt and to toggle fullscreen press Ctrl + Alt + F
  
 
+
== Mreža ==
== Networking ==
+
  
 
QEmu provides two modes of networking. In both modes, a virtual network adapter is created inside Windows XP guest.  
 
QEmu provides two modes of networking. In both modes, a virtual network adapter is created inside Windows XP guest.  
  
=== User mode networking ===
+
=== User mode mreža ===
  
 
In user mode networking, QEmu manages network interface internally in the user mode emulator application. QEmu provides DHCP host which assigns a dynamic IP for the guest OS. TCP and UDP ports can be redirected from the host OS to the guest OS using QEmu command line parameters.
 
In user mode networking, QEmu manages network interface internally in the user mode emulator application. QEmu provides DHCP host which assigns a dynamic IP for the guest OS. TCP and UDP ports can be redirected from the host OS to the guest OS using QEmu command line parameters.
Linija 137: Linija 136:
 
* Incoming connections must be configured beforehand
 
* Incoming connections must be configured beforehand
  
=== TAP network ===
+
=== TAP mreža ===
  
 
In TAP networking, QEmu connects the guest OS ethernet to the host OS using TAP network bridge. Linux creates a virtual network interface (tap0) which appears in ifconfig listing as other network interfaces. Further, it is possible to bridge network traffic to the guest OS using normal Linux network bridging functionalities.
 
In TAP networking, QEmu connects the guest OS ethernet to the host OS using TAP network bridge. Linux creates a virtual network interface (tap0) which appears in ifconfig listing as other network interfaces. Further, it is possible to bridge network traffic to the guest OS using normal Linux network bridging functionalities.
Linija 157: Linija 156:
 
* Difficult to set up. The set-up is especially cumbersome if you try to run QEmu without root priviledges
 
* Difficult to set up. The set-up is especially cumbersome if you try to run QEmu without root priviledges
  
== Additional Options ==
+
== Dodatne opcije ==
  
=== Sharing Files With XP and Networking ===
+
=== Deljenje datoteka sa Windows XP-om ===
  
 
It's not much use having an XP installation if you can't transfer files between Ubuntu and XP. Fortunately, QEMU sets up a virtual LAN and DHCP server for you. You can transfer files to and from XP just as if it was on a real LAN. You can also browse the net and download files and do all the network stuff you would do on a real networked XP box.
 
It's not much use having an XP installation if you can't transfer files between Ubuntu and XP. Fortunately, QEMU sets up a virtual LAN and DHCP server for you. You can transfer files to and from XP just as if it was on a real LAN. You can also browse the net and download files and do all the network stuff you would do on a real networked XP box.
  
==== Sharing Files between the Host and VM ====
+
==== Deljenje datoteka između Domaćina i VM-e ====
  
 
QEmu supports file sharing between the VM and host if you have [:SettingUpSamba:Samba configured on the host system]. The following assumes you have a share called 'qemu_share' in your home directory intended to transfer files between Ubuntu and Windows.
 
QEmu supports file sharing between the VM and host if you have [:SettingUpSamba:Samba configured on the host system]. The following assumes you have a share called 'qemu_share' in your home directory intended to transfer files between Ubuntu and Windows.
Linija 179: Linija 178:
 
The IP address of Ubuntu will always be 10.0.2.2. If you have running servers on your Ubuntu box, they can also be accessed at this IP address (e.g. ftp:\\10.0.2.2)
 
The IP address of Ubuntu will always be 10.0.2.2. If you have running servers on your Ubuntu box, they can also be accessed at this IP address (e.g. ftp:\\10.0.2.2)
  
=== Mounting A Virtual Drive ===
+
=== Priključenje virtuelnog diska ===
  
 
You can also mount the QEmu virtual disk just like any other drive. QCOW images cannot be mounted. If the drive was created in qcow format you'll need to convert it first, see [#convertimg2raw below].
 
You can also mount the QEmu virtual disk just like any other drive. QCOW images cannot be mounted. If the drive was created in qcow format you'll need to convert it first, see [#convertimg2raw below].
Linija 187: Linija 186:
 
To mount the drive, create a directory '/media/qemu'. Then run
 
To mount the drive, create a directory '/media/qemu'. Then run
  
  sudo mount -o loop,offset=32256 windows.img /media/qemu
+
  sudo mount -o loop,offset=32256 test.img /media/qemu
  
  
=== Saving and Restoring the State of the VM ===
+
=== Snimanje i kasnije pozivanje stanja VM-e ===
  
 
You can quickly save and restore the state of your Windows System using QEmu's 'overlay images'. Once you have done your initial install, you can create an overlay image and run QEMU off this. The overlay image is very much smaller that the original image and will only contain changes made since the original install. If you trash your XP installation, you can simply delete the overlay image and create a new one from the original image.  
 
You can quickly save and restore the state of your Windows System using QEmu's 'overlay images'. Once you have done your initial install, you can create an overlay image and run QEMU off this. The overlay image is very much smaller that the original image and will only contain changes made since the original install. If you trash your XP installation, you can simply delete the overlay image and create a new one from the original image.  
  
To create an overlay image, use the qemu-image program. To create an image windows.ovl from windows.img, issue the following  
+
To create an overlay image, use the qemu-image program. To create an image test.ovl from test.img, issue the following  
  
  qemu-img create -b windows.img -f qcow windows.ovl
+
  qemu-img create -b test.img -f qcow test.ovl
  
  
 
To run Windows, you would now use
 
To run Windows, you would now use
  
  qemu windows.ovl -enable-audio -user-net -localtime -smb qemu_share
+
  qemu test.ovl -enable-audio -user-net -localtime -smb qemu_share
  
  
If the winxp.ovl installation is ruined, you can delete it, and start QEmu using the winxp.img file. But you will lose changes made since the original install.
+
If the test.ovl installation is ruined, you can delete it, and start QEmu using the test.img file. But you will lose changes made since the original install.
  
 
QEmu also accepts commands from the shell while it is running. To do this, though, you need to press CTRL+ALT+2 with the QEmu window active. This brings up the QEmu Monitor. From here, you can swap CDs, send keypresses to the emulator, suspend to disk and so on. See the [http://fabrice.bellard.free.fr/qemu/qemu-doc.html official documentation] for full details.
 
QEmu also accepts commands from the shell while it is running. To do this, though, you need to press CTRL+ALT+2 with the QEmu window active. This brings up the QEmu Monitor. From here, you can swap CDs, send keypresses to the emulator, suspend to disk and so on. See the [http://fabrice.bellard.free.fr/qemu/qemu-doc.html official documentation] for full details.
Linija 212: Linija 211:
 
=== Converting a qcow image to a raw file ===
 
=== Converting a qcow image to a raw file ===
  
To convert a qcow image, 'windows.img', to a raw 'windows.raw' file , run
+
To convert a qcow image, 'test.img', to a raw 'test.raw' file , run
  
  qemu-img convert windows.img -O raw windows.raw
+
  qemu-img convert test.img -O raw test.raw
  
  
=== Converting a raw drive to qcow format ===
+
=== Konverzija raw virtuelnog disk u qcow format ===
  
To convert a raw 'windows.img' file to a qcow formatted 'windows.qcow', run
+
To convert a raw 'test.img' file to a qcow formatted 'test.qcow', run
  
  qemu-img convert windows.img -O qcow windows.qcow
+
  qemu-img convert test.img -O qcow test.qcow
  
  
== Troubleshooting ==
+
== Problemi ==
  
 
If you experience problems with mouse pointer hanging in bottom right corner, try before you start up qemu  
 
If you experience problems with mouse pointer hanging in bottom right corner, try before you start up qemu  
Linija 230: Linija 229:
 
  export SDL_VIDEO_X11_DGAMOUSE=0
 
  export SDL_VIDEO_X11_DGAMOUSE=0
  
 
+
== Spoljni linkovi ==
== External Links ==
+
 
* [http://qemu.org/ QEmu Homepage]
 
* [http://qemu.org/ QEmu Homepage]
* [http://homepage.sunrise.ch/mysunrise/ekeller00/EricKellerUbuntuPage.html Ubuntu emulated in Windows with QEmu]
+
* [http://homepage.sunrise.ch/mysunrise/ekeller00/EricKellerUbuntuPage.html Ubuntu emulacija u Vindovsu pomocu QEmu]
 +
----
  
 +
{{Korisnička dokumentacija}}
 +
[[Category:7.04]]
 
[[Category:Virtuelizacija]]
 
[[Category:Virtuelizacija]]

Tekuća izmena od 1. decembar 2011. u 10:06

Lični alati
Imenski prostori
Varijante
Akcije
Navigacija
alati
Linkovi