KVM: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
mNo edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
KVM is a virtualization engine, like VirtualBox or VMWare.
KVM is a virtualization engine, like [[VirtualBox]] or VMWare.
It is not locked to a Gui; this makes it more suitable for use on servers.  Along the same line,
it automatically sets up a virtual console using SPICE(http://www.spice-space.org/) or VNC. This allows out of band access to a virtual machine, sort of like [[IPMI]].


I am testing it on Dart, a server that runs Centos 6.5
''KVM'' and ''QEMU'' are the back end components. The "hypervisor".
''libvirt'' is a wrapper making the VMs easier to manage.
''virt-manager'' is a GUI for libvirt


I needed to be able to run Ubuntu to test out [[BigBlueButton]]. (It seemed the easiest path at the moment.)
I am testing it on [[Dart]], a server that runs Debian 7.
 
== Primary goals ==
 
I want to migrate wildsong.biz and hupi.org to virtual machines so that I can host them on Dart but still keep them walled off in their own worlds to make them easier to manage.
 
Also I need to be able to run Ubuntu to test out [[BigBlueButton]]. (It seemed the easiest path at the moment.)


== Set up ==
== Set up ==


Installed packages via yum
=== Preparing host machine ===
 
==== Package installation ====
 
sudo apt-get install qemu-kvm virtinst virt-top libvirt0 libvirt-bin virt-manager
 
==== Network ====
 
To make networking work the way I expect I had to put the host into bridge mode,
by changing /etc/network/interfaces so that it looks (more or less) like this
 
# Replace old eth0 config with br0
auto eth0 br0
# Use old eth0 config for br0, plus bridge stuff
iface br0 inet dhcp
    bridge_ports    eth0
    bridge_stp      off
    bridge_maxwait  0
    bridge_fd      0
 
=== Create a new guest machne ==


== Use ==
Initially I followed instructions to create a machine using only kvm but then found out about libvirt.
I started over again at this point.


Create a new virtual machine, then start it.
I also found it messy to work with libvirt and kvm as a regular user so I gave up on that too,
I only want to start up machines and let them run.


sudo -i
  mkdir /var/kvm
  mkdir /var/kvm
  cd /var/kvm
  cd /var/kvm
  qemu-img create -f qcow2 bigbluebutton.img 10G
  virt-install --name hupi --ram=1024 --disk path=hupi.img,size=10 --network bridge=br0 \
/usr/libexec/qemu-kvm -hda bigbluebutton.img -cdrom ~/ubuntu-13.10-server-i386.iso -boot d -m 2048 -vnc :0
  --graphics vnc,password=supersecret \
  --cdrom=debian-7.8.0-amd64-netinst.iso --os-type=linux --os-variant=debianwheezy \
  --description=HuPI.ORG
 
When working remotely, if you log in to your host machine with "ssh -Y ''host''" then virt-viewer will now open magically. No need to forward ports or install a VNC client etc.
 
Using virt-install and specifying skirted around problems I was having with networking too.
'''It worked on the first try. YAYAYAYAYA!!!'''
 
Notes continue for HuPI on the dedicated page: [[hub]]
 
=== Securing access ===
 
Seems quite open at the moment. I need my password in the guest, that's all.
If I don't need VNC from the big Internet I can disable the port forwarding in my firewall.
 
== Remote access ==
 
SPICE


Now connect via VNC client. On a Mac, I downloaded Vine VNC Client. It made me jump through hoops.
VNC - I am using because it's built in. Once the machine is running properly I have no immediate need for a GUI console.
I hope not to have to use it again.

Latest revision as of 21:30, 21 March 2015

KVM is a virtualization engine, like VirtualBox or VMWare. It is not locked to a Gui; this makes it more suitable for use on servers. Along the same line, it automatically sets up a virtual console using SPICE(http://www.spice-space.org/) or VNC. This allows out of band access to a virtual machine, sort of like IPMI.

KVM and QEMU are the back end components. The "hypervisor". libvirt is a wrapper making the VMs easier to manage. virt-manager is a GUI for libvirt

I am testing it on Dart, a server that runs Debian 7.

Primary goals

I want to migrate wildsong.biz and hupi.org to virtual machines so that I can host them on Dart but still keep them walled off in their own worlds to make them easier to manage.

Also I need to be able to run Ubuntu to test out BigBlueButton. (It seemed the easiest path at the moment.)

Set up

Preparing host machine

Package installation

sudo apt-get install qemu-kvm virtinst virt-top libvirt0 libvirt-bin virt-manager

Network

To make networking work the way I expect I had to put the host into bridge mode, by changing /etc/network/interfaces so that it looks (more or less) like this

# Replace old eth0 config with br0
auto eth0 br0

# Use old eth0 config for br0, plus bridge stuff
iface br0 inet dhcp
   bridge_ports    eth0
   bridge_stp      off
   bridge_maxwait  0
   bridge_fd       0

= Create a new guest machne

Initially I followed instructions to create a machine using only kvm but then found out about libvirt. I started over again at this point.

I also found it messy to work with libvirt and kvm as a regular user so I gave up on that too, I only want to start up machines and let them run.

sudo -i
mkdir /var/kvm
cd /var/kvm
virt-install --name hupi --ram=1024 --disk path=hupi.img,size=10 --network bridge=br0 \
 --graphics vnc,password=supersecret \
 --cdrom=debian-7.8.0-amd64-netinst.iso --os-type=linux --os-variant=debianwheezy \
 --description=HuPI.ORG

When working remotely, if you log in to your host machine with "ssh -Y host" then virt-viewer will now open magically. No need to forward ports or install a VNC client etc.

Using virt-install and specifying skirted around problems I was having with networking too. It worked on the first try. YAYAYAYAYA!!!

Notes continue for HuPI on the dedicated page: hub

Securing access

Seems quite open at the moment. I need my password in the guest, that's all. If I don't need VNC from the big Internet I can disable the port forwarding in my firewall.

Remote access

SPICE

VNC - I am using because it's built in. Once the machine is running properly I have no immediate need for a GUI console.