⇤ ← Revision 1 as of 2020-04-07 08:28:25
Size: 889
Comment:
|
Size: 1912
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 15: | Line 15: |
{{{apt-get install qemu-kvm qemu-system-x86}}} | {{{ apt-get install qemu-kvm qemu-system-x86}}} = Setup Qemu = |
Line 24: | Line 27: |
{{{qemu-img create -f qcow2 debian-vm.img 50G}}} | {{{ qemu-img create -f qcow2 debian-vm.img 50G}}} |
Line 26: | Line 30: |
Here is a qemu invocation shell script for the VM Get a suitable iso image file for distro installation |
== Simple way to start Qemu == Get a suitable iso image file for distro installation. {{{ qemu-system-x86_64 -enable-kvm -smp 2 -boot menu=on -m 2048m -cdrom debian-install-iso.img -hda debian-vm.img -vga std}}} == Advanced Qemu == {{{ #!/bin/sh MEM="2048m" BOOT="menu=on" [ ! -z "$1" ] && MEM="$1" [ ! -z "$2" ] && BOOT="$2" MACH="-machine q35" CPU="-cpu host" CDROM_IMG="/path/to/debian-install-iso.img" HDA_IMG="/path/to/debian-vm.img" CDROM="-cdrom ${CDROM_IMG}" HDA="-hda ${HDA_IMG}" VGA="-vga std" SSH_ENABLE="hostfwd=tcp:127.0.0.1:10101-:22" NET="-netdev user,id=n1,${SSH_ENABLE} -net nic,netdev=n1,model=virtio-net-pci" PATH_9P="~/9p/shared" P9="-fsdev local,id=p9d1,path=${PATH_9P},security_model=none" P9="${P9} -device virtio-9p-pci,fsdev=p9d1,mount_tag=p9_mnt" USB="-usb" USB_MICE="-usbdevice tablet" SOUNDHW="-device intel-hda,msi=auto -device hda-duplex" qemu-system-x86_64 -enable-kvm ${MACH} ${CPU} -smp 2 -boot "${BOOT}" \ -m "${MEM}" ${CDROM} ${HDA} ${NET} ${P9} ${USB} ${USB_MICE} ${SOUNDHW} \ ${VGA} -rtc base=utc}}} }}} |
Running Linux in a VM
Hardware Requirements
You need a system with virtualization (VT-d), at least 4GB of RAM, and 40GB of free hard drive space in order to run Linux in a VM. If you want to download and compile the kernel, you may need additional space of up to 20GB.
Download Debian
Download link to Get a recent version of Debian.
Install Qemu Virtualizer
Instructions for Debian OS
apt-get install qemu-kvm qemu-system-x86
Setup Qemu
You need a space for VM either a file image or disk block.
Example with using a file for VM.
Create a 50GB qcow2 format image file for VM Note qcow2 grows in space as needed. In the start it is not 50GB in size.
qemu-img create -f qcow2 debian-vm.img 50G
Simple way to start Qemu
Get a suitable iso image file for distro installation.
qemu-system-x86_64 -enable-kvm -smp 2 -boot menu=on -m 2048m -cdrom debian-install-iso.img -hda debian-vm.img -vga std
Advanced Qemu
MEM="2048m" BOOT="menu=on" [ ! -z "$1" ] && MEM="$1" [ ! -z "$2" ] && BOOT="$2" MACH="-machine q35" CPU="-cpu host" CDROM_IMG="/path/to/debian-install-iso.img" HDA_IMG="/path/to/debian-vm.img" CDROM="-cdrom ${CDROM_IMG}" HDA="-hda ${HDA_IMG}" VGA="-vga std" SSH_ENABLE="hostfwd=tcp:127.0.0.1:10101-:22" NET="-netdev user,id=n1,${SSH_ENABLE} -net nic,netdev=n1,model=virtio-net-pci" PATH_9P="~/9p/shared" P9="-fsdev local,id=p9d1,path=${PATH_9P},security_model=none" P9="${P9} -device virtio-9p-pci,fsdev=p9d1,mount_tag=p9_mnt" USB="-usb" USB_MICE="-usbdevice tablet" SOUNDHW="-device intel-hda,msi=auto -device hda-duplex" qemu-system-x86_64 -enable-kvm ${MACH} ${CPU} -smp 2 -boot "${BOOT}" \ -m "${MEM}" ${CDROM} ${HDA} ${NET} ${P9} ${USB} ${USB_MICE} ${SOUNDHW} \ ${VGA} -rtc base=utc
}}}