On Tue, 2005-01-25 at 00:03 -0500, Jeremy Katz wrote:
Next, let's create a file to use as the backing for our Fedora install.
For example purposes, I'll create one of a size of 1 GB.
dd if=/dev/zero of=/root/fedora.img bs=1M count=1024
To make a sparse file, I used:
dd if=/dev/zero of=fedora.img bs=1M count=1 seek=1024
This way, my file looked like 1GB, but only allocated space upon use.
Now, create an ext3 filesystem on this image.
mke2fs -F -j /root/fedora.img
You should now be able to mount your new temporary rootfs on a temporary
mountpoint, say /mnt
mount -o loop /root/fedora.img /mnt
Now, we can install whatever basesystem we want into this chroot. Make
sure that your yum configuration points to a valid repository. Then,
decide what group(s) you want to install. I'd recommend starting with
Base (or for the space constrained, Core, but this is more difficult).
Then, run
yum --installroot=/mnt -y groupinstall Base
Cool trick! Didn't know that I could do that! I did find that I needed
to 'rpm --root /mnt --import <various RPM-GPG-KEYs> to make yum happy.
I also needed to create /mnt/var/cache/yum so that it could write
the .gpgkeyschecked.yum file. I suppose that if I turned off gpg
checking, I would have been fine.
Now, go get some coffee and have a snack. It's going to take a
little
while :-)
Using rawhide as of this morning, I had dep issues with dmraid (needs to
be rebuilt against new device-mapper) and stunnel (needs words). I
excluded dmraid and stunnel and the install went ok.
Come back and if everything went okay, you'll have a minimal
install
in /mnt. Now, for the ugly part, we need to set up some basic bits on
the filesystem that have to be different for xen right now. These
include a) creating some required device nodes in /dev
since we're not using an initrd and b) setting up an /etc/fstab
for i in console null zero ; do MAKEDEV -d /mnt -x $i ; done
for i in console null zero; do MAKEDEV -d /mnt/dev -x $i ; done
Otherwise, those device files end up in / instead /dev on the filesystem
image.
For the /etc/fstab, something simple like the following should work
/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
Would it be necessary to have /sys in fstab? The initscripts mount it
automagically themselves. Haven't performed any testing myself to
validate with a Xen config.
--
David Hollis <dhollis(a)davehollis.com>