Table of Contents

Gentoo Linux

Gentoo Linux is a flavor of GNU/Linux operating system that aims to be the most flexible, optimized and adaptive distribution out there. It does this by compiling almost everything from pure source code, compiling things with your particular hardware's capabilities in mind. It also gives a very fine level of control over exactly what features get built into each piece of software you install, so ideally you can end up with a system that is custom-made for your needs, with none of the extra baggage that pre-compiled distributions come with.

With great control over your system however comes great responsibility. Gentoo requires a level of engagement and attention to detail that is an alien concept to Windows and Mac users, and its a simple matter to start breaking things with a sloppy keystroke. That said, the community of developers and users behind Gentoo is top-notch, and support is always available through message boards and via IRC channels. Overall, I think Gentoo has been my best experience with Linux, as it offers full access to all of Linux's best capabilities, while encouraging the user to be proactive and involved in maintaining their computer's state.

AMD64 Install

The following is an overview of an installation of Gentoo Linux on an AMD64 system. While the very basic Gentoo installation instructions are well-documented and available online, there are several gotcha's–some hardware-related and some not–which stopped me dead in my tracks. The instructions have been organized and edited so that I should be able to follow them to the letter and get a working, complete Gentoo system with X and web services running.

Base System

Set root password

passwd

Configure disks

fdisk /dev/hda

Format partitions

mke2fs -j /dev/hda1
mke2fs -j /dev/hda3

Make and enable swap

mkswap /dev/hda2
swapon /dev/hda2

Mount new partitions

mount /dev/hda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/hda1 /mnt/gentoo/boot

Check date

date

Move to new Gentoo mountpoint (new root)

cd /mnt/gentoo

Download stage 3 tarball from “releases” and portage “snapshot”, then untar both.

links http://www.gentoo.org/main/en/mirrors.xml
tar xvjpf stage3-*.tar.bz2
tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr > /dev/null

Compile options

nano -w /mnt/gentoo/etc/make.conf
CFLAGS="-march=native -o2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j3"
USE="cairo cjk gd gnome graphviz gtk -kde mmx nvidia opengl -qt3 -qt4 samba simplexml sqlite sse sse2 svg unicode X xorg xml xsl xvmc"
INPUT_DEVICES="evdev"
VIDEO_CARDS="nvidia nv"

Select mirrors

mirrorselect -i -o >> /mnt/gentoo/etc/make.conf

Mount proc and dev

mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev

Copy DNS info

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

Enter new environment

chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile

Configure portage

emerge --sync --quiet

Select system profile

eselect profile list
eselect profile set #

Set locale(s)

nano -w /etc/locale.gen
locale-gen

Set timezone

ls /usr/share/zoneinfo
cp /usr/share/zoneinfo/Japan /etc/localtime

Emerge Gentoo kernel source

emerge gentoo-sources

Confirm kernel link (ie: linux-2.6.32-gentoo-r7)

ls -l /usr/src/linux

Run menuconfig

cd /usr/src/linux
make menuconfig

Select kernel options

Processor Family Athlon64 X
Executable File Formats / Emulations IA32 Emulation X
File Systems NTFS Support/ Write Support X
File Systems ext4 X
File Systems Fuse X
Network File Systems CIFS X
nVidia Drivers None

Compile kernel and copy

make && make modules_install
update-modules
cp arch/x86_64/boot/bzImage /boot/kernel-2.6.32-gentoo-r7

Set up fstab

nano /etc/fstab
/dev/sda1	/boot	ext3	noauto,noatime	1 2
/dev/sda3	/	ext3	noatime	0 1
/dev/sda2	none	swap	sw	0 0
/dev/cdrom	/mnt/cdrom	auto	noauto,ro	0 0
proc	/proc	proc	defaults	0 0
shm	/dev/shm	tmpfs	nodev,nosuid,noexec	0 0

Set host name

nano -w /etc/conf.d/hostname
HOSTNAME="gentoo"

Configure network

nano -w /etc/conf.d/net
config_eth0=( "dhcp" )
rc-update add net.eth0 default

Set password

passwd

Add user

useradd -m -G users,audio,wheel kououken

Edit rc.conf

nano -w /etc/rc.conf
UNICODE="yes"
XSESSION="Gnome"

Set Keymap

nano -w /etc/conf.d/keymaps
KEYMAP="jp106"

Timezone

nano -w /etc/conf.d/clock
TIMEZONE="Japan"

Install system logger

emerge syslog-ng
rc-update add syslog-ng default

Install cron daemon

emerge vixie-cron
rc-update add vixie-cron default

Install DHCP Client

emerge dhcpcd

Install grub

emerge grub
nano -w /boot/grub/grub.conf
  root (hd0,0)
  kernel /boot/kernel-2.6.32-gentoo-r7 root=/dev/sda3
grub --no-floppy
  root (hd0,0)
  setup (hd0)
  quit

Reboot

exit
cd
umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
reboot

Users

Add normal user

useradd -m -G users,wheel,audio,video -s /bin/bash kououken
passwd kououken

Server Stuff

Install openSSH

emerge openssh
rc-update add sshd default

Install Apache

emerge apache
rc-update add openssh default

Install PHP

nano /etc/portage/package.use
	dev-lang/php apache2

Install web tools

emerge graphviz
emerge pecl-fileinfo

Virtual Hosts

Files

Mount data drive

mkdir /mnt/data
nano /etc/fstab
	/dev/sdb1	/mnt/data	ext4	noatime 0 1

Install Samba

emerge samba
rc-update add samba default

Configure shares

nano /etc/samba/samba.conf

X Stuff

Install XDM

emerge xdm

Install HAL

emerge hald

Set user's default xinitrc

nano /home/kououken/.xinitrc
	export XDG_MENU_PREFIX=gnome-
	exec gnome-session

Install video drivers

emerge nvidia-drivers
nano /etc/modules.autoload.d/kernel-2.6
	nvidia
update-modules
nvidia-xconfig
	glx
eselect opengl set nvidia

Gnome

Install Gnome light

emerge gnome-light
etc-update
revdep-rebuild

Install more gnome stuff

emerge seahorse gst-plugins-good gnome-media sound-juicer eog file-roller gcalctool gconf-editor gdm gedit gnome-applets gucharmap gnome-utils gnome-system-monitor gnome-netstatus gnome-nettool brasero vino gnome-screensaver alacarte vinagre swfdec-gnome 
emerge

Install IME

emerge anthy
emerge uim
env-update
source /etc/profile

Maintenance

Perl Cleaner

perl-cleaner --reallyall

Emerge

emerge --sync
emerge -uDp world
emerge -uD world
revdep-rebuild
eclean distfiles

Kernel Updates

When emerge finds a newer kernel to use.

eselect kernel list
eselect kernel set #
cd /usr/src/linux
make menuconfig
make && make modules_install
cp arch/x86_64/boot/bzImage /boot/bzImage-#.#.#-gentoo-r#

Then make a grub entry for the new kernel.

Kernel Options

CONFIG_SYSVIPC=y