Sunday, November 28, 2010

Debian Lenny Xen Setup (Guest Domain)

xen-create-image --ip= --hostname=greenbox --role udev --debootstrap
xen-create-image --ip= --hostname=yellowbox --role udev --debootstrap

xm create -c /etc/xen/greenbox.cfg
xm create -c /etc/xen/yellowbox.cfg

reboot (not neccesary, but I dig it)

After a fairly lengthy reboot process you should have machines on .80, .81, and .82 all running.

Inside the VMs

aptitude install -R avahi-daemon
adduser awesomeusername

You can now ssh greenbox.local and use an account that isn't root.

Check this link if you want to setup a LAMP server.
Check this link if you want to setup a TomCat server.

Debian Lenny Xen Setup (Domain Zero)


For this setup, I want to install Debian Lenny with several Xen virtual machines.  The hardware is an older Dell something in a black case, so the dom0 domain will be called "blackbox" and the domU domains will be known by other colors.  I don't need any GUI stuff for this install since it'll just be doing server-ish terminal stuff.


Install Debian from the net install CD. From the screen to select "choose software to install" deselect the Desktop Environment unless you want it for some reason. Leave Standard System selected.

This Debian install doesn't come with sudo so just use su instead. You can install sudo if you really want to but then you'll have to configure it.

I like to setup the system so I can SSH to the box and I don't have to spend all my time in the basement.

aptitude install -R openssh-server
aptitude install openssh-blacklist-extra
aptitude install -R avahi-daemon

Remote Control

From the comfort of a computer not in a server room or basement ssh to box.  Just to test it properly, I like to remote in, and reboot the machine.  If that works you know you have full remote control of the box.

ssh blackbox.local

Static IP

By default if Debian can use DHCP, it will, but since we are running a server we probably want it to have a static IP address.  So get in there and change it.  You should be careful, because if you screw it up you have to head back to the physical machine and update it.

vim /etc/network/interfaces
(edit this line)
iface eth0 inet dhcp

(change it to this, in my case)
iface eth0 inet static
When you've got it perfect run I prefer to reboot (reboot) the system again just for good measure.  Some people will prefer to just restart the networking bits on the system (/etc/init.d/networking restart).

You'll be disconnected from your ssh session but should be able to reconnect with ssh blackbox.local again.

Setup Xen

Up until this point, the rest of that junk was pretty basic setup that would apply to all Debian Lenny installs, but here's where we actually get specialized.

aptitude install -R bridge-utils
aptitude install -R xen-linux-system-2.6.26-2-xen-686
aptitude install -R xen-utils-3.2-1
aptitude install -R xen-shell
aptitude install -R xen-tools

uname -r
... make sure it that "xen" is included in the name of the kernel

vim /etc/xen/xend-config.sxp
... uncomment (network-script network-bridge)
... comment (network-script network-dummy)

vim /etc/modules
... edit loop to loop max_loop=64

vim /etc/xen-tools/xen-tools.conf
... uncomment dir = /home/xen
... edit dist = etch  to dist = lenny 
... uncomment gateway   =
... uncomment netmask   =
... uncomment broadcast =
... edit network addresses to match your configuration
... uncomment passwd = 1

reboot (just for good measure)


Now everything should be setup properly.  Cross your fingers

Friday, November 26, 2010

Debian Xen Lenny Setup

Install Debian Lenny.  Minimal Net Install CD.
You won't get sudo out of the box, so just use su all the time instead.

So I can ssh to the machine name.local instead of IP, install some avahi stuff (I'll have to test to see what's most useful).. one or more of these, probably not discover.  I'd guess, start with libnss-mdns.

  • sudo apt-get install avahi-utils
  • sudo apt-get install avahi-daemon
  • sudo apt-get install avahi-discover
  • sudo apt-get install libnss-mdns

Set a name for DHCP server in the dhclient.conf.  This is so my DHCP server knows who is getting what address.  It's helpful.

vim /etc/dhcp3/dhclient.conf
send host-name "Yellow";
Untested hypothesis:  Setting the name that the machine reports to the DHCP server allows me to easily access the machine without the "ssh yellow.local" style naming configuration.  It allows me to simply use "ssh yellow"

Probably need to find the proper versions of this stuff via "apt-cache search xen-*whatever*"
  • apt-get install xen-hypervisor-3.2-1-i386
  • apt-get install xen-linux-system-2.6.26-1-xen-686
  • apt-get install xenwatch
  • apt-get install xen-shell
I stole that from this line: apt-get install xen-hypervisor-3.2-1-amd64 xen-linux-system-2.6.26-1-xen-amd64 xen-utils-3.2-1 xenstore-utils xenwatch xen-shell xen-tools

Follow this link now

Also use this link

1. add to /etc/xen-tools/xen-tools.conf:
serial_device = hvc0
2. and make domU with:
xen-create-image --hostname HOSTNAME (more options...) --role udev

Use DHCP for stuff.

xen-create-image --hostname=greenbox --dir=/vserver/images --dist=lenny --debootstrap

cd /etc/xen/

xm create -c greenbox.cfg
xm list
xm shutdown greenbox