Install windows in ubuntu virtualized KVM

Very practical command

qemu installation steps detailed (suitable for ubuntu and windows)

quote

4. Create a Windows virtual hard disk
Code :
qemu-img create -f qcow windows.img 2G


(the 2G size here can be set by yourself, using the qcow file format, so it increases or decreases according to the user's use, but the maximum upper limit is 2G)

5. Install Windows
code from CD-ROM:
qemu -localtime -cdrom /dev/cdrom -m 384 -boot d windows.img


(also can be installed from hard disk image
code :
qemu -localtime -cdrom cdimagefile.iso -m 384 -boot d Windows.img


here -m 384 is the specified memory, 384 MB is a good minimum memory for XP
If memory is not enough, you can do this
Code:
sudo umount /dev/shm
sudo mount -t tmpfs -o size=400m none /dev/shm

)

* For 64-bit users, please use 'qemu-system-x86_64' instead of 'qemu', otherwise "-kernel-kqemu" cannot be enabled.
* Please add the parameter '-win2k-hack' to install Windows 2000.

6. Use
Ctrl + Alt Control Toggle
Ctrl + Alt + F Full Screen Toggle

7. Save the configuration Before starting qemu
each time , you must manually load the kqemu module. You can write those commands into /etc/rc.local,
so that the system will run these commands at startup.

8. Network
Please refer to http://fabrice.bellard .free.fr/qemu/qemu-doc.html

9. File sharing between host and guest systems
QEMU configures a virtual LAN and DHCP server for you.
First configure Samba on the host Ubuntu, then start qemu like this
(here Assuming you have a qemu_share folder)
code:
qemu -smb $HOME/qemu_share -m 384 -localtime windows.img


under guest Windows, to access the shared file
net use e: //10.0.2.2/qemu_share
and host Ubuntu The IP address is always 10.0.2.2, so if you run the server on the host Ubuntu, you can also access it, such as
ftp://10.0.2.2, etc.

10. Mount the virtual hard disk, first make sure to close the qemu
code:
sudo mount -o loop,offset=32256 windows.img /mnt



11. Save and restore the
state of the virtual machine After you have installed a virtual machine, you can create an "overlay image" on it, the
code:
qemu-img create -b windows.img -f qcow windows.ovl


Now you can run the overlay image
Code :
qemu windows.ovl -enable-audio -user-net -localtime -smb qemu_share


overlay image is very small, only save the original image Changes made, if you want to return to the original state after installation,
simply delete the overlay image and create a new one.

12. Run QEMU commands
While QEMU is running, it can also accept commands
in the QEMU window by pressing CTRL+ALT+2, the QEMU monitor will appear, enter help and you can see that you can do a lot of things. To
exit , press CTRL+ALT+1

13. Convert the virtual hard disk in raw format to qcow format
Code :
qemu-img convert windows .img -O qcow windows.qcow



14. Troubleshooting
If you encounter the mouse always hanging in the lower right corner, please run the
code before starting QEMU:
export SDL_VIDEO_X11_DGAMOUSE=0

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326551313&siteId=291194637