Instructions for Deploying a New CN KVM Instance
================================================

Create Virtual Machine
----------------------

It is assumed that the host is operational and configured to support creation
and operation of KVM virtual machines. The host should be Ubuntu 9.10 or
later.

First, ensure that the host system is up to date::

  sudo apt-get update
  sudo apt-get upgrade

If a restart is pending (e.g. due to a new kernel being available), schedule
the restart before proceeding with the creation of the new CN instance.

The specification of the CN VM are:

  Processors    4
  RAM           4058884 KB
  Disk          400 GB
  Swap          2GB



::

  echo firstboot.sh
  
  #!/bin/bash
  ufw defaults drop
  ufw allow ssh
  ufw enable
  cd /etc/ssl
  wget "https://repository.dataone.org/software/cicore/trunk/os-base-install/dataone-os-base/etc/ssl/certs/ecoinfo-ldapcert.pem"

  export CNAME="cn-unm-1"
  export CIP="129.24.0.14"
  export CGW="129.24.0.1"
  export CNET="129.24.0.0"
  export CMASK="255.255.255.0"
  export CBCAST="129.24.0.255"
  export CDNS="8.8.8.8"
  sudo ubuntu-vm-builder kvm karmic \
    --arch='amd64'  \
    --cpus='4' \
    --mem='4096'  \
    --rootsize='400000'  \
    --swapsize='2048'  \
    --dest="/kvm/$MNAME.dataone.org" \
    --kernel-flavour='server'  \
    --hostname='$MNME'  \
    --domain='$MNAME.dataone.org'  \
    --mirror='http://archive.ubuntu.com/ubuntu'  \
    --components='main,universe,multiverse'  \
    --addpkg ufw \
    --addpkg dnsutils \
    --addpkg curl \
    --addpkg wget \
    --addpkg libnss-ldap \
    --addpkg nscd \
    --addpkg openssh-server \
    --addpkg nano \
    --addpkg man \
    --addpkg acpid \
    --name='Administrator'  \
    --user='localadmin'  \
    --pass='<< password >>'  \
    --bridge=br0 \
    --ip='$CIP'  \
    --mask='$CMASK'  \
    --net='$CNET'  \
    --bcast='$CBCAST'  \
    --gw='$CGW'  \
    --dns='$CDNS' \
    --libvirt qemu:///system 



Building a basic VM with openssh installed.  Adjust network settings as necessary.

ubuntu-vm-builder kvm karmic \
--arch='amd64'  \
--mem='2048'  \
--rootsize='8192'  \
--swapsize='4096'  \
--dest=/kvm/mule3.dataone.org \
--kernel-flavour='server'  \
--hostname='mule3'  \
--domain='mule3.dataone.org'  \
--mirror='http://archive.ubuntu.com/ubuntu'  \
--components='main,universe'  \
--addpkg openssh-server \
--addpkg ufw \
--addpkg dnsutils \
--addpkg curl \
--addpkg wget \
--addpkg acpid \
--name='<< Full name of user >>'  \
--user='<< username >>'  \
--pass='<< some password >>'  \
--bridge=br0 \
--ip='129.24.0.17'  \
--mask='255.255.255.0'  \
--net='129.24.0.0'  \
--bcast='129.24.0.255'  \
--gw='129.24.0.1'  \
--dns='8.8.8.8' \
--libvirt qemu:///system


Manage VMs:

$ virsh
# list --all
# destroy mule3   #turn "power" off for mule3
# undefine mule3
# exit

$ sudo rm -rf /kvm/mule3.

test