Setting up KVM on my dev system

Wanted to create 3 VMs on my Desktop with dedicated partitions on hard disk and dedicated NIC ports.

Installed Debian-9.2.1-amd64 on the base/host system. Updated to the latest kernel (optional).

Verify that virtualization is enabled in BIOS

root@server:~# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Thread(s) per core: 2
Core(s) per socket: 16
Socket(s): 1
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 23
Model: 1
Model name: AMD Ryzen Threadripper 1950X 16-Core Processor
Stepping: 1
CPU MHz: 2200.000
CPU max MHz: 3400.0000
CPU min MHz: 2200.0000
BogoMIPS: 6786.94
Virtualization: AMD-V
L1d cache: 32K
L1i cache: 64K
L2 cache: 512K
L3 cache: 8192K
NUMA node0 CPU(s): 0-31
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca

Installed qemu-kvm and required packages

apt install -y qemu-kvm libvirt0 virt-manager bridge-utils

Rebooted the system.

Edited and updated the contents of /etc/network/interfaces (For one physical interface bridged to br0 interface)

auto enp5s0
iface enp5s0 inet manual

auto br0
iface br0 inet static
bridge_ports enp5s0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

Rebooted the system. Did not want the other physical interfaces to be brought up on start-up even if they are connected to a switch (Not sure if this is the right way, but worked for me).

Used nm-connection-editor to achieve the same. Selected the connection and ‘Edit’ option

Clicked on General Tab

Unchecked all options as shown below

‘Saved’ and repeated the same for all other connections.

Rebooted the system (Restart networking did not help – not sure what mistake I did).

Added ‘root’ (user account that would be accessing the virt-manager) to libvirt group.

gpasswd libvirt -a root

Copied the downloaded Debian (required guest OS) iso image to /var/lib/libvirt/images folder

Changed the ownership information for iso images

chown libvirt-qemu:libvirt /var/lib/libvirt/images/*

Started the virt-manager, selected File->New Virtual Machine and performed the following actions

Clicked on Browse and selected the image and continue with “Choose Volume”

Note : Wanted dedicated physcial partition. Did not select Manage and directly typed the partition information.

Note : As had decided to allocate dedicated NIC, selected appropriate macvtap option.

Completed all installation steps.

Once the installation was over and VM started – Manually shut down the same to update the boot options in virt-manager.

After shutting down, Selected View->Details from Menu.

Updated the boot options as follows

After applying the changes.

That’s it now after starting the host, the VMs are started and are ready for accessing them.

About sandeep

Passionate about sharing information on "how to".
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.