The other day I installed Gentoo on an old Celeron 466MHz and it was quite an adventure.  Today, I’m attempting to install it in a far more useful capacity as a virtual machine under VMware Fusion.  The first thing I did was create a new virtual machine.  There is no template for Gentoo so I tweaked the settings a bit.  I gave it 512MB ram, 30GB hard drive and set it to “generic linux 2.6.X kernel”.  I set it to boot from the minimal ISO that I used to burn the CD for the other day. After I was booted up, I ran a couple of benchmarks.  Thankfully this system is several orders of magnitude faster than a Celeron 466MHz.

Using fdisk, I created my 3 partions:

/boot /dev/sda1

swap /dev/sda2

/        /dev/sda3

Then I did my mkfsing:

mke2fs /dev/sda1

mke2fs -j /dev/sda3

mkswap /dev/sda2 && swapon /dev/sda2

Now it was time to snag my stage file.  This time instead of wget, I used links:

links gentoo.org

I hit the downloads link, then hit the stages button next to i686 and found the most recent stage3-i686 tar.bz2 file and downloaded it.  After that, I untarred it:

tar -xpjf s<TAB>

Next, I changed snagged the latest portage via links and untarred that:

cd  usr

links distfiles.gentoo.org/snapshots

tar -xpjf p<TAB>

Then it’s time to chroot:

livecd / # mount -t proc proc /mnt/gentoo/proc

livecd / # mount -o bind /dev /mnt/gentoo/dev

livecd / # cp -L /etc/resolv.conf /mnt/gentoo/etc/

livecd / # chroot /mnt/gentoo /bin/bash

livecd / # env-update && source /etc/profile

Then I set the timezone:

cp /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

After that, it’s time to fix up the hostname:

cd /etc

echo “127.0.0.1 gentoo.notanon.com gentoo localhost” > hosts

sed -i -e ‘s/HOSTNAME.*/HOSTNAME=”gentoo”/’ conf.d/hostname

hostname gentoo

Now for the kernel.  I didn’t do a lot of tweaking with the kernel this time around.  I just added ext2 support and a couple of extra modules I want to experiment with.

emerge gentoo-sources

cd /usr/src/linux

make menuconfig

time make -j2

make modules_install

cp arch/i386/boot/bzImage /boot/kernel

Then I editted the /etc/fstab to look something like this:

/dev/sda1 /boot ext2 noauto,noatime 1 2

/dev/sda3 / ext3 noatime 0 1

/dev/sda2 none swap sw 0 0

Then I installed cron, syslog, grub dhcpcd:

time emerge syslog-ng vixie-cron grub dhcpcd

rc-update add syslog-ng default

rc-update add vixie-cron default

After that it’s time to nano /boot/grub/grub.conf:

default 0

timeout 10

title Gentoo

root (hd0,0)

kernel /boot/kernel root=/dev/sda3

Then I ran grub and entered:

root (hd0,0)

setup (hd0)

quit

After this, supposedly it’s time to unchroot, cross my fingers and reboot:

exit

umount /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo

reboot

Alas, it didn’t work.  I’ve yet to nail a Gentoo installation on the first attempt but this time I was much closer.  I ended up finding a wiki on installing Gentoo in a VM.  I rebuilt the kernel with some of the suggestions that were stated in the wiki and that did the trick.



If you like the content on this site, please support it by using this link to order from Amazon. You know you were going to go there and buy stuff anyhow so why not help me pay the hosting bill.