Install Alpine on Amazon EC2

From Alpine Linux
Revision as of 13:58, 1 June 2012 by Dubiousjim (talk | contribs) (Running Alpine Linux in Amazon EC2 moved to Install Alpine on Amazon EC2: Make title more consistent with other Virtualization pages)
This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Dubiousjim on 1 Jun 2012.)

Just transcribing notes from the mailing list.

Date: Sun, 27 May 2012 09:00:47 -0700
From: Nathan Angelacos <nangel@alpinelinux.org>
Subject: [alpine-devel] Notes on Alpine 2.4.2 in Amazon EC2

Just some notes on trying to get Alpine Linux running on an EC2 instance.

As of 27 May 2012, The Amazon Linux AMI includes pv-grub, so trying an
alternate kernel is fairly simple:

* Start the instance (its some variant of redhat)
* wget the alpine iso and copy the /boot and /apk directories to the
EC2  instance /
* create a apkovl.tar.gz that includes the ssh public keys, starts
openssh, etc.; place the apkovl in /


The /boot/grub/grub.conf looks like this:

default=0
fallback=1
timeout=3
hiddenmenu

title Alpine Linux
root (hd0)
kernel /boot/grsec alpine_dev=xvda1:ext4
modules=loop,squashfs,sd-mod,ext4 console=hvc0
initrd /boot/grsec.gz


title Amazon Linux AMI (PV)
root (hd0)
kernel /boot/vmlinuz-3.2.12-3.2.4.amzn1.i686 root=LABEL=/ console=hvc0
initrd /boot/initramfs-3.2.12-3.2.4.amzn1.i686.img


----

What doesn't work:


* Booting the 32bit kernel reports:
  ERROR: Invalid kernel: 'elf_xen_note_check: ERROR: Will only load
images built for the generic loader or Linux images
  xc_dom_oparse_image returned -I


http://wiki.alpinelinux.org/wiki/Talk:Create_Alpine_Linux_PV_DomU says
that's because the kernel uses PVOps and its running on 64 bit
hardware.



* Booting the 64bit kernel reports:
  can only boot x86 32 PAE kernels, not xen-3.0-x86_64
  Error 13: Invalid or unsupported executable format


Date: Tue, 29 May 2012 17:09:56 +0200
From: Natanael Copa <ncopa@alpinelinux.org>
Subject: {SPAM 01.5} Re: [alpine-devel] Notes on Alpine 2.4.2 in Amazon EC2

On Sun, 27 May 2012 09:00:47 -0700
Nathan Angelacos <nangel@alpinelinux.org> wrote:

> * Booting the 64bit kernel reports:
>    can only boot x86 32 PAE kernels, not xen-3.0-x86_64
>    Error 13: Invalid or unsupported executable format
>

I built a kernel dedicated for virtual guests. One of the goals is to
make it as small as possible. I have no idea if it even boots at this
point but feedback is welcome.

I'd like it to include drivers for qemu/kvm, xen, vmware, virtualbox
and hyper-v guests.

It is in edge/testing and is named linux-virt-grsec.

Thanks!

-nc


> Can we see a bootable iso in edge/releases or a wiki help page on how
> to create one. It would be great to have a lighter iso suited for
> virtual guests. I could test using kvm and install/test pmreader on
> it. (http://insteps.net/pr/a/pmwiki/Apps/PmReader-help-v1-1)

I built one for testing
http://dev.alpinelinux.org/~ncopa/alpine/alpine-virt/

>
> Thanks.

I think kernel config might needs some tweaking still.

-nc


Date: Thu, 31 May 2012 18:56:29 -0700
From: Nathan Angelacos <nangel@alpinelinux.org>
Subject: Re: [alpine-devel] Notes on Alpine 2.4.2 in Amazon EC2

Thanks to all for the help - Alpine Linux is now live in the  Amazon
EC2 cloud.  The following isn't pretty (no prepackaged AMI or
anything) - more like duct-tape and fishing line - but its a start.

Pre setup:
  * Set up a local box so that it does
    * dhcp on eth0
    * starts sshd
    * put your public key in /root/.ssh/authorized_keys
    * set the root password
    * lbu include root/.ssh
    * You may wish to delete the /etc/ssh/*key* files, so that they
are created  on the new box
  * lbu package amazon.apkovl.tar.gz
    * IMPORTANT:  If you are building this on a 32bit box, delete
etc/apk/arch from the apkovl.tar.gz file

* Create an instance, use Amazon Linux, *64bit* version
* Copy the amazon.apkovl.tar.gz to the instance
* Log in, sudo
* Move the apkovl.tar.gz to /
* wget the latest alpinelinux *x86_64* iso. 32bit won't work
* Copy alpinelinux to the EBS harddrive
  * mkdir x;
  * mount alpine*.iso x -o loop
  * cd x
  * cp -av apks /
  * cp boot/* /boot
  * cd
* Edit the /boot/grub/grub.conf so that it looks something like this:

> default=0
> fallback=1
> timeout=3
> hiddenmenu
>
> title Alpine Linux
> root (hd0)
> kernel /boot/grsec alpine_dev=xvda1:ext4 modules=loop,squashfs,sd-mod,ext4 console=hvc0 pax_nouderef BOOT_IMAGE=/boot/grsec
> initrd /boot/grsec.gz
>
>
> title Amazon Linux AMI (PV)
> root (hd0)
> kernel /boot/vmlinuz-3.2.12-3.2.4.amzn1.i686 root=LABEL=/ console=hvc0
> initrd /boot/initramfs-3.2.12-3.2.4.amzn1.i686.img

   * syslinux automatically adds the BOOT_IMAGE to the kernel command
line; grub does not.

* Reboot