From Fedora Project Wiki

Revision as of 07:24, 6 June 2011 by Henryp (talk | contribs) (Initial version.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Cloud image generation short cuts for noobs

Introduction

Purpose

Scope

Acronyms, descriptions

References


Creating an image

  1. Get the OS
  2. create loop back image
  3. configure image.
  4. bundle image.
  5. Install the bundle on UEC.
  6. Test the Ubuntu i386 bundle on AWS.
  7. Test the bundle on AWS


Creating a Fedora image

  1. dd if=/dev/zero of=fedora.fs bs=1M count=2048
  2. mke2fs -F -j fedora.fs
  3. mkdir /mnt/fedora
  4. mount -o loop fedora.fs /mnt/fedora
  5. mkdir /mnt/fedora/dev
  6. /sbin/MAKEDEV -d /mnt/fedora/dev -x console
  7. /sbin/MAKEDEV -d /mnt/fedora/dev -x null
  8. /sbin/MAKEDEV -d /mnt/fedora/dev -x zero
  9. mkdir /mnt/fedora/etc
  10. vi /mnt/fedora/etc/fstab
    • See fstab content below.
  11. cat /etc/yum.conf /etc/yum.repos.d/fedora.repo >> /mnt/fedora/etc/yum.conf
  12. vi /mnt/fedora/etc/yum.conf
    • See yum.conf content below.
  13. mkdir /mnt/fedora/proc
  14. mount -t proc none /mnt/fedora/proc
  15. yum -c /mnt/fedora/etc/yum.conf --installroot=/mnt/fedora -y groupinstall Base
  16. vi /mnt/fedora/etc/sysconfig/network-scripts/ifcfg-eth0
    • See blow
  17. echo "NETWORKING=yes" > /mnt/fedora/etc/sysconfig/network
  18. Update /mnt/fedora/etc/fstab
    • See below
  19. chroot /mnt/ec2-fs /bin/sh
  20. chkconfig --level 345 my-service on
  21. exit
  22. umount /mnt/fedora/proc/
  23. umount -d /mnt/fedora

fstab

{pre} /dev/sda1 / ext3 defaults 1 1 none /dev/pts devpts gid=5,mode=620 0 0 none /dev/shm tmpfs defaults 0 0 none /proc proc defaults 0 0 none /sys sysfs defaults 0 0

  1. This is for c1.small and m1.medium
  2. For others please see:

http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?instance-storage-concepts.html /dev/sda2 /mnt ext3 defaults 0 0 /dev/sda3 swap swap defaults 0 0 {/pre}

yum.conf

{pre} [main] cachedir=/mnt/fedora/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 plugins=1 installonly_limit=3 color=never exclude=*-debuginfo gpgcheck=0 reposdir=/dev/null

  1. This is the default, if you make this bigger yum won't see if the metadata # is newer on the remote and so you'll "gain" the bandwidth of not having to # download the new metadata and "pay" for it by yum not having correct # information.
  2. It is esp. important, to have correct metadata, for distributions like # Fedora which don't keep old packages around. If you don't like this checking # interupting your command line usage, it's much better to have something # manually check the metadata once an hour (yum-updatesd will do this).
  3. metadata_expire=90m
  1. PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d

[fedora] name=Fedora $releasever - $basearch failovermethod=priority

  1. mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-14&arch=$basearch enabled=1 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[fedora-debuginfo] name=Fedora $releasever - $basearch - Debug failovermethod=priority #baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[fedora-source] name=Fedora $releasever - Source failovermethod=priority [main] cachedir=/mnt/fedora/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 plugins=1 installonly_limit=3 color=never exclude=*-debuginfo gpgcheck=0 reposdir=/dev/null

  1. This is the default, if you make this bigger yum won't see if the metadata # is newer on the remote and so you'll "gain" the bandwidth of not having to # download the new metadata and "pay" for it by yum not having correct # information.
  2. It is esp. important, to have correct metadata, for distributions like # Fedora which don't keep old packages around. If you don't like this checking # interupting your command line usage, it's much better to have something # manually check the metadata once an hour (yum-updatesd will do this).
  3. metadata_expire=90m
  1. PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d

[fedora] name=Fedora $releasever - $basearch failovermethod=priority

  1. mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-14&arch=$basearch enabled=1 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[fedora-debuginfo] name=Fedora $releasever - $basearch - Debug failovermethod=priority #baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[fedora-source] name=Fedora $releasever - Source failovermethod=priority

  1. baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

  1. baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch {/pre}


ifcfg-eth0

{pre} DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes TYPE=Ethernet USERCTL=yes PEERDNS=yes IPV6INIT=no {/pre}

Open issues

Trouble shooting