how to make fedora 10 image from old version

Fedora 10 just came out. If you have an old redhat OS (fedora or CentOS) and you want a new fedora 10 image, to be used as a Xen domainU or a customized Amazon EC2 AMI or whatever, here's how to do it:

Step 1: Create a 2Gig sparse file or lvm and mount it to /mnt.
for sparse file:
# dd if=/dev/zero of=f10.img bs=1024k count=1 seek=2000
# mkfs.ext3 f10.img
# mount -o loop f10.img /mnt
for lvm:
# lvcreate -L2G -n f10 vg0 (assume you have a volume group called vg0)
# mkfs.xfs /dev/vg0/f10
# mount /dev/vg0/f10 /mnt

Step 2: edit /etc/yum.repo.d/fedora.repo
go to /etc/yum.repo.d, create a new directory, then move everything to the new directory. (you will move them back up to /etc/yum.repo.d after creating fedora 10). Create a new file call fedora.repo with content:
name=Fedora 10 - i386


Step 3: do a "yum groupinstall"
#yum clean all
#yum makecache
# yum --installroot=/mnt -y groupinstall Base
Go have a cup of tea, or read some blogs, or downmod some reddits.
After the installation is complete, to make it actually useable, you need to create these devices:
# MAKEDEV -d /mnt/dev -x console
# MAKEDEV -d /mnt/dev -x null
# MAKEDEV -d /mnt/dev -x zero
And create a root passwd:
# chroot /mnt
# pvconv
# passwd
# exit
Create some files:
# vi /mnt/etc/fstab
# vi /mnt/etc/sysconfig/network
# vi /mnt/etc/sysconfig/network-scripts/ifcfg-eth0
# vi /mnt/etc/resolv.conf
The contents of these files depends on your settings, use the files on your current OS as references.

That's it, you're done. Unmount the image. Now you should be able to boot it. After you boot it(e.g. as a Xen domU), do some configurations. These are what I did:
# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start #use network instead of NetworkManager
# chkconfig atd off
# chkconfig bluetooth off
# chkconfig cups off
# chkconfig haldaemon off
# chkconfig ip6tables off
# chkconfig mdmonitor off
# chkconfig netfs off
# chkconfig netfs off
# chkconfig nfslock off
# chkconfig pcscd off
# chkconfig portreserve off
# chkconfig rpcbind off
# chkconfig rpcidmapd off
# chkconfig rpcgssd off #all these services are useless for me
# yum install xfsprogs #my filesystem is xfs
# vi /etc/rc.d/rc.sysinit #comment out a bunch of lines to get rid of false err/warning device-mapper messages during boot-up

Don't forget to delete (in your current OS) fedora.repo in /etc/yum.repo.d and move everthing back in there.

1 comment:

Unknown said...

Do you think you could post the bundle commands for AMI to this post so that people have a beginning to end method for getting together a Fedora 10 AMI on ec2 from beginning to end?

That would really be fantastic