Visar inlägg med etikett virtualization. Visa alla inlägg
Visar inlägg med etikett virtualization. Visa alla inlägg

tisdag 25 maj 2010

Creating a Xen Ubuntu Lucid DomU

# work in progress
# create a new file system, add a user, enable networking with dummy ip4 address,  create the VM

vg=cluster5
export vm=myvm
LUCID=/mnt
lvcreate --size 1G --name $vm  $vg
mkfs.ext4 /dev/$vg/$vm

mount /dev/$vg/$vm $LUCID
debootstrap --variant=buildd --arch i386 lucid $LUCID http://se.archive.ubuntu.com/ubuntu
chroot $LUCID
export LC_ALL=C

cat > /etc/apt/sources.list <<EOF
deb http://se.archive.ubuntu.com/ubuntu lucid          main restricted universe
deb http://se.archive.ubuntu.com/ubuntu lucid-security main restricted universe
EOF

apt-get update
apt-get -y install ubuntu-minimal openssh-server
adduser --ingroup sudo larsr
# fill in stuff

echo $vm > /etc/hostname
cat >>/etc/network/interfaces <<EOF
auto eth0
iface eth0 inet static
 address 1.1.1.1
 netmask 255.255.255.255
EOF

exit
umount $LUCID

xm create /dev/null kernel=/boot/vmlinuz-2.6.31.13 ramdisk=/boot/initrd.img-2.6.31.13 name=$vm  disk=phy:/dev/$vg/$vm,/dev/xvda1,w  root=/dev/xvda1 vif="mac=00:16:3e:0e:34:14,vifname=$vm" -c

Then you can create snapshots of the disk very quickly (thanks to LVM)
orig=vm
vm=newvm
lvcreate --snapshot --size 1G --name $vm $vg/$orig
mount /dev/$vg/$vm /mnt
echo $vm > /mnt/etc/hostname 
umount /mnt

torsdag 6 maj 2010

Install Ubuntu Lucid Lynx root file system from command line

Here is a link to a more thorough post

If you are running an older version of ubuntu, or some other debian distribution, you can create a lucid lynx root file system like this

First install the debootstrap package (it should include the settings file for lucid lynx)
1. download it from http://packages.ubuntu.com/intrepid-backports/all/debootstrap/download
2. install it with sudo dpkg -i NAME_OF_PACKAGE.deb

Create the root filesystem (on a mounted partition, that you have prepared, here I just mkdir a place)

3. mkdir ~/lucid
4. sudo debootstrap --variant=buildd --arch i386 lucid ~/lucid http://archive.ubuntu.com/ubuntu/

That's it!

Debootstrap copies the /etc/passwd so  you can login, but it doesn't copy over the network settings or other servers, so make sure that they are correct before starting a machine with the new root file system.