torsdag 27 maj 2010

Setting up a compute cloud at Amazon

First you have to register an account to use Amazon's many Web Services.
"Sign Up", and enter email, name and address.

When that's done, sign up to the Amazon Elastic MapReduce service. Here you have to enter your credit card number, and address.  Then Amazon calls you and have you enter (or say!) a PIN code that is shown on the screen.

Then they will mail you to let you know that you have enrolled in the services Amazon Elastic MapReduce, Amazon Virtual Private Cloud, Amazon Elastic Compute Cloud, Amazon Simple Storage Service.

You are also told that you have now an access-key that is used in the Web Services interface to Amazon's services.

Now, lets see the Getting Started Guide.
We need to create a "bucket" to store data and results.  There are both command line tools, and a great firefox plugin Amazon S3 Firefox Organizer (S3Fox)

$ KEY="" SKEY="" # fill in values from Amazon
$ curl -o aws; chmod a+x aws
$ echo $KEY >~/.awssecret; chmod go-rwx ~/.awssecret ; echo $SKEY >>~/.awssecret

$ ./aws mkdir sics-lra

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

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

mount /dev/$vg/$vm $LUCID
debootstrap --variant=buildd --arch i386 lucid $LUCID
chroot $LUCID
export LC_ALL=C

cat > /etc/apt/sources.list <<EOF
deb lucid          main restricted universe
deb lucid-security main restricted universe

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

umount $LUCID

xm create /dev/null kernel=/boot/vmlinuz- ramdisk=/boot/initrd.img- 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)
lvcreate --snapshot --size 1G --name $vm $vg/$orig
mount /dev/$vg/$vm /mnt
echo $vm > /mnt/etc/hostname 
umount /mnt

onsdag 12 maj 2010

Quick and Dirty Flattr button to - adding a HTML/Javascript Gadget

1. Submit your blog url to Flattr
2. Copy the html code that is generated to your clip board (mark it and press CTRL-C, or CMD-C)
3. Go to your blogger dashboard at It will list all your blogs.
4. At the entry for your blog, click on "Settings" (or what it is called in your language), second-next to the blue "New Post" button.
5. Click on the "Layout" tab, and choose the "Page Elements" sub-tab
6. Click on "Add a Gadget" (you can choose above, on the side menu, or at the bottom.  I chose to put it in the site menu).
Add7. Click on the "HTML/JavaScript
" gadget.
8. Paste the flattr HTML code from step 2 into the content box, and add some title and explaining text if you like.
9. Click save.

Now this will show the Flattr button on every page of your blog.  View your blog to see that it actually works.

tisdag 11 maj 2010

building xen3.4.2 in a lucid root file system

# create the pristine root file system

mkdir -p $LUCID

sudo dpkg -i debootstrap_1.0.20ubuntu1_all.deb
sudo debootstrap --variant=buildd --arch i386 lucid $LUCID

# go into it
sudo chroot $LUCID

export LC_ALL=C

echo > /etc/apt/sources.list deb lucid main restricted universe
apt-get update
apt-get install -y wget nano mercurial git-core gawk openssh-client libz-dev \
gettext libssl-dev libx11-dev bin86 bcc libncurses5-dev python-dev texinfo \
bridge-utils uuid-dev iasl

mkdir /root/xen
cd /root/xen

tar xfz xen-$XENVER.tar.gz
cd xen-$XENVER
make -j8 world

# now everything is in dist, install like this
cd dist
sudo sh
mkinitramfs -v -o /boot/initrd.img-

# make a grub entry and reboot
# WARNING! make sure that the kernel can boot your file system 
# (LVM requires the dm module, etc.)

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
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

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.