Virtual machine on linux: qemu

Create a harddrive file

qemu-img create -f qcow2 ./qemu-vm-hdd.qcow2 32G

Run the virtual machine using the harddrive file

qemu-system-x86_64 -cdrom "./os-installation-disk.iso" -vga vmware -cpu host -enable-kvm -m 4G -smp 4 -drive file=./qemu-vm-hdd.qcow2,format=qcow2

The first time you start the virtual machine using the given command, the virtual machine will boot using the provided installation disk (./os-installation-disk.iso). The harddrive file will be created by the virtual machine, if not exists already. During this time you will install a bootable OS on the virtual machine's harddrive file (./qemu-vm-hdd.qcow2). Unless there are other filesystems mounted into the virtual machine, there will only be one harddrive available within the virtual machine, which refers to the given harddrive file.

The second time you start the virtual machine, you may run the command without the -cdrom "./os-installation-disk.iso" option, since it should now boot from the newly installed OS.

By default, the virtual machine will already use the internet/network access of the host.