Difference between revisions of "Small Virtual Machines"

From Lazarus wiki
Jump to navigationJump to search
Line 7: Line 7:
 
Download from [http://reactos.org/ ReactOS] ReactOS-0.3.17-REL-iso.zip (88MB) and unzip to get ReactOS-BootCD.iso (103MB)
 
Download from [http://reactos.org/ ReactOS] ReactOS-0.3.17-REL-iso.zip (88MB) and unzip to get ReactOS-BootCD.iso (103MB)
  
qemu-img create -f qcow2 reactos0317.img 2G
+
qemu-img create -f qcow2 reactos0317.img 2G<br/>
 
 
 
qemu-system-i386 -m 512 -hda reactos0317.img -cdrom ReactOS-BootCD.iso -boot d
 
qemu-system-i386 -m 512 -hda reactos0317.img -cdrom ReactOS-BootCD.iso -boot d
  
Line 15: Line 14:
 
Shut down ReactOS.  The QEMU image file is 280MB.
 
Shut down ReactOS.  The QEMU image file is 280MB.
  
Restart with networking:
+
Restart with networking:<br/>
 
 
 
qemu-system-i386 -m 512 -hda reactos0317.img -boot c -net nic -net user
 
qemu-system-i386 -m 512 -hda reactos0317.img -boot c -net nic -net user
  
Line 28: Line 26:
 
Dowload from [https://www.debian.org/ Debian] debian-8.0.0-i386-netinst.iso (330 MB) and rename to debjes.iso
 
Dowload from [https://www.debian.org/ Debian] debian-8.0.0-i386-netinst.iso (330 MB) and rename to debjes.iso
  
qemu-img create -f qcow2 debjes.img 2G
+
qemu-img create -f qcow2 debjes.img 2G<br/>
 
 
 
qemu-system-i386 -m 512 -hda debjes.img -cdrom debjes.iso -boot d
 
qemu-system-i386 -m 512 -hda debjes.img -cdrom debjes.iso -boot d
  
Line 38: Line 35:
 
add sudo (There are instruction near the bottom of this page: [http://controlpascal.com/picoscope.htm Control Pascal PicoScope])
 
add sudo (There are instruction near the bottom of this page: [http://controlpascal.com/picoscope.htm Control Pascal PicoScope])
  
sudo apt-get clean
+
sudo apt-get clean<br/>
 
+
sudo dd if=/dev/zero of=/mytempfile ('''note''' that this is very slow as it fills the entire 2G)<br/>
sudo dd if=/dev/zero of=/mytempfile ('''note''' that this is very slow as it fills the entire 2G)
+
sudo rm -f /mytempfile<br/>
 
 
sudo rm -f /mytempfile
 
 
 
 
sudo halt
 
sudo halt
  
After this the new img file is 635 MB:
+
After this the new img file is 635 MB:<br/>
 
 
 
qemu-img convert -O qcow2 debjes.img debjesnew.img
 
qemu-img convert -O qcow2 debjes.img debjesnew.img
  

Revision as of 00:12, 19 July 2015

Overview

Shows how to create small ReactOS and Debian virtual machines using Qemu.

ReactOS virtual machine

Built (on Ubuntu 12.04) a minimal i386 VM with QEMU with ReactOS 0.3.17.

Download from ReactOS ReactOS-0.3.17-REL-iso.zip (88MB) and unzip to get ReactOS-BootCD.iso (103MB)

qemu-img create -f qcow2 reactos0317.img 2G
qemu-system-i386 -m 512 -hda reactos0317.img -cdrom ReactOS-BootCD.iso -boot d

For the install just press <Enter> for everything. When it reboots (twice) don't hit any key so it won't boot from the CD.

Shut down ReactOS. The QEMU image file is 280MB.

Restart with networking:
qemu-system-i386 -m 512 -hda reactos0317.img -boot c -net nic -net user

To see that networking is working, in the VM double-click on the Command Prompt and run ipconfig.

No, you don't want to use ReactOS for your desktop operating system, but it might be good enough to use for some specific things (like putting in a small VM).

Debian virtual machine

Built (on Ubuntu 14.04) a minimal i386 VM with QEMU with Debian (new version 8 release) Jessie.

Dowload from Debian debian-8.0.0-i386-netinst.iso (330 MB) and rename to debjes.iso

qemu-img create -f qcow2 debjes.img 2G
qemu-system-i386 -m 512 -hda debjes.img -cdrom debjes.iso -boot d

Networking worked without having to add other command line parameters! Remove the 2 default software collections (near the end of the install). The QEMU image file is 1.3 GB.

In the VM:

add sudo (There are instruction near the bottom of this page: Control Pascal PicoScope)

sudo apt-get clean
sudo dd if=/dev/zero of=/mytempfile (note that this is very slow as it fills the entire 2G)
sudo rm -f /mytempfile
sudo halt

After this the new img file is 635 MB:
qemu-img convert -O qcow2 debjes.img debjesnew.img

Archive with 7z and the file is now 143 MB. Not very big for a nice new Debian console VM.

Notes

On Ubuntu kvm can be substituted for quem-system-i386 and things work much faster.

On qemu-img create the 2G could be larger but then on linux it will be much slower to minimize the size. Any suggestions?

Original forum message where this got started: [[1]]

See also