Jump to content

The DIY Gentoo Linux Guide


likewhoa

Recommended Posts

1. Introduction

 

First of all, welcome to Gentoo. You are about to enter the world of choices and performance. Gentoo is all about choices. When installing Gentoo, this is made clear to you several times -- you can choose how much you want to compile yourself, how to install Gentoo, what system logger you want, etc.

 

Gentoo is a fast, modern meta distribution with a clean and flexible design. Gentoo is built around free software and doesn't hide from its users what is beneath the hood. Portage, the package maintenance system which Gentoo uses, is written in Python, meaning you can easily view and modify the source code. Gentoo's packaging system uses source code (although support for precompiled packages is included too) and configuring Gentoo happens through regular text files. In other words, openness everywhere.

source: gentoo.org

 

1a. Before you begin

This guide is for new and advanced users that wish to try Gentoo Linux and want to know more of the inner workings of Gentoo focusing on implementing Linux Software RAID mdadm & lvm2. This guide will also be utilizing ebuilds found in the Gentoo Overlay toolchain which will provide GNU GCC & BINUTILS alpha packages, GNU Hashstyle implementation will also be used; Furthermore there are a some minimum requirements which must be met before you begin the guide.

 

  1. Users with less than two hard drives. "RAID requirement."
  2. Users with less than 256MB of RAM. "512MB or more is recommended."

 

1b. User Agreement

 

Use of the Gentoo overlays is unsupported by the Gentoo Linux Foundation. The Gentoo Linux Foundation is in no way interested in breaking your system. By following the instructions below, you agree to take full responsibility. You may not blame the author of this guide and its contributors. Help is NOT guaranteed, but will be provided on the basis that you followed directions in this guide alone.

 

1c. Alternatives

 

If you don't meet the requirements above you can just follow the Official Gentoo Linux guide. You can find it here.

 

2. Install Media

 

2a. Gentoo Linux LiveCDs

 

The Gentoo LiveCDs are bootable CDs which contain a self-sustained Gentoo environment. They allow you to boot Linux from the CD. During the boot process your hardware is detected and the appropriate drivers are loaded. They are maintained by Gentoo developers.

 

All LiveCDs allow you to boot, set up networking, initialize your partitions and start installing Gentoo from the Internet.

 

This is a small, no-nonsense, bootable CD, the sole purpose of which is to boot the system, prepare the networking and continue with the Gentoo installation. It does not contain any stages (or, in some cases, a single stage1 file), source code or precompiled packages.

 

For example the amd64 variant of this LiveCD can be found in the releases/amd64/2007.0/livecd/ subdirectory and is called livecd-amd64-installer-2007.0.iso.

 

2b. Alternative LiveCDs

 

The JustBOOT is a customized Gentoo variant LiveCD maintained by me and should be used when dealing with very new hardware. for example some LiveCDs will fail to identify your system's SATA/IDE,Ethernet & WIFI devices; thus using this LiveCD will JustBOOT . You will need to manually pick the LiveCD to download as they are archived by release date.

 

Disclaimer:

JustBOOT LiveCD is NOT affiliated with Gentoo.

USE this liveCD at your own risk.

 

2c. Downloading and Burning the LiveCDs

 

We'll first start by downloading and burning the chosen LiveCD. We previously discussed the available LiveCDs, but where can you find them?

 

You can download the LiveCDs from one of the Gentoo mirrors or via a torrent.

The JustBOOT LiveCD can be found here.

 

Inside that directory you'll find the ISO images. Those are full CD images which you can write on CD-R media. In case you wonder if your downloaded file is corrupted or not, you can check its MD5 checksum and compare it with the MD5 checksum provided (such as livecd-amd64-installer-2007.0.iso.DIGESTS).

 

Check the contents of this file for the MD5 HASH then, You can check the MD5 checksum with the md5sum tool under Linux/Unix or md5sum for Windows.

 

To burn the downloaded ISO(s), you can use ImgBurn but if you are already running Linux, we will discuss cdrecord and K3B here; more information can be found in the Gentoo FAQ.

 

2d. Which LiveCD Architecture?

 

32bit or 64bit? The choice is yours.

If you know for sure that your CPU is 64bit capable then download the 64bit amd64-livecd, otherwise download the 32bit 686-livecd. If you're not completely sure and want to know if your processor is 64bit capable then just download the 686 LiveCD.

 

Keep in mind the following tips

 

  1. Commands begin after the "#" symbol.
  2. 32bit configuration commands will be highlighted in RED
  3. 64bit configuration commands will be highlighted in BLUE
  4. When showing sample configuration files that need to be edited, pay attention to the ones that are in bold; which are the ones I'll be suggesting.
  5. If a command fails, make sure to scroll to the FAQ section, which should have solutions for most common compile errors.
  6. Be patient and follow directions and you will be all right ;)

 

Processors that are 64bit capable

  • Intel Processors in the LGA775 package.
  • Core2Duo models ~2700 series processors.
  • Intel Pentium D 8xx,9xx series processors.
  • AMD Opteron Processors (single/dual-core) in the 1xx,2xxx series.
  • AMD Barcelona Processors.
  • AMD Sempron "E6 (Part No.: *BX)".
  • Processor that shows the "ln" flag with "cat /proc/cpuinfo"

 

2e. Downloading the LiveCD

Below are links to both the Official Gentoo Linux LiveCD and my own customized Linux LiveCD. If the download is to slow for you, go here for a list of mirrors and here for the LiveDVD torrent files. Since we don't need a liveDVD in this guide we will focus on the LiveCDs only.

 

 

32bit Gentoo LiveCD

 

64bit Gentoo LiveCD

 

JustBOOT LiveCD

Pick your download medium here.

 

Burning the LiveCD

 

# cdrecord -v -dao dev=/dev/hdc driveropts=burnfree livecd.iso

Replace /dev/hdc with your CD-RW drive's device path and livecd.iso with the name of your ISO image file. :)

 

With K3B, select Tools→CD→Burn Image. Then you can locate your ISO file within the 'Image to Burn' area. Finally click Start.

 

2f. Booting the LiveCD

 

Important

Read this whole subsection before continuing, as you will probably not have the opportunity to read it before doing things later.

Once you have burned your installation CDs, it is time to boot of the LiveCD.

 

Now reboot with CD in the drive. You should see a boot prompt. At this screen, you can hit Enter to begin the boot process with the default boot options, or boot the LiveCD with custom boot options by specifying a kernel followed by boot options and then hitting Enter. I just boot with "nox" options to skip the X Windows load which will save resources for compiling.

 

3. Installation

 

3a. Starting the SSH Daemon (Optional)

 

Setting up Gentoo is easiest via an ssh session from another machine, allowing you to read (this guide for example) while staying connected to a Gentoo help channel on IRC and being able to browse the net all in a GUI, making life easier in many ways. you can still install Gentoo from 1 machine and still browse the internet in a graphical way using "links -q". I will explain this later in the guide.

 

First let's give the 'virtual' livecd root account a password, since this is auto scrambled by the livecd for security purposes. you can also type:

 

Gain root access.

 

# sudo su

 

Change root password.

 

# passwd

 

Starting the SSHD server.

 

# /etc/init.d/sshd start

 

Run 'ifconfig' and note down the ip address of the system, you will need to 'ssh root@ipaddress' to continue with the installation.

 

3b. Optimizing Media Access (Optional)

Note: SATA only users can skip this section.

 

The un-optimized.

 

# hdparm /dev/hda

 

To set the optimized settings for the livecd do the following.

 

# hdparm -d1c1u1 /dev/cdroms/cdrom0

 

Optional setting.

 

# hdparm -d1c1u1m16 /dev/hda

 

3c. Setting Up the Network

 

2007.0 is stable with loading networking on boot however there will be the odd occasion that you will need to go back to the drawing board and run through the paces manually and setup your networking if you don't have a dhcp server on your network. The utility "net-setup" can be used to automagically setup your network.

 

# net-setup eth0

 

View network settings.

 

# ifconfig eth0

 

Test network connection.

 

#  ping -c5 www.google.com

 

If you see packet traffic it's time to continue. If not head over to Gentoo's irc chans for user support. see References at the bottom of this guide.

 

note: Before heading over to irc, try running net-setup from the LiveCD. This will usually set things up properly.

 

TIP: for me 'net-setup eth0' doesn't work but 'net-setup eth1' does.

 

4. Partition tables & RAID/LVM2 setup.

 

First check your system for available disks. If this command prints nothing you have a problem that is outside the scope of this handbook. Use fdisk,cfdisk or parted to create your partition layout. The device name is likely to be either /dev/sda for a SATA or SCSI disk, or /dev/hda for an IDE disk.

 

How big should I make my partitions?

 

/dev/sda1 = 15MB -> /boot

/dev/sda2 = 2GB -> Linux SWAP

/dev/sda3 = 2GB -> /

/dev/sda4 = -> LVM2

 

Tip: Depending on how many RAID devices you'll be using, your swap partition size will vary, for our guide it's set to 2GB which will end up being 4GB for 2GB of available RAM. Set swap size according to how much physical ram and or RAID devices you'll have. A good ratio is 2:1 your ram.

 

After setting up your partition table, you can copy the partition schema to another identical drive using sfdisk.

 

Example:

 

# sfdisk /dev/sda -d | sfdisk /dev/sdb

 

After completion you should have a layout similar to this.

 

# fdisk -l		

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x015a015a

  Device Boot	  Start		 End	  Blocks   Id  System
/dev/sda1			   1		   4	   32098+  fd  Linux raid autodetect
/dev/sda2			   5		 491	 3911827+  82  Linux swap / Solaris
/dev/sda3			 492	   29062   229496557+  fd  Linux raid autodetect
/dev/sda4		   29063	   30401	10755517+  fd  Linux raid autodetect

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

  Device Boot	  Start		 End	  Blocks   Id  System
/dev/sdb1			   1		   4	   32098+  fd  Linux raid autodetect
/dev/sdb2			   5		 491	 3911827+  82  Linux swap / Solaris
/dev/sdb3			 492	   29062   229496557+  fd  Linux raid autodetect
/dev/sdb4		   29063	   30401	10755517+  fd  Linux raid autodetect

 

4a. Creating the RAID arrays

 

Now that we have created our partition schemas and our partitions tables match between all drives we can proceed in creating the raid arrays.

for users that want to use RAID6. You'll need a minimum of 4 disk to proceed.

 

note: change values to reflect any extra drives you want in the array as this guide focuses on a 2 disk array only.

 

Load require modules.

 

# for i in raid0 raid1 raid456; do modprobe $i;done

 

Create RAID1 for /boot partition.

 

# mknod /dev/md0 b 9 0
# mdadm --create /dev/md0 /dev/sd[ab]1 --level=1 --raid-devices=2

 

Create RAID0 for /.

 

# mknod /dev/md1 b 9 1
# mdadm --create /dev/md1 /dev/sd[ab]3 --level=0 --chunk=128 --raid-devices=2

 

Create RAID0 for LVM2 physical volume.

 

# mknod /dev/md2 b 9 2
# mdadm --create /dev/md2 /dev/sd[ab]4 --chunk=128 --level=0 --raid-devices=2

 

Monitoring units until they are fully synched.

 

 
# watch -n1 cat /proc/mdstat

 

4b. Create LVM2 Physical volume

 

LVM2 refers to a new userspace toolset that provide logical volume management facilities on Linux. In other words, instead of creating a bunch of "Extended Partitions" you'll create a Physical Logical Volume out of a Primary and or Extended Partition and have LVM2 manage the Logical Volumes. LVM2 provides many cool features like snapshots and mirroring.

We will now create the Physical volume from our last partition which will contain logical volumes for partitions which we will optimized.

 

# pvcreate /dev/md2

 

4c. Create LVM2 Volume Group

 

We will now create the Volume Group from the newly created physical volume.

 

# vgcreate lvg /dev/md2

 

4d. Create the LVM2 Logical Volumes

 

Last step is to create the Logical Volumes which will holds various partitions in the system with unique file system attributes for speed and performance. for now lets just create the logical volumes.

 

Note: edit size values "-L" to reflect any extra disk space you'll need.

 

# lvcreate -L10G -nhome lvg
# lvcreate -L15G -nopt lvg
# lvcreate -L3G -nvar lvg
# lvcreate -L7G -nvartmp lvg
# lvcreate -L2G -ntmp lvg
# lvcreate -L8G -nusr lvg
# lvcreate -L2G -nportage lvg
# lvcreate -L4G -ndistfiles lvg

 

4e. Display LVM2 Physical & Logical Volumes

 

Display Physical Volume.

 

# vgs

 

Display Logical Volumes.

 

# lvs

 

5. File Systems and Mounting

 

This guide focuses on using ext2 & 3 file system, If you wish to use a different file system type just use the appropriate command instead of the ones provided by this guide.

 

Create FS for /boot.

 

# mke2fs -L boot /dev/md0

 

Create FS for /.

 

# mke2fs -L root -j -b 4096 -E stride=32 /dev/md1

 

 

5a. Create FS for LVM2 Logical Volumes.

 

# mke2fs -L tmp /dev/lvg/tmp
# mke2fs -L usr -j /dev/lvg/usr
# mke2fs -L var -j /dev/lvg/var
# mke2fs -L home -j /dev/lvg/home
# mke2fs -L opt -j -b 4096 -E stride=32 /dev/lvg/opt
# mke2fs -L portage -b 1024 -E stride=8 -N 200000 /dev/lvg/portage
# mke2fs -L vartmp /dev/lvg/vartmp
# mke2fs -L distfiles -b 4096 -E stride=32 /dev/lvg/distfiles

 

5b. Creating and Starting Swap.

 

I will present two available options for an optimized SWAP. First one will be using SWAP under RAID. There are a couple of ways you can setup SWAP in RAID for stability against failed drives.

 

  1. SWAP on RAID1 "Mirroring"
    Transfer rate per block is equal to that of a single disk but provides 100% redundancy of data means no rebuild is necessary in case of a disk failure, just a copy to the replacement disk.
  2. SWAP on RAID5 "Striped with Single Parity"
    Highest Read data transaction rate & Medium Write data transaction rate.
  3. SWAP on RAID6 "Striped & Double Parity"
    RAID 6 is essentially an extension of RAID level 5 which allows for additional fault tolerance by using a second independent distributed parity scheme (dual parity). A minimum of 4 disk are require.

 

On the other hand if you prefer performance, you can just let the kernel use distinct swap partitions as it does striping by default. We will focus on letting the kernel handle the SWAP striping for us.

 

Create then Activate SWAP.

 

# mkswap /dev/sda2 && mkswap /dev/sdb2
# swapon -p 1 /dev/sda2 && swapon -p 1 /dev/sdb2

 

Confirm SWAP is on and priorities match.

 

# swapon -s

 

5c. Mounting the partitions.

 

Mount / partition.

 

# mount /dev/md1 /mnt/gentoo

 

Mount /boot partition.

 

# mkdir /mnt/gentoo/boot
# mount /dev/md0 /mnt/gentoo/boot

 

Mount LVM2 volumes.

 

# mkdir /mnt/gentoo/{usr,var,opt,home,tmp}
# mount /dev/lvg/var /mnt/gentoo/var
# mount /dev/lvg/opt /mnt/gentoo/opt
# mount /dev/lvg/home /mnt/gentoo/home
# mount /dev/lvg/tmp /mnt/gentoo/tmp
# mkdir /mnt/gentoo/var/tmp
# mount /dev/lvg/vartmp /mnt/gentoo/var/tmp
# mount /dev/lvg/usr /mnt/gentoo/usr
# mkdir /mnt/gentoo/usr/portage
# mount /dev/lvg/portage /mnt/gentoo/usr/portage
# mkdir /mnt/gentoo/usr/portage/distfiles
# mount /dev/lvg/distfiles /mnt/gentoo/usr/portage/distfiles
# chmod 1777 /mnt/gentoo/{tmp,var/tmp}

 

6. Installing the Gentoo Installation Files

 

6a. Setting the Date/Time

 

Before you continue you need to check your date/time and update it. A mis-configured clock may lead to strange results in the future!

 

Verify the current date/time.

 

# date

 

If the date/time displayed is wrong, update it using the date MMDDhhmmYYYY syntax (Month, Day, hour, minute and Year). For instance, to set the date to Sat Oct 27 11:45:48, in the year 2007.

 

# date 102711452007

 

6b. Retrieving a Base System Stage Tarball

 

Think of your toolchain as 3 hardware pieces; Glibc being your motherboard which has all the bridges that connects your components that being BinUtils and finally GCC is your processor. With a good motherboard (Glibc C library), great components (Binutils system tools) and a killer processor (GCC compiler collection) there is really nothing stopping you from gaining great performance except some heat from that massive overvolt you're giving your CPU :D

 

note: remember only download one of the stages. you may also check Gentoo mirrors page for alternative mirrors.

 

32bit Gentoo 2007.0 stage3 tarball.

 

# cd /mnt/gentoo
# wget http://gentoo.mirrors.tds.net/gentoo/releases/x86/2007.0/stages/stage3-i686-2007.0.tar.bz2
# tar xvjpf stage3*

 

64bit Gentoo 2007.0 stage3 tarball.

 

# cd /mnt/gentoo
# wget http://gentoo.mirrors.tds.net/gentoo/releases/amd64/2007.0/stages/stage3-amd64-2007.0.tar.bz2
# tar xvjpf stage3*

 

Gentoo Portage Tree Snapshot

 

# cd /mnt/gentoo
# wget http://mirror.datapipe.net/gentoo/snapshots/portage-latest.tar.bz2
# tar xvjpf portage* -C usr/

 

6c. Setting your compiler flags make.conf

 

I have provided pre-configured make.conf files available for users to download and edit to suit their needs. Due to the amount of variables in Gentoo's make.conf they cannot be covered in this tutorial. If you require some assistance ingesting how make.conf works read the manual page.

 

Manual for make.conf.

 

# man make.conf

 

To get a better idea of how portage works, check out Gentoo's official portage documentation. I have also provided configuration files for both 32bit and 64bit processors; pick the one that suits your needs. at the end of this guide you can view the reference links for more info regarding Gentoo Linux.

 

Configuration for Athlon-XP Processor

 

32bit Athlon-XP

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/athlon-xp/x86/make.conf

 

Notes on Althlon-XP Procs

 

  • MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your processor has dual-cores.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Athlon64 Processors

 

32bit Athlon64

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/athlon64/x86/make.conf

 

64bit Athlon64

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/athlon64/amd64/make.conf

 

Notes on Althlon64 Procs

 

  • MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your processor has dual-cores.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Athlon64 X2 Processors (Socket 939/AM2)

 

32bit Athlon64 X2 (Socket 939/AM2)

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/athlon64x2/x86/make.conf

 

64bit Athlon64 X2 (Socket 939/AM2)

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/athlon64x2/amd64/make.conf

 

Notes on Althlon64 X2 (Socket 939/AM2) Procs

 

  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type:
    # cat /proc/cpuinfo

 

Configuration for Opteron Processors (Socket 939/AM2)

 

32bit Opteron

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/opteron/x86/make.conf

 

64bit Opteron

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/opteron/amd64/make.conf

 

Notes on Opteron Procs

  • MAKEOPTS="-j3" edit this to MAKEOPTS="-j2" if your processor does not have dual-cores.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." variable in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Intel Core Duo/ Core 2 Duo Processors

 

32bit Core Duo

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/nocona/x86/make.conf

 

64bit Core Duo

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/nocona/amd64/make.conf

 

Notes on Core Duo/Core 2 Duo Procs

  • MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your processor has dual-cores.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Pentium2 Processors

 

32bit Pentium2

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium2/x86/make.conf

 

Notes on Pentium2 Procs

  • MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your running a dual processor board.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Pentium3 Processors

 

32bit Pentium3

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium3/x86/make.conf

 

Notes on Pentium3 Procs

  • MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your running a dual processor board.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Pentium-M (Centrino)/Celeron M (Intel) Processors

 

32bit Pentium-M

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium-m/x86/make.conf

 

Notes on Pentium-M Procs

  • MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your processor has dual-cores.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Pentium4 Processors

 

32bit Pentium4

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium4/x86/make.conf

 

64bit Pentium4

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium4/amd64/make.conf

 

Notes on Pentium4 Procs

  • MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your processor has dual-cores.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Pentium4 (Prescotts) Processors

 

32bit Pentium4

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/p4-prescott/x86/make.conf

 

64bit Pentium4

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/p4-prescott/amd64/make.conf

 

Notes on Pentium4 (Prescotts) Procs

  • MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your processor has dual-cores.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • You can verify the chip is a Prescott by looking for pni in the flags section of /proc/cpuinfo. this indicates support for SSE3. In 2004, Intel started branding processors with the Prescott core as Intel Celeron D.
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for PentiumD Processors

 

32bit PentiumD

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium-d/x86/make.conf

 

64bit PentiumD

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium-d/amd64/make.conf

 

Notes on PentiumD Procs

  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Xeon w/o EM64T Processors

 

32bit Xeon w/o EM64T

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/xeon_no_em64t/x86/make.conf

 

Notes on Xeon w/o EM64T Procs

 

  • If you have hyperthreading turned on, then each processor counts as two logical CPUs, so if you have two hyperthreaded CPUs, then you should use MAKEOPTS="-j5" in your make.conf. This wont affect the generated code but might make your compiles faster.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Xeon w/ EM64T Processors

 

32bit Xeon w/o EM64T

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/xeon_w_em64t/x86/make.conf

 

64bit Xeon w/ EM64T

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/xeon_w_em64t/amd64/make.conf

 

Notes on Xeon w/ EM64T Procs

  • If you have hyperthreading turned on, then each processor counts as two logical CPUs, so if you have two hyperthreaded CPUs, then you should use MAKEOPTS="-j5" in your make.conf. This wont affect the generated code but might make your compiles faster.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

Configuration for Celeron (Willamette) Processors

 

32bit Celeron (Willamette)

 

# cd /mnt/gentoo/etc 
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/celeron/x86/make.conf

 

Notes on Celeron (Willamette) Procs

  • MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your processor is has dual-cores.
  • If your processor is missing any of the sse,sse2 flags edit these out from the USE="..." in the make.conf
  • to view available flags type or to check if you have two cores. type
    # cat /proc/cpuinfo

 

6d. Selecting Fast Mirrors

 

Mirror-Select is a wonderful tool which will test available mirrors and determent the best one for you.

 

# mirrorselect -s4 -o -D >>/mnt/gentoo/etc/make.conf

 

6e. Mounting Procfs and Dev

 

Before chrooting you must mount procfs from the running livecd into the hard drive's newly extracted filesystem for things to operate properly while chrooted. /dev on the livecd should be mounted into the chroot also as you may experience some difficulties if you don't.

 

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

 

7. Installing the Gentoo Base System

 

7a. Copying the dns server address file into the base stage

 

resolv.conf is the primary file responsible for advising a linux system which dns servers should be used for address resolving. This file is dynamically updated by dhcp when the livecd starts but does'not exist by default in the base system stage. We must copy /etc/resolv.conf to provide for the dns resolver configuration.

 

# cp -v /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

 

7b. Chrooting & Rehashing environment paths.

 

Chroot is defined in the manpage as " chroot - run command or interactive shell with special root directory"

 

It's meaning really an acronym for "change root". After preparing the base system stage we need to change to the "new root" in the base stage. We will start screen to have resumable sessions first then we will chroot into the newly extracted gentoo environment.

 

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

 

To leave the gentoo base system chroot at any time type 'exit && exit' once.

 

7c. Updating the Portage Tree.

 

# emerge --sync

 

7d. Setting Locales

 

We will selecting only the locales neccessary for our system since if no locales are select in locale.gen glibc will generate locales for all languages and that waste time unless you need that many locales. We will choose the English ISO-8889-1 & UTF-8 locale, uncomment any locales that you might want besides those two.

 

Set locales.

 

# nano -w /etc/locale.gen

 

Generate locales.

 

# locale-gen

 

7e. Setting Your Timezone

 

We need to set our timezone so that our system knows where it is located. Available timezone are located in /usr/share/zoneinfo, you just need to set a symbolic link to /etc/localtime. Please avoid the /usr/share/zoneinfo/Etc/GMT* timezones as their names do not indicate the expected zones. For instance, GMT-8 is in fact GMT+8.

 

Example of setting the timezone for New York.

 

# [ -e /etc/localtime ] && rm -v /etc/localtime
# cp -v /usr/share/zoneinfo/America/New_York /etc/localtime

 

Next we will begin the rebuild of the toolchain this process is the most important and most time consuming process of the base system install.

 

8. Bootstrapping the system

 

Now that we have done all of the above it is now time to rebuild the toolchain this is the part where your system will be build most of the system utils,compiler and libraries. After this process you will not only have a system that is rock solid, and on the bleeding edge with the most up to date packages from the portage tree and toolchain overlay. If for any reason packages fail on the next steps, take a look at the FAQ/Troubleshooting section at the bottom of this guide for help and tips.

 

note: This step is the most time consuming & important aspect of the build; furthermore it will take about 2-4hours depending on your hardware specs. For me it took only 1hour and 30mins on a dual-core opteron 165 @ 2853MHz with 2GB of RAM.

 

note: current new portage can't be installed with the current bash pkg on this stage3, so we need to update portage before we begin the bootstrap as it's recommended.

 

# emerge -1O portage

 

Performing the bootstrap.

 

# emerge gcc-config linux-headers glibc binutils gcc portage -1
# gcc-config 2 && env-update && source /etc/profile

 

8c. Enabling the new GNU Hashstyle.

 

Most applications use shared libraries, which can slowdown load times. Each library needs to be loaded at runtime to resolve symbols, etc. For most small programs this is very quick, but for programs written in C++ or those that have many linked libraries, this can take a fair amount of time.

 

Hashstyle is fast becoming the next step, and patches have been merged into development releases upstream. This improvement is the new DT_GNU_HASH or .gnu.hash, now affectionately known as Hashstyle (due to the USE and ldflag naming). The new .gnu.hash is approximately 50% faster than the old sysv .hash.

 

For backwards compatibility you may skip setting --hash-style=gnu all together as >=baselayout-2.18 sets --hash-style=both by default now. For now we will stay on the bleeding edge.

 

Last but not least we will rebuild our toolchain against itself. "Note: This is not needed when going from 4.2 to 4.2.x.x but require from 4.2 to 4.3 since those are major version updates"

 

# sed -i 's/once/once,--hash-style=gnu/' /etc/make.conf
# emerge linux-headers glibc binutils gcc -1

 

Create binpkg from toolchain packages then prune old GCC from system.

 

# [ ! -d /usr/portage/packages ] && mkdir /usr/portage/packages
# quickpkg gcc glibc binutils linux-headers && emerge -Pv gcc

 

8d. Rebuilding world packages.

 

Now that we have bootstrapped the system and we now have an updated toolchain, we can begin to rebuild all remain packages in the system against the new toolchain. This one-liner will build all packages minus the toolchain packages; All failed packages will be saved in a file and shown later.

 

note: we need to unemerge a few packages which will cause blocks before we re-emerge all packages in the system. these packages are "mktemp & setarch" which are replaced by coreutils and util-linux respectably.

 

# emerge -C mktemp setarch

 

Emerging all packages against the newly compiled toolchain.

 

# while read ebuild; do emerge -v1 "${ebuild}" || echo "${ebuild}" >>failed; done < <(emerge -ep --columns --color=n world| awk '{print$4}' | grep -E -v "(glibc|/portage|binutils|gcc|linux-h)"|sed '1,5d')
# env-update && source /etc/profile

 

Packages that failed the world build.

 

# cat failed

 

Edit this list of packages here to suit your needs, these are common system tools and misc packages.

 

# emerge syslog-ng ntp grub vixie-cron sysfsutils dhcpcd
# for i in syslog-ng net.eth0 vixie-cron sshd; do rc-update add $i default; done

 

8e. Eliminating Clock Skew

 

There's just not enough time in a day. and it's a little known fact that a computer has two clocks. One is a hardware clock and the second is a software clock that runs in the os. They however do not stay in sync which creates a condition known as clock skew that can cause havok with source build operating systems such as gentoo linux. Clock skew can cause source compiles to fail. We allieviate this problem by adding a network time protocol client into the installation.

 

# ntpdate -u -b pool.ntp.org

 

8f. Configuring the RC System

 

Before we begin with the Kernel configuration we will set some configuration options.

 

# nano -w /etc/conf.d/rc

 

File: /etc/conf.d/rc

 

# /etc/conf.d/rc: Global config file for the Gentoo RC System

 

# Set to "yes" if you want the rc system to try and start services

# in parallel for a slight speed improvement.

RC_PARALLEL="yes"

 

# Use this variable to control the /dev management behavior.

# auto - let the scripts figure out what's best at boot

# devfs - use devfs (requires sys-fs/devfsd)

# udev - use udev (requires sys-fs/udev)

# static - let the user manage /dev (YOU need to create ALL device nodes)

RC_DEVICES="udev"

 

# UDEV OPTION:

# Set to "yes" if you want to save /dev to a tarball on shutdown

# and restore it on startup. This is useful if you have a lot of

# custom device nodes that udev does not handle/know about.

RC_DEVICE_TARBALL="no"

 

9. Kernel Configuration

 

A Little History (source wikipedia.org)

The Linux kernel is a Unix-like operating system kernel. It is the namesake of the Linux family of operating systems. Released under the GNU General Public License (GPL) and developed by contributors worldwide, Linux is one of the most prominent examples of free/open source software whose developers primarily follow the philosophy of the open source movement.

 

Linux was created by Linus Torvalds in 1991. At the time, the GNU Project had created many of the components required for a free software operating system, but its own kernel, GNU Hurd, was incomplete and unavailable. The BSD operating system had not yet freed itself from legal encumbrances. This left a space for the Linux kernel to fill, and despite the limited functionality of the early versions it rapidly accumulated developers and users. Early on, the Minix community contributed code and ideas to the Linux kernel, and today it has received contributions from thousands of programmers.

 

There are a few pointers when it comes to configuring your kernel.

 

  • lspci part of sys-apps/pciutils
    This tool will output information on your main board to help you decide what needs to be enabled on the Linux Kernel.
  • lsmod part of sys-apps/module-init-tools
    In short it means List Modules, with this command you will be able to see what modules are currently loaded by the Linux Kernel, I use this to find out what modules the Gentoo LiveCD loaded for my system and by the names i can quickly find the source inside the Linux Kernel's configuration file.

 

Example of lspci output:

 

# lspci

00:00.0 Memory controller: nVidia Corporation CK804 Memory Controller (rev a3)

00:01.0 ISA bridge: nVidia Corporation CK804 ISA Bridge (rev a3)

00:01.1 SMBus: nVidia Corporation CK804 SMBus (rev a2)

00:02.0 USB Controller: nVidia Corporation CK804 USB Controller (rev a2)

00:02.1 USB Controller: nVidia Corporation CK804 USB Controller (rev a3)

00:04.0 Multimedia audio controller: nVidia Corporation CK804 AC'97 Audio Controller (rev a2)

00:06.0 IDE interface: nVidia Corporation CK804 IDE (rev a2)

00:07.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev a3)

00:08.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev a3)

00:09.0 PCI bridge: nVidia Corporation CK804 PCI Bridge (rev a2)

00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3)

00:0b.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:0c.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:0d.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:0e.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map

00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller

00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

01:08.0 RAID bus controller: Silicon Image, Inc. SiI 3114 [sATALink/SATARaid] Serial ATA Controller (rev 02)

01:09.0 FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host Controller (rev 80)

01:0a.0 Ethernet controller: Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller (rev 13)

05:00.0 VGA compatible controller: nVidia Corporation NV43 [GeForce 6600 GT] (rev a2)

 

That is the output for my DFI NF4 LanParty SLI-DR Venus Board.

 

Output of lsmod.

 

# lsmod

Module Size Used by

udf 82920 0

snd_seq 54624 0

kqemu 160360 0

nls_cp850 6272 0

nls_iso8859_1 5440 0

vfat 12288 0

fat 51248 1 vfat

isofs 33764 0

zlib_inflate 17216 1 isofs

loop 16324 2

thermal 12880 3

processor 17292 1 thermal

nvidia 7001460 24

snd_intel8x0 33960 0

snd_ac97_codec 114456 1 snd_intel8x0

ac97_bus 2816 1 snd_ac97_codec

snd_pcm 80968 2 snd_intel8x0,snd_ac97_codec

pwc 86528 0

snd_timer 21576 2 snd_seq,snd_pcm

compat_ioctl32 9088 1 pwc

snd 55656 5 snd_seq,snd_intel8x0,snd_ac97_codec,snd_pcm,snd_timer

videodev 27264 1 pwc

ohci1394 33224 0

ieee1394 91344 1 ohci1394

sr_mod 15140 0

soundcore 7136 1 snd

forcedeth 47176 0

cdrom 37992 1 sr_mod

evdev 9792 2

v4l2_common 18432 2 compat_ioctl32,videodev

snd_page_alloc 8400 2 snd_intel8x0,snd_pcm

rtc 12080 0

joydev 10240 0

v4l1_compat 13636 1 videodev

usblp 13248 0

sg 24224 0

usbhid 18660 0

usb_storage 41540 0

ohci_hcd 21252 0

ehci_hcd 31564 0

usbcore 131120 7 pwc,usblp,usbhid,usb_storage,ohci_hcd,ehci_hcd

aes_x86_64 25768 12

sha256 9088 0

cbc 4416 8

blkcipher 5956 1 cbc

dm_crypt 12432 1

dm_mod 55024 30 dm_crypt

raid1 21760 1

raid0 7296 1

raid456 120096 1

md_mod 75868 7 raid1,raid0,raid456

xor 5904 1 raid456

sata_sil 10248 0

sata_nv 18436 16

libata 118864 2 sata_sil,sata_nv

sd_mod 24640 20

 

9a. Downloading and Emerging Kamikaze Linux Sources source: http://kamikaze.waninkoko.info

 

The beauty of gentoo is that you don't have to manually compile applications and to top it off, the majority of the programs,tools, & libraries you will emerge with gentoo are compiled from source, this is were Gentoo shines. All applications compiled from source will take full advantage of the compiler flags set forth in your make.conf file.

 

Retrieving the gentoo-sources ebuild.

 

# emerge gentoo-sources && cd $OLDPWD

 

Now that you have downloaded the latest Linux Kernel with the Kamikaze5 "Vipernicus" patchset you are ready to start configuring it. I have provided a Kernel configuration as a starting point for you.

 

32bit Linux Kernel Configuration:

 

# cd /usr/src/linux
# wget http://weboperative.com/gentoo/kernel/x86/.config
# make menuconfig

 

64bit Linux Kernel Configuration:

 

# cd /usr/src/linux
# wget http://weboperative.com/gentoo/kernel/amd64/.config
# make menuconfig

 

Welcome to the linux kernel configuration menu. Here you must make a few changes to your configuration using the provided kernel config. My config is sutable for most systems however it's a bit bloated for compatibility with many systems. You should get familiar with the kernel options eventually so you can disable features you don't need and only enable those you really need, this will keep your kernel footprint small and system fast.

 

To fit your kernel to your unique hardware you must navigate to the following kernel menus and make require changes.

 

  1. First you must tell the kernel which processor you currently have, this is done in the the following section:
    Processor type and features --->
    Processor family (AMD-Opteron/Athlon64)
    Symmetric multi-processing support (enable if running multiple cores)
    Generic x86 support (enable if running old processors Duron/Athlon/PII)
  2. Next if you are currently a 64bit user make sure the following option
    IA32 Emulation in the following section is enabled:
    Executable file formats / Emulations --->
    IA32 Emulation
  3. Now to the Device Drivers section. Here you will configure several options in regards to your IDE/SATA/PATA, RAID/LVM,Network Cards,Sound Cards & USB devices.
    Device Drivers --->
    Multi-device support (RAID and LVM) --->
     
  4. Multiple devices driver support (RAID and LVM)
    <*> RAID support
    <*> RAID-0 (striping) mode
    <*> RAID-1 (mirroring) mode
    <*> RAID-4/RAID-5/RAID-6 mode (Optional unless needed.)
    <*> Device mapper support
    ATA/ATAPI/MFM/RLL support ---> (This section can be disabled as the section below Serial ATA replaces it.)
    Serial ATA (prod) and Parallel ATA (experimental) drivers ---> (look here for ATA/SATA controller support)
    Network device support --->
    Character devices --->
    /dev/agpgart (AGP Support) (enable if you want AGP support)
    Sound --->
    USB support --->
  5. Now we enable the gcc-4.3 compilation fix.
    Kernel hacking --->
    <*> GCC 4.3.0 support
  6. Finally you will setup support for your file system (ext2 & ext3) or any other file system that you might have selected instead of the one provided by this guide.
    File systems --->
    <*> Second extended fs support
    <*> Ext3 journalling file system support

 

TIP: To search for specific kernel configuration options or module names, type / at the kernel menu prompt.

After configuring your kernel for supported devices exit from menuconfig and type the following

 

32bit Kernel Compilation

# make && make modules_install
# cp -v arch/i386/boot/bzImage /boot/2.6.24
# modules-update

 

64bit Kernel Compilation:

# make && make modules_install
# cp -v arch/x86_64/boot/bzImage /boot/2.6.24
# modules-update

 

9b. Installing Additional Kernel Modules

 

I always build tons of modules where ever possible, doing so is not advisable unless you know what you're doing. A dynamically loading system will save valuable memory address space in your system kernel. lsmod is your eyes into a running modular linux system but it's only usable with modules. NIC modules are an excellent example. Adding them to modprobe at boot is required as hotplug doesn't load nic drivers dynamically possibly leaving you with a booted system without network.

 

Here is a list of kernel-related ebuilds that you could emerge.

 

  • nvidia-drivers - NVIDIA X11 driver and GLX libraries
  • ati-drivers - ATI precompiled drivers for r350, r300, r250 and r200 chipsets
  • device-mapper - Device mapper ioctl library for use with LVM2 utilities
  • qc-usb - Logitech USB Quickcam Express Linux Driver Modules

 

Beware though, some of these ebuilds might deal with big dependencies. To verify what packages will be installed by emerging an ebuild, use

emerge --pretend --verbose ...

 

For instance, for the nvidia-kernel package:

 

Note: recommended that you do not install this package now and just use this as an example only. reason being is when you try to emerge this package which will depend on xorg-x11 thus bring in a big list of packages which you might want until you have your system up and running instead of compiling them from the livecd.

 

Example:

 

# emerge --pretend --verbose nvidia-drivers

 

You should list the modules you want automatically loaded in /etc/modules.autoload.d/kernel-2.6. You can add extra options to the modules too if you want.

 

To view all available modules, run the following find command. Don't forget to substitute "" with the version of the kernel you just compiled:

 

# find /lib/modules/<kernel version>/ -type f -name '*.o' -or -name '*.ko'

here are some common kernel modules which should be set to load on boot. keep in mind that your system will probably have different hardware thus different modules to load. in this examples we will be loading modules in a system with:

 

Sound Card: C-Media based on the CMI8738

ATA/ATAPI/IDE Controller: nVidia IDE Chipset.

USB Support: EHCI HCD 2.0, OHCI HCD & UHCI HCD Support.

 

There modules are located here:

  • C-Media:
    /lib/modules/2.6.24-gentoo/kernel/sound/pci/snd-cmipci.ko
  • AMD and nVidia IDE Support:
    /lib/modules/2.6.24-gentoo/kernel/drivers/ide/pci/amd74xx.ko
  • USB EHCI 2.0:
    /lib/modules/2.6.24-gentoo/kernel/drivers/usb/host/ehci-hcd.ko
  • USB OHCI:
    /lib/modules/2.6.24-gentookernel/drivers/usb/host/ohci-hcd.ko
  • USB UHCI:
    /lib/modules/2.6.24-gentoo/kernel/drivers/usb/host/uhci-hcd.ko

 

TIP:

to load modules that load on reboot add each module to

/etc/modules.autoload.d/kernel-2.6

example:

to load the C-Media Sound Card Module on a reboot, add snd-cmipci to

/etc/modules.autoload.d/kernel-2.6

Now run update-modules to commit your changes to the /etc/modules.conf file:

 

9c. Configuring Your System

 

Setting Up Hostname

 

# nano -w /etc/conf.d/hostname

 

File:/etc/conf.d/hostname

 

# /etc/conf.d/hostname

 

# Set to the hostname of this machine

HOSTNAME="ocaddict"

 

Next you must edit /etc/hosts to allow Linux to set your hostnames while no nameservers are reachable. IPv6 will be here in the next few years, so don't get too cozy: IPv4 will be deprecated and you will be assimilated.

 

Here's an example of what /etc/hosts should contain:

 

File: /etc/hosts

 

# nano -w /etc/hosts

 

# /etc/hosts: Local Host Database

 

# IPv4 and IPv6 localhost aliases

192.168.1.100 ocaddict

 

9d. Configuring a Second Network Card[/size] (Optional)

 

# ln -s /etc/init.d/net.lo /etc/init.d/net.eth1
# rc-update add net.eth1 default

 

Configuring DHCP

 

Gentoo Linux no longer defaults to installing dhcpcd as a system package so I've added it to the oneliner as an extra package. Since most users have the simplicity of a dhcp network you merely need to uncomment two variables in /etc/conf.d/net, config_eth0 and dhcpcd_eth0, in the dhcp section about half way through the file.

 

File: /etc/conf.d/net (tip: for a more detail example of this configuration file, view /etc/conf.d/net.example)

 

config_eth0=( "dhcpcd" )

 

Configuring Static IP (optional)

 

File: /etc/conf.d/net (tip: for a more detail example of this configuration file, view /etc/conf.d/net.example)

 

config_eth0=( "66.90.101.18" )

routes_eth0=( "default via 66.90.101.1" )

 

10. Configuring Grub Bootloader

 

10a. Boot loader setup

 

Now that your kernel is configured and compiled and the necessary system configuration files are filled in correctly, it is time to install a program that will fire up your kernel when you start the system. Such a program is called a bootloader.

 

  1. start grub console without floppy seek
  2. tell grub where your /boot directory resides. (hd0,0) equals /dev/sda1. if your /boot resides elsewhere make the changes below.
  3. install the Master Boot Record to /dev/sda or /dev/hda if using IDE.
  4. quit grub console.

 

We will need to setup grub multiple times for each drive on our RAID array, this is necessary for grub to function properly in an ARRAY.

 

# grub --no-floppy
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

 

Editing /boot/grub/menu.lst.

 

# cd /boot/grub 
# wget http://weboperative.com/gentoo/grub/gentoo.xpm.gz
# nano -w /boot/grub/menu.lst

 

Edit the menu.lst file (this is really a symlink) as follows.

 

# Boot automatically after 30 secs.

timeout 7

 

# By default, boot the first entry.

default 0

 

# Splash image to show behind grub.

splashimage=(hd0,0)/boot/grub/gentoo.xpm.gz

 

# For booting Gentoo GNU/Linux

title Gentoo 2.6.24

root (hd0,0)

kernel /boot/2.6.24 root=/dev/md1

 

10b. Setting Up fstab

 

This is a step you do not want to do before installing grub... for some reason grub has a spaz attack and calls die() when it finds an fstab in completed fashion.

 

# nano -w /etc/fstab

 

/dev/md0 /boot ext2 noauto,noatime 1 2

/dev/md1 / ext3 noatime 0 1

/dev/sda2 none swap sw,pri=1 0 0

/dev/sdb2 none swap sw,pri=1 0 0

/dev/lvg/usr /usr ext3 noatime 0 2

/dev/lvg/portage /usr/portage ext2 noatime 0 2

/dev/lvg/distfiles /usr/portage/distfiles ext2 noatime 0 2

/dev/lvg/opt /opt ext3 noatime 0 2

/dev/lvg/tmp /tmp ext2 noatime 0 2

/dev/lvg/var /var ext3 noatime 0 2

/dev/lvg/vartmp /var/tmp ext2 noatime 0 2

/dev/lvg/home /home ext3 noatime 0 2

none /proc proc defaults 0 0

none /dev/shm tmpfs nodev,nosuid,noexec 0 0

 

10c. System Information

 

We are almost done, hang tight ;)

 

Set Up Users & Set a Root Password

 

We must change the password of the root user in the installed system to ensure it's usable after booting the system and also add a user for yourself with the appropriate groups that would be required for an average desktop-server hybrid gentoo linux system. Substitute my nick with your own username or add me a shell and pm me the login should you feel generous ;)

 

[I]to change root's pass:[/I]
# passwd 
[I]to add a new user to system:[/I]
# useradd -m -d /home/<yourname> -s /bin/bash -g users -G audio,cron,wheel,portage,games,video <yourname>
[I]to change <yourname> password:[/I]
# passwd <your username>

 

Note: if you get the error message:

useradd: invalid numeric argument 'games'
do the following:

# groupadd games

then retry the 'useradd' command.

 

10d. Compiling System Tools

 

Lets not forget to compile the necessary tools for RAID & LVM2.

 

# emerge mdadm lvm2

 

10e. Exiting Chroot and Unmounting Partitions

 

Since we used screen during our installation we will need to exit or logout twice... once to quit screen, once to exit from chroot following with unmounting the partitions used for installation and disabling swap... A "clean" shutdown is allways a good idea...

 

We also need to deactivate our LVM2 volumes.

 

Note: before you begin these last commands make sure you have exit all "chroot" environments, or else you will get "device is currently busy" messages.

 

# exit && exit
# cd ~
# umount /mnt/gentoo/{boot,proc,dev,tmp,opt,home}
# umount /mnt/gentoo/{usr/portage/distfiles,usr/portage,usr}
# umount /mnt/gentoo/{var/tmp,var}
# umount /mnt/gentoo
# swapoff /dev/sda2 && swapoff /dev/sdb2
# vgdisplay
# vgchange -an
# sync

 

10f. Rebooting to your newly installed Gentoo Linux

 

# shutdown -r now

 

.: FAQ/Troubleshooting :.

 

  1. How do I save my --resume settings even after I have emerged several packages?
    Answer - Portage keeps tracks of the emerge list in a file called mtimedb that "emerge --resume" goes by. but If your emerge fails on a certain package that can only be fixed by emerging another package which it's a dependency of it, next time you run 'emerge --resume' it will not start where you left off. To get around this you have to do the following:
     
    in this example we were running 'emerge --deep system' but it failed on the openldap package which was package 45 of 90. now we need to emerge openssh to fix the problem with openldap which depends on openssh if you're using the 'ssl' USE flag.
     
    # cp -v /var/cache/edb/mtimedb /var/cache/edb/mtimedb.bck
    # emerge openssh
    # cp -v /var/cache/edb/mtimedb.bck /var/cache/edb/mtimedb
    # emerge --resume


     

  2. Package openssl-0.9.8g failed to emerge.
    Answer - Since this an unstable package and is known not to work, we will just masked it then skip it so we can continue with our emerge.
     
    # echo "=dev-libs/openssl-0.9.8g">>/etc/portage/package.mask
    # cp -v /var/cache/edb/mtimedb /var/cache/edb/mtimedb.bck
    # emerge openssl
    # cp -v /var/cache/edb/mtimedb.bck /var/cache/edb/mtimedb
    # emerge --resume --skipfirst


     

  3. Package gpm-1.20.1-r6 failed to emerge.
    Answer - This packages fails with >=linux-headers-2.6. skip it for now. see bug #195977
  4. The package mktemp blocks coreutils.
    Answer - just run "emerge mktemp -C && emerge coreutils"
    coreutils replaces mktemp from now on.

 

Reference links

 

Below are some official and non-official Gentoo related links to help you get beyond this guide. Good luck :)

 

Gentoo.org: http://gentoo.org/doc

Official IRC Channel: irc.freenode.net #gentoo

Official Gentoo Linux Guides: http://gentoo.org/doc

Official Gentoo Overlays: http://overlays.gentoo.org

Forums: http://forums.gentoo.org

Gentoo Wiki: http://gentoo-wiki.com

Grub Error Collection: http://gentoo.org/doc/en/grub-error-guide.xml

Bugs Tracker: http://bugs.gentoo.org

GCC-4.3 Build Tweaks: http://www.unknownart.webd.pl/o/gcc43/

 

or my IM, check my user info ;)

 

Good Luck and Welcome to Open Source Software :)

 

Likewhoa

 

CHANGELOG Ymd

 

20071104 - Added kamikaze-sources kernel.

20071101 - Added tweaks for AMD64 GCC-4.3 build.

20071030 - GCC-4.3 & GNU Hashstyle additions.

20071027 - Minor fixes and additions.

20071020 - Implementation of RAID & LVM2.

20070705 - revised guide for the 2007.0 profile.

20080229 - Revision with minor additions.

20080306 - Added some loving revisions.

 

Copyright © 2007-2010 Mission Accomplish, INC. Released under the Creative Commons Attribution-ShareAlike license version 2.5.

Share this post


Link to post
Share on other sites

  • Replies 124
  • Created
  • Last Reply

Top Posters In This Topic

Running through it right now mate :D

 

Many thanks!

 

For anyone without DHCP (:D) use:

 

ifconfig eth0 address netmask mask up

ie. ifconfig eth0 192.168.1.21 netmask 255.255.255.0 up

 

And on I go.. (yes, you need sshd to start for putty on windows ;))

 

Edit: I guess we need a gateway route as well:

route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.2

(my gateway is .2 ;))

Share this post


Link to post
Share on other sites

I forget to mention, for those of you that only have one machine to do the install, you can essentially use "screen" to open multiple terminal on one virtual terminal.

 

to do this, type

 

# screen

 

to open a new "screen" terminal click "ctrl" key 'a' then 'c' key to open a new screen.

 

ctrl+a+c

 

to switch between the two screens type ctrl+a+a while holding ctrl key.

 

ctrl+a+a

 

now you have two terminal but what about browsing the internet and using your mouse? does your mouse work now? if not start the GPM daemon.

 

# /etc/init.d/gpm start

 

you should not have a working mouse in the terminal :)

 

what about the browser you ask? :D well that's easy.. just type

 

# links -g google.com

 

enjoy :)

Share this post


Link to post
Share on other sites

Quick question, when I'm typing all this stuff I'm basically just doing it in a DOS-like environment correct?

 

Yeah, I'm more than a little new to this, of course I could have missed it in your guide as I've only read through it once. Right now I'm going through a lot of documentation on the Gentoo forum and some of their guides. I might have to go with a stage3 tarball at first just to get the hang of it before i go all out with a 'custom' install.

Share this post


Link to post
Share on other sites

only the 64bit livecd doesn't have a desktop environment, the 32bit LiveCD boots right into the Gnome Desktop Environment. FYI there really is not that much difference in a stage1 and stage3 in terms of compiling,.. with a stage3 you don't run the bootstrap process and you just basically jump right into configuring the kernel, the downside is that you won't have the system optimized to your hardware like doing stage1 install. so stage1 essentially is a stronger, more stable system optimized to your specific processor.

my guide accomplishes that and more. I will make a thread that will link to some common gentoo guides on gentoo.org/doc to help guide people into configuring the desktop environment and 3d accelerator cards, nvidia/ati and sound card, plus a few other things like usb devices,webcams. I will make guides on special things like setting up beryl and using common tools to make life easier and more automated.

Share this post


Link to post
Share on other sites

Well if it's tailored to my processor, will it matter if I install it beofre overclocking?

 

I can't imagine it'd affect anything, just want to make sure. I'll be installing XP Pro first as from what I understand thats pretty much the only way to dual-boot.

 

So I'll be using the 64-bit version, which doesn't boot to a desktop environment? I could have sworn the one I downloaded when I chatted with you on Flashchat was the 64-bit verison, yet I still get the desktop.

 

Am I doing something wrong?

 

Or do I just bring up a console within that?

 

I figure I might as well be the one to ask since a bunch of other people probably will too...I'd love to get this optimized and working. I'm sure it's going to take a number of tries to get the hang of it, but I'm willing to put in the effort for sure. :)

Share this post


Link to post
Share on other sites

it won't matter if you install it before overclocking, it's good practice to install it on a stable overclock, it's not like windows where it doesn't install if you're overclocked.

 

also it's good practice to have windows on the first partition i.e /dev/sda1 but it's also not mandatory as the grub bootloader can boot windows installs that are on other partitions other than /dev/sda1.

 

maybe earlier version of the 64bit livecd had the desktop environment but not 2006.1 or it could be that i'm so used to switching to the terminal that i forget about the desktop. I do know for sure that the 32bit livecd has a desktop environment.

 

my advice is DO NOT use the so call Gentoo Linux Installer whatever you do. This is experimental software and if not used with caution it will corrupt your data or delete your partitions on you. I have heard to many horrors stories and complaints about it. stay away from it.

 

You'll get the hang of it.. practice makes perfect. You will not want to look at other distros once you get a taste of Gentoo's Rock Solid Performance and Bleeding Edge Software. Gentoo is the Distro for tweakers and those that want the latest in opensource software.

Share this post


Link to post
Share on other sites

I smell guinee pig...I am certainly curious to get to it...I will devote a spare rig just to this...I got hooked from the XGL video...(hint which should be linked in the guide)

 

but this is a pretty thorough guide...I am just overwhelmed by the amount of information...the 1st time will be the hardest...once I have some one hold my hand while I walk thru it...the next time will be a cake walk for me...;) I hope

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...