Sabayon on Amazon EC2

From Sabayon Wiki
Jump to: navigation, search

What this is about

This page explains how to bring Sabayon to Amazon EC2. It is about arranging a tarball (as in a root filesystem, in this guide we'll use the official tarballs available on the Sabayon mirrors called Sabayon_Linux_SpinBase_DAILY_<arch>_Amazon_EBS_ext4_filesystem_image.tar.gz) and move yourself to the cloud era.

What is needed

The most important thing is the kernel. EC2 uses Xen, so you need to use our "EC2+Xen Love" kernels called sys-kernel/linux-ec2. After the kernels, comes the /etc/fstab a proper /boot/grub/grub.conf and some other minor things. However, we're going to show you how to run Sabayon on EC2 step by step, by using our pre-made tarballs (which have all the basic things like networking, ssh and booting already configured properly).

Amazon prerequisites

In order to setup a Sabayon-based AMI on Amazon EC2, you need to have a valid AWS account (obvious thing) and a spare Amazon Linux (or another Linux distro, like Gentoo) instance (micro is fine, if you don't have it, just launch a new one) that we'll use to initialize a new EBS volume. Yes, this means that you should create an EBS volume, minimum size is 8GB just to be sure that we have enough room for messing around. From now on, we will call them the "Initiator instance" and "Initiator EBS" respectively.

Step 1, download the official tarballs

Download one of the following tarballs from our mirrors, depending on your architecture, onto the Initiator instance (just use wget <url>). You can find them inside the iso/daily directory:

  • Sabayon_Linux_SpinBase_DAILY_amd64_Amazon_EBS_ext4_filesystem_image.tar.gz for x86_64
  • Sabayon_Linux_SpinBase_DAILY_x86_Amazon_EBS_ext4_filesystem_image.tar.gz for i686

Step 2, setup the EBS volume

Attach an empty EBS volume (the Initiator EBS) to the Initiator instance on /dev/sdf. You can do this via the AWS Console. Then run, as root (or via sudo):

# mkfs.ext4 /dev/sdf -L /
# mkdir /mnt/ebsvol0
# mount /dev/sdf /mnt/ebsvol0

Step 3, unpack the tarball

Now that our Initiator EBS is mounted, just unpack the previously downloaded tarball.

# tar -xzpf Sabayon_Linux_SpinBase_DAILY_<arch>_Amazon_EBS_ext4_filesystem_image.tar.gz -C /mnt/ebsvol0/
# umount /mnt/ebsvol0

Replace <arch> with amd64 or x86, depending on your architecture.

Step 4, make the AMI

We're almost done, once umounted the Initiator EBS, detach it from the Initiator instance and create a snapshot (always graphically, through the AWS Console). Once the snapshot is done, click on it (in the Snapshots pane on the AWS Console) and then click on "Create Image". Select the proper architecture (x86_64 for amd64, i386 for x86) and the following AKI ID: aki-71665e05 for x86_64, aki-75665e01 for i386. Leave the rest untouched (ARI and /dev/sda1 for the root device).

Step 5, profit

Now that the AMI is created, just launch it and have fun! You will be able to connect to it through:

# ssh -i <your key> [email protected]<instance_dns>

ec2-user is the default user, root user has no password and you can gain root privileges by using "sudo" (for instance, "sudo su" to open a root shell). Enjoy!