Installing G e n t o o  (Quick & Dirty from Knoppix, x86-Architecture)
 
v6.7.29




Section 1: creating a partition and filesystem


1. boot Knoppix, start a root-shell

2. run cfdisk and make a primary linux partition

3. apply filesystem to bootable partition: mkfs.xfs /dev/[partiton]

4. create mount-point: mkdir /mnt/gentoo

6. mount installation partition: mount /dev/[partition] /mnt/gentoo




Section 2: installing gentoo files

1. enter mountpoint: cd /mnt/gentoo

2.
download latest installation-files using wget -c [URL] into current directory located inside:

a) .../releases/x86/current/stages/ (get the newest stage2-file according to your architecture)

b) .../snapshots/ (get the current portage-file)

3. decompress the installation files:

a) first the stage-file: tar -xvjpf stage*

b) then the portage-file: tar -xvjpf portage* -C usr/

4. copy the DNS info: cp -L /etc/resolv.conf etc/

5. enter new environment with the consecutive commands:

a) mount --bind /proc proc/

b) chroot . /bin/bash

c) env-update

d) source /etc/profile


when a problem with dependancies appears, try to "emerge --oneshot --nodeps" the package beeing blocked




Section 3: compiler options and building the system

1. use this template: cp /etc/make.conf.example /etc/make.conf then edit:

a) customize the global USE line like: "X gtk2 alsa nptl nptlonly -gnome -kde -arts"

- for a complete list do: less /usr/portage/profiles/use.desc

b) customize the CHOST line:

"i386-pc-linux-gnu" - Intel 80386DX
"i486-pc-linux-gnu" - Intel 80486DX
"i586-pc-linux-gnu" - Intel PI, AMD K5/K6/K6-II/K6-III, VIA C3 , IDT Winchip
"i686-pc-linux-gnu" - Intel PII/III/IV, AMD Duron/Sempron/Athlon-XP, AMD Athlon64/Turion/Opteron in 32bit mode

c) customize the CFLAGS line:

- use the flag "-O3" (maximum performance, larger binaries) or "-Os" (nice performance, smallest binaries)

- add "-pipe" and "-march=[arch]" matching your architecture:

"i386" - Intel 80386DX+
"i486" - Intel 80486DX+
"i586", "pentium" - Intel Pentium I (without MMX) and AMD K5
"pentium-mmx" - Intel Pentium I (with MMX)
"i686", "pentiumpro" - Intel Pentium Pro and all equal
"pentium2" - Intel Pentium II and Celeron 'Mendocino'
"pentium3", "pentium3m" - Intel Pentium III and Mobile and Celeron 'Coppermine'
"pentium-m" - Intel Centrino
"pentium4", "pentium4m" - Intel Pentium IV and Celeron 'Willamette'
"prescott" - Intel Pentium IV and Celeron 'Prescott'
"nocona" - Intel Xeon 'Nocona' and Pentium4 with EM64T
"k6" - AMD K6
"k6-2", "k6-3" - AMD K6-II and K6-III
"athlon", "athlon-tbird" - AMD Athlon and Athlon 'Thunderbird'
"athlon-4", "athlon-xp", "athlon-mp" - AMD Athlon4 and Sempron/AthlonXP and Athlon MP
"athlon64", "athlon-fx", "opteron" - AMD Athlon64 and AthlonFX and Turion and Opteron
"winchip-c6" - IDT Winchip 'C6'
"winchip2" - IDT Winchip II
"c3" - VIA C3
"c3-2" - VIA C3 II

d) uncomment the CXXFLAGS

e) set MAKEOPTS to "j[x]“ (x should be the number of CPUs/Cores + 1)

f) set PORTAGE_NICENESS to "19" (so it does not slowdown other processes)

g) set AUTOCLEAN to "yes"

2. do portage tree update: emerge --sync (do not update portage yet, even if asked to do so)

3. do: emerge -e system && emerge -DN world

4. finally do: etc-update


Section 4: configuring the system

1. set the timezone, clock and console-keymap:

a) look inside /usr/share/zoneinfo/ after your timezone (like CET for "central european time")

- do: ln -sf /usr/share/zoneinfo/[myzone] /etc/localtime

b) now edit the file "/etc/conf.d/clock"

- set CLOCK to "local"

- set CLOCK_SYSTOHC to "yes"

c) edit the file "/etc/conf.d/keymaps"

- set KEYMAP to your country-code (e.g. "de" for german)

- set EXTENDED_KEYMAP if you want use some special keys (e.g. "euro" for €)

2. setting filesystem information:

- edit the "/etc/fstab" file similar to this example:

#<fs> <mountpoint> <type> <opts> <d/p>
/dev/[part1] / xfs noatime,noatime 0 1
/dev/cdroms/cdrom0 /mnt/dvd iso9660 noauto,user,ro 0 0 # mounting a Windows partition #/dev/[part2]hda1 /mnt/windows ntfs noauto,user,ro,umask=0222 0 0 # mounting distfiles over Samba #//server/distfiles /usr/portage/distfiles smbfs username=root,gid=portage,passwd=pw 0 0 3. set hostname of your machine, edit "/etc/conf.d/hostname"

4. configuring network:

a) take example and edit: cp /etc/conf.d/net.example /etc/conf.d/net

b) get a DHCP client: emerge dhcpcd

c) activate the first interface at startup: rc-update add net.eth0 default

5. install filesystem tools: emerge xfsprogs

6. set a root password: passwd



Section 5: installing the bootloader

1. do: emerge grub then run: grub

a) inside the GRUB shell type in:

                grub> root (hd0,1) # hda2 partition 
                grub> setup (hd0)  # install GRUB in the MBR of hda
 
(optional)      grub> setup (hd0,1) # install GRUB on the boot-block of partition hda2

                grub> quit  # exit the GRUB shell

b) go to directory “/boot/grub/“, use template: cp grub.conf.sample grub.conf then edit “menu.lst“:

# Boot automatically after 30 secs.
timeout 10

# By default, boot the first entry.
default 0

# Booting GNU/Linux, here from hda2
title Gentoo Linux
root (hd0,1) 
kernel /boot/kernel root=/dev/hda2

# The next lines are only needed if you do dualboot with Windows, here hda1
title MS Windows
rootnoverify (hd0,0)
makeactive
chainloader +1


Section 6: building the kernel

1. get the kernel sources: emerge gentoo-sources

2. compile the kernel:

a) go to “/usr/src/linux“ and do: make menuconfig for kernel-setup

- do not forget to enable:

File systems --->
<*> XFS support

b) compile the kernel: make (if the kernel uses modules [M] also do: make modules_install afterwards)

- move the kernel: mv arch/i386/boot/bzImage /boot/kernel

- backup the configuration file: cp .config /boot/config


3. exit Knoppix for a reboot -> you should now have a working system :)




...to be continued