you can install gentoo when ubuntu/linux running

I’m gonna walkthrough the process of installing gentoo on other destro.

It requires, patients, little bit knowledge about Linux.

Prepare a partition for Gentoo

Make a separate partition for gentoo, you can do partition with gnu parted.

$ sudo parted

Lets say you have following partition table before you install gentoo,

(parted) p

Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                  Flags
1      20.5kB  210MB   210MB   fat32        EFI system partition  boot
2      2048MB  57.0GB  55.0GB  hfs+         Customer
3      67.4GB  67.9GB  500MB   linux-swap
4      67.9GB  80.0GB  12.1GB  ext3

use print free to print free space also,

(parted) print free

Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                  Flags
17.4kB  20.5kB  3.07kB  Free Space
1      20.5kB  210MB   210MB   fat32        EFI system partition  boot
210MB   2048MB  1838MB  Free Space
2      2048MB  57.0GB  55.0GB  hfs+         Customer
57.0GB  67.4GB  10.4GB  Free Space
3      67.4GB  67.9GB  500MB   linux-swap
4      67.9GB  80.0GB  12.1GB  ext3
80.0GB  80.0GB  950kB   Free Space

In the my partition table you can observe that i have 10.4GB Free Space starting from 57.0GB to 67.GB.
(parted) mkpart gentoo 57.0GB 67.4GB

Where, gentoo is just a parition name, followed by start location and end location of the new partition.

Now, again have a look at new parition table here,

(parted) p

Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                  Flags
1      20.5kB  210MB   210MB   fat32        EFI system partition  boot
2      2048MB  57.0GB  55.0GB  hfs+         Customer
5      57.0GB  67.4GB  10.4GB               gentoo
3      67.4GB  67.9GB  500MB   linux-swap
4      67.9GB  80.0GB  12.1GB  ext3

heh, gentoo parition is set.

Now make a file system (ext3),

$ sudo mke2fs -j /dev/sda5
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
636480 inodes, 2536261 blocks
126813 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2600468480
78 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Lets, check with parted if the file system is successfully created.

$ sudo parted
GNU Parted 1.7.1
Using /dev/sda
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) p

Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                  Flags
1      20.5kB  210MB   210MB   fat32        EFI system partition  boot
2      2048MB  57.0GB  55.0GB  hfs+         Customer
5      57.0GB  67.4GB  10.4GB  ext3         gentoo
3      67.4GB  67.9GB  500MB   linux-swap
4      67.9GB  80.0GB  12.1GB  ext3

All set go, my gentoo parition is ready. By the way, you can use Ubuntu’s Swap parition for the same.

Mount the new gentoo parition,

$ sudo mkdir /mnt/gentoo

$ sudo mount /dev/sda5 /mnt/gentoo

Get Gentoo Stage3 tarball : Using a Stage from the Internet

$ cd /mnt/gentoo

You can get Stage3 tarball from here

http://www.gentoo.org/main/en/mirrors.xml

Select nearest server from you. I feel Netherlands is nearest to India. So, i got from here http://mirror.muntinternet.net/pub/gentoo/releases/x86/2008.0_beta2/stages/ (i strongly recommend you not to use this link, get the latest release Stage3 tarball)
Directory structure for Stage3 tarball : releases > x86 > latest_version (Ex: 2008.0_beta2) > stages > Download file which has this format - stage3-x86-GENTOO_VERSION.tar.bz2 (Ex: stage3-x86-2008.0_beta2.tar.bz2)

Here is the Direct link : http://mirror.muntinternet.net/pub/gentoo/releases/x86/2008.0_beta2/stages/stage3-x86-2008.0_beta2.tar.bz2 ( as i said it is always recommended you not to use this link, get the latest version of stage3 tarball ).

Make sure, you download stage3 tarball to /mnt/gentoo directory. Then extract tarball,

# tar xvjpf stage3-*.tar.bz2

It’ll take a few seconds to extract. Read the tar manual page for tar options, Make sure you don’t miss any options from above.

Gentoo Portage

Also download gentoo portage snapshot from the mirrors,You can find it in the snapshot folder (http://mirror.muntinternet.net/pub/gentoo/snapshots/)

Download portage-latest.tar.bz2 file to /mnt/gentoo.

Extract the Portage to /mnt/gentoo/usr ,

tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

make.conf

Set CFLAGS, CXXFLAGS

CFLAGS="-O2 -march=nocona -pipe"
CXXFLAGS="${CFLAGS}"

also add these lines to make.conf
MAKEOPTS="-j3"

VIDEO_CARDS="i810 vesa"

INPUT_DEVICES="keyboard mouse synaptics evdev"

Chrooting

Before Chrooting into gentoo,
Copy DNS info
# cp -L /etc/resolv.conf /mnt/gentoo/etc/

Mount proc
# mount -t proc none /mnt/gentoo/proc

Mount All Devices to gentoo
# mount -o bind /dev /mnt/gentoo/dev

Also, add these lines to make.conf file

GENTOO_MIRRORS="http://gentoo.cites.uiuc.edu/pub/gentoo/ \
                http://gentoo.osuosl.org/ \
                http://gentoo.chem.wisc.edu/gentoo/"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"

Now enter into the new (Gentoo) Environment.

# chroot /mnt/gentoo /bin/bash
# env-update
>> Regenerating /etc/ld.so.cache...
# source /etc/profile
# export PS1="(chroot) $PS1"

Update the portage tree...
# emerge --sync

emerge gentoo-source

Apply mactel patches to the kernel, if you are using MacBook.

And the rest of the things are similar.

Resources:
gentoo-wiki.org
gentoo handbook
forums.gentoo.org
http://google.com/searchq?=gentoo+macbook
Posted on Jul 17, 2008
Written byAbhinay Omkar