Gentoo linux install guide

Intro

So you want to install Gentoo Linux.

The first thing you want to know is that its a very hands on Linux distribution, its not easy.

Gentoo takes a long time to install because you’re building everything from source and it’s being built for YOUR computer.

This guide is set up for a very basic Linux system, nothing else like kde or gnome, thats up to you.

It’s setup not to give you to much information, but enough to make the right choices needed to get the system up and running.

The Official Gentoo Linux install guide is more Links here x86 or amd64

But its way to much information for most people.

Basic guide lines:

  1. READ EVERYTHING, don’t skip around. don’t skim the text, but do read the whole thing once to get an idea whats going on.

  2. Use your brain! Stop and think about what its saying.

  3. If you have a problem, try to solve it yourself by using the forum or wiki.

You’re going to need some sort of Linux Live CD.

This can be the Gentoo Live CD or any other, it doesn’t really matter as long as it’s running current Linux Kernel.

You can get the minimal Gentoo Live-CD more Links here x86 or amd64.

NOTE: If you’re going to do a 64bit install, you’re going to need a livecd that is 64bit.

The Basics

Next you need to know what type of hardware is in your computer.

The most basic thing you need to know is if your hard drive is SATA or the old 80pin style.

If its SATA remember this > sda

If not > hda

Second thing is, do you have winblows already installed on this hard drive? If so YOU need to partition it with a windows program like partition magic.

There is a free partition Live-CD called GParted, you can download it from here
If you do this your going to need around 10GB of disk space for /(root) and a swamp hard drive space. And you do not need to format it or anything just leave it “raw” or unused.
You can have /boot on the same partition as the / (root) or make 3 different partitions.

The Partitions

Boot to the Live CD, If you cant get this far, go back to windows.
For any other Live CD you want to get to a term, and from that term you need to get to root, it should have a # sign.
For a lot of Live CD’s to get root: sudo su -

If you have more then one hard drive, the “a” part on sda or hda will changed based on which drive you’re going to use.
a = the 0 hard drive, 0 in the Linux would pretty much means the first.
For this step hda1 is going to mean the first partition, on the first hard drive.

So if your going to install Gentoo on the 2nd hard drive it would be hdb or sdb.

If you already have windows installed, your going to need to shift one number higher on the partitions.
Windows will be on hda1 or sda1, so you need to start with the number 2 for the partitions.
This next part will be permanent so choose wisely.

fdisk /dev/**(hda or sda)**
n
p
1
[enter]
+25M
n
p
2
[enter]
+256M **(Its up to you, but the max is +4096M)**
n
p
3
[enter]
[enter]
p **(view to make sure everything looks good so far)**
t
2
82
a
1
**(last chance to back out)**
w

Formatting

Remember if you already have a partition, you need to +1 on the partition numbers.
Also note if your using a SATA drive its not going to be hda, its going to be sda.

mke2fs /dev/hda1
mke2fs -j /dev/hda3
mkswap /dev/hda2
swapon /dev/hda2
mkdir /mnt/gentoo
mount /dev/hda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/hda1 /mnt/gentoo/boot
cd /mnt/gentoo

Basic Package Setup

The date format is a bit weird but here is the format:
date MMDDhhmmYYYY syntax (Month, Day, hour, minute and Year)

Try to get the time as close as possible.

This would be a very good time to see if your internet connection is working.

Try: ifconfig

Look for eth0 or eth1, they should have an IP address, if not, run: net-setup

Try: ping www.google.com

If that doesn’t work, you may have to try another Live CD or something else isn’t right on your network.

If you’re thinking of going 64bit, and its you’re first time installing Gentoo, go i686 aka x86.

Most proprietary software will not work right, or work at all in 64bit.

date 120114032006
wget http://distfiles.gentoo.org/releases/x86/autobuilds/current-stage3/stage3-i686-20121213.tar.bz2

If your going to do a 64bit install use this next line

wget http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3/stage3-amd64-20130130.tar.bz2

[More Links here] (http://www.gentoo.org/main/en/mirrors.xml)

tar xvjpf stage3-*.tar.bz2

wget http://distfiles.gentoo.org/releases/snapshots/current/portage-latest.tar.bz2
tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

Or

wget http://distfiles.gentoo.org/releases/snapshots/current/portage-latest.tar.xz
tar xf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

mount -t proc none /mnt/gentoo/proc
cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

Gentoo Env Setup

This part will setup how you want to run your system.

If setup the right way the first time, you shouldn’t have any issues.

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

mkdir -p /etc/portage
echo "sys-libs/glibc nptl nptlonly" >> /etc/portage/package.use

rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/America/ **(hit tab for a list)** /etc/localtime

nano /etc/conf.d/hostname **(you can leave this at localhost, this is your computer name)**
nano /etc/conf.d/clock **(set this to local)**
nano /etc/locale.gen **(Only enable en_US ISO-8859-1 and en_US.UTF-8 UTF-8 (remove the #))**

make.conf this will make or break your system.

Missing 1 character will mess up your system or it wont even build.

If your CPU supports SSE3 add -msse3 to your CFLAGS line

Even more information here

CHOST=”i686-pc-linux-gnu” If you want a 32bit Install

CHOST=”x86_64-pc-linux-gnu” If you want a 64bit Install

Once your CHOST is set NEVER CHANGE IT!

This is also the part wher you make the choice on if you want a 64bit install of Gentoo or not.

You can have a 64bit cpu running only x86/i686(32bit) code, there are a few pluses for this reason, like Flash and codec video/audio support.

ACCEPT_KEYWORDS=”x86” if your chost is i686-pc-linux-gnu

ACCEPT_KEYWORDS=”amd64” if your chost is x86_64-pc-linux-gnu

MAKEOPTS=”-j2” This is core/cpu + 1, so a single cpu/core 2, dual core 3.

INPUT_DEVICES=”keyboard mouse evdev”

All possible options:
keyboard mouse acecad aiptek calcomp citron digitaledge dmc dynapro elo2300 elographics evdev fpit hyperpen jamstudio joystick magellan magictouch microtouch mutouch palmax penmount spaceorb summa synaptics tek4957 ur98 vmmouse void wacom

VIDEO_CARDS=”nvidia” fglrx for ATI video cards

All possible options:
nvidia apm ark chips cirrus cyrix dummy fbdev fglrx glint i128 i740 i810 imstt mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo

The USE Flags.

There are already some global USE flags already set.

1 rule: In Gentoo always check your USE flags before installing anything. -pv OR -av

2 rule: If you dont know what the USE flag does/is for don’t enable it.

Theres so much information about USE flags here
Make sure you READ IT ALL!
THIS is the master list of all use flags, which is very usefull

nano -w /etc/make.conf

**( use settings from above )**

#LDFLAGS="-Wl,-O1 -Wl,--as-needed" **(l=L and its the letter O one)**
#dont include the LDFLAGS unless you know what your doing.
CFLAGS=""
CHOST=""
CXXFLAGS="${CFLAGS}"
ACCEPT_KEYWORDS=""
MAKEOPTS="-j2"
INPUT_DEVICES="keyboard mouse evdev"
VIDEO_CARDS=""
FEATURES="parallel-fetch ccache"
LINGUAS="en"

USE="X bzip2 threads -ldap" **( Use these and keep these, DO NOT add anymore untill you reboot. )**
**( For 64bit installs include the multilib useflag in the USE line )**

BASE COMPILE

This part will take 2-3 hours, its about 83 packages.

emerge --sync
emerge portage
emerge -epv world
**( These are your base packages, and their use flags. DONT set any useflags. Just use the defaults for now. )**
emerge -uDN world
emerge sys-libs/libstdc++-v3 **( This will save you a headache later. )**

If your getting blocked packages like e2fsprogs, ss, and com_err.
Do this:

emerge -fuD e2fsprogs
emerge -C e2fsprogs e2fsprogs-libs ss com_err
emerge e2fsprogs

You can thank the Gentoo devs for not putting out a 2008.2

Kernel Compile

For now you can use this guide to build your kernel.

Gentoo Handbook- Kernel Section

If you use genkernel, your grub setup will be different.

I will make a kernel section soon on this site, its a very tricky thing to do, but it will be done.

The basic way of doing it is:

cd /usr/src/linux
make menuconfig
make
make modules_install
cp arch/i386/boot/bzImage /boot/bzImage

Some people have asked me to make a kernel guide, well that is a lot of work every single release of the kernel.

Every kernel version the layout changes, sometimes a little, sometimes a lot.

The main thing you want to keep in mind is the commands: dmesg and lspci they will help you a lot in your config.

Grub and fstab

If you have windows on hda1, its going to be hd0,0 for root

Also if you did your install on hdb its going to be hd1,0

Also if your using SATA use sda not hda

If you need more help

emerge grub

grub
root (hd0,0) **(hd0 is first bootable harddrive, ,0 is first partition)**
setup (hd0)
quit

nano /boot/grub/grub.conf
#-------------------------------------------------
default 0
timeout 30
title Gentoo
root(0,0)
kernel /boot/bzImage root=/dev/hda3

# Only in case you want to dual-boot
title=Windows XP
rootnoverify (hd0,1) **#(This could be different)**
makeactive
chainloader +1
#-------------------------------------------------

cd /boot/
ln -s boot . **(yes that is a dot)**
cd /

nano /etc/fstab
#-------------------------------------------------
/dev/hda1    /boot    ext2    noauto,noatime    1 2
/dev/hda3    /    ext3    noatime    0 0
/dev/hda2    none    swap    sw    0 0

#-------------------------------------------------

Services and Final setup

How to setup your network if you want to setup a static IP and or other configurations read this page.

emerge dhcpcd vixie-cron syslog-ng mirrorselect

rc-update add net.eth0 default
rc-update add vixie-cron default
rc-update add syslog-ng boot
rc-update add sshd default

mirrorselect -s4 -D -H -o >> /etc/make.conf

passwd

adduser -g users -G wheel,cron,cdrom,users,audio -m **your_user_name**
passwd **your_user_name**

You can really screw up your install with /etc updates.

This is just a few things you DO NOT UPDATE with dispatch-conf or etc-update.

Anything YOU edited in /etc/conf.d

/etc/fstab

/etc/rc.conf

/etc/make.conf

Use your brain when updating or editing anything in /etc

etc-update **OR** dispatch-conf

cd /
umount /mnt/gentoo/boot
umount /mnt/gentoo/proc
umount /mnt/gentoo **(Might not unmount, its ok)**
reboot

A Few Last Things…

If your going to install kde use ‘emerge -av kdebase-meta’

Same with gnome use ‘emerge -av gnome-light’

This will save you A LOT of time. It will install just the basics.

Always check and set your use flags before you install or update anything.

I don’t know how much I can stress this fact. You will have to repeat -pv after you change your use flags because they may have added more packages to the listing, which they have use flags.

Comments