Important Rule:
For a Gentoo (32-bit) install, use a Ubuntu 10.04 (32-bit) Live CD
For a Gentoo (64-bit) install, use a Ubuntu 10.04 (64-bit) Live CDYou may wish to refer to the Gentoo Handbook throughout,
Gentoo (32-bit) - http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?style=printable&full=1
Gentoo (64-bit) - http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?style=printable&full=1
Once you have successfully chrooted into your Gentoo system, the fact that Ubuntu was used becomes irrelevant. I therefore see no point in reiterating the Gentoo Handbook after this stage.
However, when you exit the chrooted environment you return to Ubuntu. As a result I have updated step 10.d from the Gentoo Handbook to reflect this.
Please also bare in mind Gentoo is a very customizable platform, certain choices I have made may not suit everyone or you may have your own preferences.
For example, the Gentoo Handbook suggests a separate /boot partition, I will not be doing this.
This guide also assumes you wish to install Gentoo 64-bit, 32-bit users must modify steps accordingly.
Start
Boot from the Ubuntu 10.04 Live CD and make sure you have internet access.
Prepare your Hard Disk
Use Gparted to prepare your hard disk for Gentoo.

I will be formatting my 465.76GB (aka 500GB) disk drive /dev/sda to the following layout,
Click on the picture for a bigger view
As can be seen from the screenshot, the partition setup is the following,
/dev/sda1 formatted to ext4 with 58.59GB ---> This will be my /root partition
/dev/sda2 formatted to ext4 with 403.17GB ---> Intended /home partition
/dev/sda3 as the swap partition with 4096MB
Once Gparted has created the partitions, right click on the swap partition and select 'swapon' from the context menu.
Use Gparted to activate the swap
Close Gparted and open a terminal.

Use the terminal to type the commands presented below.
Mounting your /root partition
sudo mkdir /mnt/gentoo
sudo mount /dev/sda1 /mnt/gentoo
cd /mnt/gentoo
Remember to mount your intended /root partition as /mnt/gentoo. In my case, /dev/sda1
Download and extract Stage3 tarball
Modify the mirrors if necessary, You can find the list of mirrors here, http://www.gentoo.org/main/en/mirrors2.xml
sudo wget -r -l1 -H -t1 -nd -N -np -A.bz2 -erobots=off http://gentoo.virginmedia.com/releases/amd64/autobuilds/current-stage3/
sudo tar xvjpf stage3-*.tar.bz2
Download and extract portage tarball
sudo wget http://gentoo.virginmedia.com/snapshots/portage-latest.tar.bz2
sudo tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
Modify your make.conf to suit your system
sudo nano -w /mnt/gentoo/etc/make.conf
Chrooting into Gentoo
sudo cp -L /etc/resolv.conf /mnt/gentoo/etc/
sudo mount -t proc none /mnt/gentoo/proc
sudo mount -o bind /dev /mnt/gentoo/dev
sudo chroot /mnt/gentoo /bin/bash
The use of sudo is now no longer required!
env-update
source /etc/profile
export PS1="(chroot) $PS1"
At this point you have successfully chrooted into your Gentoo environment. Just follow the Gentoo Handbook to complete your install.
Remember to replace step 10.d with the following,
Rebooting the system
exitMisc Notes
cd
sudo umount /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
sudo reboot
If you do decide to follow my partition setup, remember to add an entry in the /etc/fstab for the /home partition and enable ext4 in the kernel.
Enjoy Gentoo!


At least for me, it does not work on amd64.
ReplyDeleteMostly because of the chroot.
Nice tutorial, it helped me a lot. Good idea to install from full featured live CD instead of small text based one that gentoo provide :) . for chroot for x64 installation need to be from x64 live cd ...
ReplyDeleteThanks for the comments, I will modify the post to add some clarity concerning the 32/64 bit chroot.
ReplyDeleteYou cannot chroot from a 32bit system into a 64bit /bin/bash/ ... think about that.
ReplyDelete@ JD, that was the intended logic behind the "Important rule" statement.
ReplyDelete"This guide also assumes you wish to install Gentoo 64-bit, 32-bit users must modify steps accordingly"
If this statement in combination with the above important rule failed to imply I was using a 64-bit Ubuntu CD to install a 64-bit Gentoo then I am sorry.
I shall have to re-write this blog post and make it more fool proof.