posted by Dave Scott on Mon 17th Mar 2003 17:36 UTC

"Gentoo vs. the n00b 2, Part II"

After completing your network setup, you should have a working internet connection. Test it to make sure it works by again running the ping command on a website.

Next we need to set up the partitions for installing Gentoo. Do this by running


cfdisk is a very straightforward program. I don't think it needs any explanation for use, but make sure you use the right type for each of your partitions. Gentoo recommends creating a seperate partition for /boot. I did this on my system using the recommended size of 100 MB. Make this partition Type 83, since it will be a regular Linux filesystem (ie. ext2/3, ReiserFS, etc.). Next we need a swap partition, Type 82 (Linux Swap) and size equal to at least as much RAM as installed in your system, but up to twice the available RAM installed. Next is the partition for / (root - this is the partition where Gentoo will actually be installed). Make this as big as you want, but at least 1.5 GB if you are going to be installing any desktop environments (X with KDE, GNOME, E, etc.), and of Type 83 for a Linux filesystem.

Code Listing 6.1 in the install guide gives a command to zero a partition if it previously contained data. This is only necessary to run if you are going to make this partition a different type than it was previously. If it was unformatted, or the type you want previously, you can skip this, as the command to make the filesystem will format the partition.

First, initialize the swap with the command

mkswap /dev/hdaX

(replacing the X with the partition on which your swap is located). Next, we need to make our regular Linux filesystems on /boot and /. I used ext3 for mine and the command for this is

mke2fs -j /dev/hdaX

(replacing X with the partition for /boot). You will need to run this again for the / partition. If you want to use a different filesystem, Code Listings 6.3-6.7 give the commands for the various filesystems.

Next we will mount our new partitions so that we can access and write to them. Follow Code Listings 7.1 and 7.2 to mount your partitions, replacing hdaX with your partition number.

Now, we finally get to start installing stuff. Since we are using the LiveCD, it comes with each of the 3 stages available. I started with a Stage 2 tarball, since I did not want an extra 3 hours to compile gcc, binutils, and the other system tools. Use the command

cd /mnt/cdrom/gentoo



to list the available stages. Now, we need to cd to the /mnt/gentoo directory (which is an alias to what will be / [root] on our system):

cd /mnt/gentoo

Now, unpack your desired stage using tar:

tar -xvjpf /mnt/cdrom/gentoo/stage?-*.tbz2

Then run

mount -o bind /proc /mnt/gentoo/proc

The proc directory contains the devices that are contained on the motherboard (ie. interfaces to the PCI bus, the processor(s), etc.). Next, we will copy our edited resolv.conf file to the new system:

cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

A nice feature of the Gentoo LiveCD is that it comes with GRP (Gentoo Release Packages) files. The GRP files contain pre-built binaries of common packages like KDE, GNOME, Mozilla, OpenOffice, and X. If you don't want to compile these packages (which I didn't because most of these take forever and a day to compile), execute these commands:

mkdir /mnt/gentoo/GRP
mount -o bind /mnt/cdrom/gentoo/packages /mnt/gentoo/GRP

After executing these commands, we will be ready to "enter" our new Gentoo system.

To enter, our new Gentoo system, we need to execute the following:

chroot /mnt/gentoo /bin/bash
source /etc/profile

The first line changes the location of root to be in /mnt/gentoo. The next line regenerates the ld cache, and the last line points the system to the new paths. Now, we are inside our new Gentoo system and we can begin installing software and setting up other hardware.

The first thing we want to do now that we are inside our new Gentoo system, is update the Portage tree so we make sure we are getting the newest packages available. We need to run the following commands to sync the Portage tree, and get the latest version of Portage:

emerge sync
export CONFIG_PROTECT="-*"
export USE="-* bootstrap build"
emerge portage
unset USE

After executing these commands, we will have the latest Portage tree and the latest version of Portage. Next, we need to adjust our /etc/make.conf file which sets global options for compiling packages. Use the nano editor to do this:

nano -w /etc/make.conf

The /etc/make.conf file is well commented, so follow the instructions in the file to edit this to suit your system.

Now, we are ready to start building our system. If you opted to start at a Stage 1 system, you will need to execute these two commands to compile binutils, gcc, gettext, and glibc:

cd /usr/portage

After this process completes (2-4 hours), your system will be equivalent to a Stage 2.

Now we need to merge the system packages. Type

emerge -p system

The -p flag does a "pretend" merge that lists all the packages to be installed, but does not install anything. If this scrolls off your screen, type

emerge -p system | more

so you can scroll through it at your leisure. Once you have taken a look at what the system will merge, execute the same command without the -p flag. This is going to take a long, long, long, long time. Do this before you go to sleep, before you go to work or school, or make sure you have something to keep you occupied for some hours to come (like Medal of Honor: Frontline for the PS2 ;).

Table of contents
  1. "Gentoo vs. the n00b 2, Part I"
  2. "Gentoo vs. the n00b 2, Part II"
  3. "Gentoo vs. the n00b 2, Part III"
e p (0)    36 Comment(s)

Technology White Papers

See More