Size: 3896
Comment:
|
Size: 3812
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 48: | Line 48: |
Create a new VM and setup Guest OS. | = Setup Virt Manager = |
Line 50: | Line 50: |
= Setup Qemu = | |
Line 52: | Line 51: |
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 -vga std -cdrom debian-install-iso.img -hda debian-vm.img}}} == Qemu Screenshots == |
|
Line 79: | Line 60: |
== Advanced Qemu == | == Start Virt Manager from Application Menu == 00-Main-Start-Screen.png |
Line 81: | Line 63: |
Create a script file qemu.sh with executable permissions: | 1) Click on "Create a new new virtual machine" button for new VM creation |
Line 83: | Line 65: |
{{{ touch qemu.sh; chmod +x qemu.sh}}} |
01-Create-New-VM.png |
Line 87: | Line 67: |
Edit the qemu.sh and add lines like this: | Choose install media (ISO image or CDROM) for installation from your downloaded favourite Linux Distro ISO image. |
Line 89: | Line 70: |
{{{ #!/bin/sh |
2) Browse to and choose the Linux Distro ISO image |
Line 92: | Line 72: |
MEM="2048m" BOOT="menu=on" |
02-Choose-ISO-image.png |
Line 95: | Line 74: |
[ ! -z "$1" ] && MEM="$1" [ ! -z "$2" ] && BOOT="$2" |
3) Set Your required Memory and CPU settings for the VM (Guest OS) |
Line 98: | Line 76: |
MACH="-machine q35" CPU="-cpu host" |
03-Set-Memory-CPU.png |
Line 101: | Line 78: |
CDROM_IMG="/path/to/debian-install-iso.img" HDA_IMG="/path/to/debian-vm.img" |
4) Enable and Create a storage space for the VM (Guest OS) |
Line 104: | Line 80: |
CDROM="-cdrom ${CDROM_IMG}" HDA="-hda ${HDA_IMG}" |
04-Create-Storage-Space.png |
Line 107: | Line 82: |
VGA="-vga std" | 5) Ready to begin the installation |
Line 109: | Line 84: |
SSH_ENABLE="hostfwd=tcp:127.0.0.1:10101-:22" | 05-Ready-VM-Install.png |
Line 111: | Line 86: |
NET="-netdev user,id=n1,${SSH_ENABLE} -net nic,netdev=n1,model=virtio-net-pci" | Shows the settings you chose. Put a Name for the VM as you like (App suggests one by default) |
Line 113: | Line 89: |
PATH_9P="~/9p/shared" | Press Finish Button. It creates the VM and boots into it and starts the Linux Distro OS installation. |
Line 115: | Line 92: |
P9="-fsdev local,id=p9d1,path=${PATH_9P},security_model=none" P9="${P9} -device virtio-9p-pci,fsdev=p9d1,mount_tag=p9_mnt" |
6) Example Linux Distro OS Install Start Screen |
Line 118: | Line 94: |
USB="-usb" USB_MICE="-usbdevice tablet" |
06-Example-Guest-OS-Install_Start.png |
Line 121: | Line 96: |
SOUNDHW="-device intel-hda,msi=auto -device hda-duplex" | 7) Example Installed Guest OS Boot Screen |
Line 123: | Line 98: |
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}}} |
07-Example-Guest-Grub-Boot-Menu.png |
Line 127: | Line 100: |
Put qemu.sh in PATH directory if needed. E.g. ~/bin. | 8) You can know the assigned IP Address for the Guest OS |
Line 129: | Line 102: |
Above script sets up network, usb, sound, video, 9p, and ssh access to Qemu VM Guest OS. | 08-Find-IP-Address-Guest.png |
Line 131: | Line 104: |
=== SSH Access === | Find your Guest's ip address in "Show virtual hardware details" menu in NIC option. If IP address is not shown click refresh button and see. Mind that the guest OS is running and network is running in guest. IP address may be needed for ssh access to your Guest OS from host. 11) Trouble Shoot CDROM issues 11-TroubleShoot-CDROM.png You can check if CDROM ISO image is present and if not browse and select it. 12) Trouble Shoot Boot issues 12-TroubleShoot-Boot.png You can set devices to be bootable and the order of boot. = SSH Access = |
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 Libvirt/Virtual-Manager Virtualizer
Instructions for Debian OS:
Debian setup link Debian Setup and Help Page.
Install the needed packages:
sudo apt-get install qemu-kvm libvirt-clients libvirt-daemon-system virt-manager ebtables
Add your user to libvirt group:
sudo adduser user libvirt
Configure libvirt:
virsh --connect=qemu:///system net-start default virsh --connect=qemu:///system net-autostart default
Start virt-manager from Application Menu.
Instructions for Archlinux:
Install needed packages:
sudo pacman -S virt-manager libvirt ebtables dnsmasq qemu
Add your user to kvm group:
sudo adduser user kvm
Archlinux setup page See this link for further setup further instructions.
Setup Virt Manager
01) Example OS Install Screen
02) Example Guest OS Grub2 Boot Screen
Start Virt Manager from Application Menu
00-Main-Start-Screen.png
1) Click on "Create a new new virtual machine" button for new VM creation
01-Create-New-VM.png
Choose install media (ISO image or CDROM) for installation from your downloaded favourite Linux Distro ISO image.
2) Browse to and choose the Linux Distro ISO image
02-Choose-ISO-image.png
3) Set Your required Memory and CPU settings for the VM (Guest OS)
03-Set-Memory-CPU.png
4) Enable and Create a storage space for the VM (Guest OS)
04-Create-Storage-Space.png
5) Ready to begin the installation
05-Ready-VM-Install.png
Shows the settings you chose. Put a Name for the VM as you like (App suggests one by default)
Press Finish Button. It creates the VM and boots into it and starts the Linux Distro OS installation.
6) Example Linux Distro OS Install Start Screen
06-Example-Guest-OS-Install_Start.png
7) Example Installed Guest OS Boot Screen
07-Example-Guest-Grub-Boot-Menu.png
8) You can know the assigned IP Address for the Guest OS
08-Find-IP-Address-Guest.png
Find your Guest's ip address in "Show virtual hardware details" menu in NIC option. If IP address is not shown click refresh button and see. Mind that the guest OS is running and network is running in guest.
IP address may be needed for ssh access to your Guest OS from host.
11) Trouble Shoot CDROM issues
11-TroubleShoot-CDROM.png
You can check if CDROM ISO image is present and if not browse and select it.
12) Trouble Shoot Boot issues
12-TroubleShoot-Boot.png
You can set devices to be bootable and the order of boot.
SSH Access
Install ssh (rsync) in both Host and Guest OS
Debian/Ubuntu install instructions:
apt-get install ssh rsync
Find your Guest's IP Address in "Show virtual hardware details" menu in NIC option. If IP address is not shown click refresh button and get it. Mind that the Guest OS is running and network is up and running in guest.
For SSH access to Guest OS run:
ssh -p 22 user@ip_address_of_guest
You can access guests with their hostnames. See this link for instructions for Debian.