Gentoo Power Setup
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
What is this? This is a very concise guide for bootstrapping Gentoo which avoids information redundant and superfluous to power users.
Method - Starting from a stage3 environment, we first recompile the toolchain (twice) and, if there were any major upgrades in it, also everything else (once). For an easy control of the different steps involved, an emerge wrapper script is used.
Advantages - Succinctness?
Check out the links at the bottom for details and credits.
Contents |
[edit] Preliminaries
Download, burn and boot the “Gentoo Minimal CD” matching your architecture.
[edit] Net setup
Configure network access if it has not yet been done for you.
# net-setup eth0 or simply # dhcpcd
Remote Console Access
# passwd # /etc/init.d/sshd start Use putty or ssh...
[edit] Hard disk configuration
hdparm (not for sata drives)
# hdparm /dev/{hdisk}
# hdparm -i /dev/{hdisk}
# hdparm -a64A1c1d1m16u1 /dev/{hdisk}
# hdparm -d1c1u1 /dev/{cd-drive}
partitioning (fdisk)
A nice partitioning scheme could look like this: 32MB for /boot, more than your RAM for swap (useful for hibernation), a good 10GB for / and whatever you want for /home.
Filesystems
# fdisk -l # mkfs.ext2 /dev/BOOT # mkswap /dev/SWAP # mkfs.reiserfs /dev/ROOT # mkfs.reiserfs /dev/HOME
Mount partitions
# mount /dev/ROOT /mnt/gentoo # cd /mnt/gentoo # mkdir boot && mount /dev/BOOT boot # mkdir home && mount /dev/HOME home # swapon /dev/SWAP
[edit] Setting up the stage3 environment
date and time
# date MMDDhhmmYYYY
stage3 and portage files
# links2 http://www.gentoo.org/main/en/mirrors.xml
stage3 tarball
# md5sum -c stage3-{ARCH}-{RELEASE}.tar.bz2.DIGESTS
# tar xvjpf stage3-{ARCH}-{RELEASE}.tar.bz2
portage snapshot
# md5sum -c portage-{DATE}-.tar.bz2.md5sum
# tar xvjf portage-{DATE}-.tar.bz2 -C /mnt/gentoo/usr
choose fastest mirrors
# mirrorselect -s4 -D -o >> /mnt/gentoo/etc/make.conf # mirrorselect -r -i -o >> /mnt/gentoo/etc/make.conf
dns, proc, dev, chroot, date, timezone
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf # mount -t proc none /mnt/gentoo/proc # mount -o bind /dev /mnt/gentoo/dev # chroot /mnt/gentoo /bin/bash # env-update # source /etc/profile # rm /etc/localtime && ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime # date MMDDhhmmYYYY
sync, check profile and update portage
# emerge --sync # ls -FGg /etc/make.profile # ln -snf /usr/portage/profiles/default/linux/ARCH/PROFILE /etc/make.profile # emerge portage
[edit] Initial configuration
make.conf
...
CFLAGS="-march=native -O2 -pipe" # a good and sound choice for cflags
# CFLAGS="${CFLAGS} -fomit-frame-pointer -fno-ident" # a little "cleanup"
# CFLAGS="${CFLAGS} -fweb -frename-registers" # some amd64 tweaking; may or may not be safe.
# CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden" # a little tweak for C++ code
MAKEOPTS="-j3"
ACCEPT_KEYWORDS="amd64"
USE="nptl nptlonly acpi -apm unicode crypt -qt -kde -gnome alsa -oss -esd -arts"
FEATURES="parallel-fetch ccache"
AUTOCLEAN="yes"
EMERGE_DEFAULT_OPTS="--with-bdeps y" # considers also build-time deps at dependency calculations
...
Note: “march” should match your cpu (see “man gcc” for options). Makeopts should match the number of cpu-cores in your system plus one. “Accept keywords” should match your architecture. The "mtune" cflag is unecessary because implied by "march".
+ Cflags + Safe Cflags
/etc/portage/package.keywords (substitute “~amd64” with your keyword of choice)
sys-devel/binutils ~amd64 sys-devel/binutils-config ~amd64 sys-devel/gcc ~amd64 sys-devel/gcc-config ~amd64 sys-libs/glibc ~amd64
/etc/portage/package.use
sys-devel/libperl ithreads dev-lang/perl ithreads
locales
# nano /etc/locale.gen
en_GB ISO-8859-1
en_GB.UTF-8 UTF-8
de_DE ISO-8859-1
de_DE.UTF-8 UTF-8
# locale-gen
[edit] Power on!
Now let's recompile our system by using hielvc's emerge wrapper. You can get the emwrap.sh script here (or here). Check out the later posts on this thread for information about using emwrap.sh to keep your system up-to-date.
for extra caution: update system packages before rebuilding the toolchain
# ./emwrap.sh -uDNs
upgrade toolchain and remove the old gcc (unless you need it as a fallback option)
# ./emwrap.sh -est # emerge gcc --prune --ask
recompile system + world - toolchain if any of the latter's components experienced a major update
# ./emwrap.sh -esw
if not, this command should be enough
# ./emwrap.sh -uDNw
Update your configuration files
# etc-update
[edit] Basic world setup
linux kernel (download, configure, install)
# emerge gentoo-sources
+ Kernel Sources +Kernel/genkernel
note on genkernel and sata drives
Try using the --disklabel option for genkernel kernel config and use this as the UUID with the loader: real_root=UUID=xxxxxx-xxxxx-xx-xxx
# blkid
additional system packages (important)
# emerge grub dhcp acpid
additional system packages (optional)
# emerge syslog-ng reiserfsprogs alsa-utils ccache gentoolkit
[edit] Basic configuration
# echo “127.0.0.1 mypc.mydomain mypc localhost” >> /etc/hosts # nano /etc/fstab # nano /etc/rc.conf # nano /etc/conf.d/ALMOSTEVERYTHING
splash screen (also the eye needs some candy)
# emerge splashutils splash-themes-livecd # splash_geninitramfs -v -r 1400x1050 -g /boot/fbsplash_gentoo gentoo
+ Fbsplash
rc-update
add needed and remove unnecessary rc-scripts
setup grub (personalize kernel filename and disk drives)
/boot/grub/grub.conf
title Gentoo root (hd0,1) kernel /my_kernel root=/dev/ROOT video=vesafb-tng:1400x1050-32@60,mtrr,ywrap splash=silent,theme:gentoo quiet CONSOLE=/dev/tty1 initrd (hd0,1)/fbsplash_gentoo
# grep -v rootfs /proc/mounts > /etc/mtab # grub --no-floppy grub > root (BOOT) (mind the different naming grub > setup (YOURHDD) scheme used in Grub) grub > quit
users
# passwd root # useradd -m -g users -G wheel,audio,tty,games,cdrom,usb,video -s /bin/bash don4lfonso # passwd don4lfonso
[edit] Reboot!
# exit && cd / && umount -a && swapoff /dev/SWAP && init 6
[edit] Credits & Links
Many thanks for ideas and contributions go to the whole Gentoo community (you're great!), specifically to hielvc for his nice emerge wrapper and to rac for his ideas about installing Gentoo. And many thanks go, of course, also to those people which inspired them.
- Gentoo Handbook: the official installation guide
- Gentoo Forums: A more robust installation method (rac)
- Gentoo Forums: An emerge wrapper for more correctly building the toolchain (hielvc) see also page 26
- Gentoo Forums: Stage 1/3 Installation Guide for 2005.0 and GCC 3.4.4 (BobP)
- Gentoo Forums: Why multiple "emerge -e world" are actually useless
