Making a VM

Both of these methods explain how to make a VM using the libvirt tools with a remote connection authenticated with admin Kerberos tickets (that's how qemu+tcp is set up). But you can also just ssh straight to the host and run the tools, or tunnel your remote connection over ssh (using qemu+ssh instead).

No matter which set of tools you use, you should first make a Netreg entry and a DNS entry. TODO add links to Netreg and DNS walkthrough.

TODO explain how to pick a host (not that it's hard, as there's only one host in an acceptable state at the moment, kvm02)

First,

kinit $USER/admin@CLUB.CC.CMU.EDU
virsh --connect qemu+tcp://kvm02.club.cc.cmu.edu/system list
# does it work? okay, move on

GUI

Use virt-manager. apt-get install virt-manager, or whatever is appropriate for your distro.

  1. Start virt-manager.
  2. File->Add Connection, Method: TCP, Hostname: kvm02.club.cc.cmu.edu

  3. Click new VM and follow the prompts. For maximum ease of use, choose Network Install on the first step, and paste in a url from man virt-install.

    Or just http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/

  4. Make sure to set the MAC address to the one in NetReg so DHCP does its thing. (This must be done if you're using a network install).

  5. You may want to check "Customize configuration before install" and add a serial console
  6. You're done.

You may want to clubify that VM.

CLI

Use virsh and virt-install. Get both with apt-get install virtinst, or whatever is appropriate for your distro.

# if you're not ssh'd to the host itself, and are running these
# locally (which is totally okay), then either:

# * Pass --connect qemu+tcp://kvm02.club.cc.cmu.edu/system as an
# argument to all commands

# * Set LIBVIRT_DEFAULT_URI, like this
export LIBVIRT_DEFAULT_URI=qemu+tcp://kvm02.club.cc.cmu.edu/system 

# I'll assume that you do one or the other for all further commands (virt-install, virsh)

virt-install
# this will error and demands some specific additional arguments, it's really quite simple
# here's an example:
virt-install --name $VM_HOSTNAME --memory 512 --disk size=10 \
             --location http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/    

# some useful other arguments:
# to not be NAT'd, --network bridge=br0,mac=what:you:put:in:net:reg

# to force creation of a graphical display, --graphics vnc or --graphics spice
# to force no creation of graphical display, --graphics none
# if --graphics something isn't present, it'll choose the appropriate one based on whether DISPLAY is set

# to force the creation of a text console, --extra-args console=ttyS0 
# you can attach to the text console with virsh -c url console $THEVM

# typical cclub invocation
virt-install --name $VM_HOSTNAME --memory 512 --disk size=10 \
             --graphics none --extra-args console=ttyS0 \
             --network bridge=br0
             --location http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/    

# OK, you're done!

But you may want to clubify that VM, see below...

Making a Host

Really simple.

apt-get install libvirt-bin virtinst virt-top 

YOU'RE DONE but you may want to clubify the host as well

Clubify a Machine

This allows login with club credentials.

# add the cclub debian repository
echo "deb http://debian.club.cc.cmu.edu/debian/ wheezy-cclub contrib" >> /etc/apt/sources.list
apt-get update

# trust the signing key for packages (as well as certs, etc)
# this is insecure D:
apt-get install cclub-keyring
apt-get update

# for the CClub-specific LDAP configuration, as well as other things
apt-get install cclub-debconf-settings 

# install LDAP for user ids and such, and Kerberos for authentication of users
apt-get install libnss-ldapd heimdal-clients libpam-heimdal 

# (optional) for AFS homedirs for users
apt-get install openafs-client libpam-afs-session