AOA Forums AOA Forums AOA Forums Folding For Team 45 AOA Files Home Front Page Become an AOA Subscriber! UserCP Calendar Memberlist FAQ Search Forum Home


Go Back   AOA Forums > General > AOA FAQ

AOA FAQ Need a general understanding of something or detailed plan of action? Our members offer you their FAQs!


 
 
LinkBack Thread Tools Rate Thread
  #1 (permalink)  
Old 1st November, 2007, 09:49 PM
Member
 
Join Date: April 2005
Location: AZ
Posts: 2,446

AOA Gentoo Install Guide

Due to some transitions in Gentoo this guide will not work right now. When the dust settles and I have more time I will update the guide to reflect the changes. Do not use this guide! You will not have a working install.

AOA Guide to Gentoo Linux


Before we begin, I'd like to thank and give credit to my good friend, Fernando aka LikeWhoa. Without his help I would have given up on Linux long ago. He has been kind enough to grant the files he has written and the bandwidth for the retrieving of files that we will need for our installs. I have also stolen some material from his original guide because I was too lazy too type it all out.

Second: I will not blow smoke up your butt and tell you how much faster a base install of Gentoo is compared to any other distribution available. Gentoo is more about having the option to choose everything about your OS and build it according to your needs than it is about speed, although options for speed are available if you are adventurous enough..

If you are not interested in learning anything about linux along the way, are not willing to spend the time installing and configuring your OS or just want a pop it in and go OS, Gentoo is not for you.


I will not use any package or option in this guide that has not been tested and confirmed working by me.

This guide will be broken down into 2 different sections: X86_64 for a 64bit install and will be marked with Red x86 for a 32 bit system will be marked with blue If a code is not marked with red or blue it applies to both architectures. For the purpose of this guide I will keep things on the conservative side. I'll throw some material and options for the more adventurous in part 2, such as overlays, using experimental packages, custom kernels and optimising to get the most out of Gentoo.

If at any point you get stuck, do not give up. I am just a PM away and the fix will probably be just a matter of walking through it in person so you can see it done once.



1. Install Mediums

1a. Gentoo Linux LiveCDs

The best pre-built installation CD I have found is SystemRescueCD. It has an X-server with firefox3 that will allow you to view (and copy/paste from) this website. It is also just a good all around tool to have in your collection due to it's many features. Download the latest stable version from http://www.sysresccd.org/Download

1c. Downloading and Burning the LiveCDs

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

To burn the downloaded ISO(s), you can use ImgBurn found here. The Official ImgBurn Website

1d. 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 stage3 sources, otherwise download the 32bit stage3 sources. 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 are after # sign (if the # sign is included, the command will be ignored without any indication)
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 compile errors.
6. Be patient and follow directions and you will be all right


Processors that are 64bit capable

* Intel Processors in the 1366 package
* Intel Processors in the LGA775 package.
* 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)".

Booting the SysResCD

After booting from the installation disk, you will be presented with a boot command line. For 32 bit installations just hit enter, for 64 bit installs type "rescue64" without the quotes, then hit enter.

Once the kernel has loaded up you will be at a command prompt, type "wizard" without the quotes to enter a graphical environment.

2. Installation

2a.Network preparation

Since we will be installing gentoo over a network it only makes sense to configure the network first. The install CD's are pretty good about setting up the network on boot so typing ifconfig will let us know if it has done so properly.
In the terminal that is already open in the graphical environment type.

Code:
 # /sbin/ifconfig
(...)
eth0      Link encap:Ethernet  HWaddr 00:50:BA:8F:61:7A
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::50:ba8f:617a/10 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1498792 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1284980 errors:0 dropped:0 overruns:0 carrier:0
          collisions:1984 txqueuelen:100
          RX bytes:485691215 (463.1 Mb)  TX bytes:123951388 (118.2 Mb)
          Interrupt:11 Base address:0xe800
If you need to set up a proxy

Code:
 (If the proxy filters HTTP traffic)
 # export http_proxy="http://proxy.gentoo.org:8080"
(If the proxy filters FTP traffic)
 # export ftp_proxy="ftp://proxy.gentoo.org:8080"
(If the proxy filters RSYNC traffic)
 # export RSYNC_PROXY="proxy.gentoo.org:8080"
If your proxy requires a username and password, you should use the following syntax for the variable:

Code:
 # http://username:password@proxy.gentoo.org:8080
Testing the network

Code:
 # ping -c 3 www.gentoo.org
The simplest way to set up networking if it didn't get configured automatically is to run the net-setup script

Code:
 # net-setup eth0
net-setup will ask you some questions about your network environment. When all is done, you should have a working network connection. Test your network connection as stated before. If the tests are positive, congratulations! You are now ready to install Gentoo.



2b. 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:

Code:
# sudo su
to gain root access. for now let's just change the password.

Code:
# passwd
If it is easier for you to make alterations through sshd from a different computer let's start it up.

Code:
# /etc/init.d/sshd start
To use sshd from another computer you will need port 22 opened up on your router. Check the documentation for your router. To connect through sshd from a computer running windows you can use a program called putty.

To connect using a computer already running linux, open a terminal and type.
Code:
 # ssh root@ 
2c. Optimising media access
With Windows you do not have a utility to effect changes to the hard drives' performance parameters. Linux does. hdparm is the utility that allows you to set your hard disks and CD-ROM drives to utilize the fastest 32-bit and UDMA transfer modes supported by your hard disks.

Keep in mind that hdparm is intended more for IDE/UDMA/ATA-based systems because SATA and SCSI disks have the ability to dynamically affect these changes from the controller's chipset. Gentoo Linux adds hdparm in all the LiveCDs, even the minimal one. The results from using it can save you days of waiting for apps to compile if your motherboard's IDE chipset does not automatically set the hard drives' performance parameters to use 32bit I/O, multcount and read-ahead disk modes for your system.

Hard disks, CD-ROMs, CD-RW's, DVD-RW's all may require these modes to be set to allow your system to truly achieve the performance Linux can really offer. Below you will see four examples. The first is a non-optimized drive offering no DMA, 32bit I/O, multicount or unmaskirq usage. The second and third shows how to set these modes for hard disks and optical storage readers and writers. The fourth are the results of the settings.

The un-optimized view would or could look like this:
Code:
 # hdparm /dev/hda

/dev/hda:
multcount    =  0 (off)
IO_support   =  0 (default 16-bit)
unmaskirq    =  0 (off)
using_dma    =  0 (off)
keepsettings =  0 (off)
readonly     =  0 (off)
readahead    = 256 (on)
geometry     = 16383/255/63, sectors = 78165360, start = 0

To set optimized transfer modes for most hard disks from the LiveCD do the following:

Code:
 # hdparm -d1c1u1m16 /dev/hda
To set the optimized transfer modes for most CD-ROM/RW and DVD-ROM/RW devices from the LiveCD do the following if your LiveCD is in the master CD device for all CD-ROMs. If your LiveCD is the second of two CD devices, substitute cdroms0 with cdroms1 or use hdparm and set the parameters for both devices to ensure they achieve maximum performance. Your system runs from this CD while it builds, so giving it all the data bandwidth it can use would be very benificial. Keep in mind that CD-ROMs do not use multicount.
Code:
 # hdparm -d1c1u1 /dev/cdroms/cdrom0
The optimized results:
Code:
 # hdparm -d1c1u1m16 /dev/hda

/dev/hda:
setting 32-bit IO_support flag to 1
setting multcount to 16
setting unmaskirq to 1 (on)
setting using_dma to 1 (on)
multcount    = 16 (on)
IO_support   =  1 (32-bit)
unmaskirq    =  1 (on)
using_dma    =  1 (on)
3. Preparing the disks

3a. Partitions

Although it is theoretically possible to use a full disk to house your Linux system, this is almost never done in practice. Instead, full disk block devices are split up in smaller, more manageable block devices. On x86 systems, these are called partitions.

Partitions are divided in three types: primary, extended and logical.

A primary partition is a partition which has its information stored in the MBR (master boot record). As an MBR is very small (512 bytes) only four primary partitions can be defined (for instance, /dev/hda1 to /dev/hda4).

An extended partition is a special primary partition (meaning the extended partition must be one of the four possible primary partitions) which contains more partitions. Such a partition didn't exist originally, but as four partitions were too few, it was brought to life to extend the formatting scheme without losing backward compatibility.

A logical partition is a partition inside the extended partition. Their definitions aren't placed inside the MBR, but are declared inside the extended partition.

Use fdisk to determine how your drives are labled (sata disks will be sd* ide discs will be hd*) Once you know the labels and location of the drive then we will use fdisk to make the partitions
fdisk is a popular and powerful tool to split your disk into partitions. Fire up fdisk on your disk (in our example, we use /dev/hda):

Starting fdisk

Code:
 # fdisk /dev/hda (or whichever drive you choose to install on)
Once in fdisk, you'll be greeted with a prompt that looks like this:

fdisk prompt

Code:
    Command (m for help):

Type p to display your disk's current partition configuration: An ntfs is probably the only thing on the disk at this time.

An example partition configuration
Code:
Command (m for help): p

Disk /dev/hda: 240 heads, 63 sectors, 2184 cylinders
Units = cylinders of 15120 * 512 bytes

Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1        14    105808+  7  HPFS/NTFS
Now it's time to start to creating linux partitions. We will stick to just 3 partitions for this guide.

Code:
Command (m for help):n (for new partition)
Command action
  e   extended
  p   primary partition (1-4)

(we want to create a primary partition for /boot
 p
Partition number (1-4): 2
First cylinder (1-3876, default 1):(hit enter)
Using default value 1 (use first cylinder of partition for starting point)
Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): +32M (plenty for the /boot partition unless you like to test drive kernels.
Next we will create a swap partition. Opinions will vary on the size of a swap partition. Here's mine. For 256MB of memory run 512MB swap, for 512 & 1GB memory run 1GB swap, 2GB and over run 512MB swap. Feel free to use whatever you want though..

Code:
Command (m for help):n (for new partition)
Command action
  e   extended
  p   primary partition (1-4)

(we want to create a primary partition for swap
 p
Partition number (1-4): 3
First cylinder (1-3876, default 1):(hit enter)
Using default value 1 (use first cylinder of partition for starting point)
Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): +1G (or whatever size swap partition you decide)
 After you've done this, type t to set the partition type, 2 to select the partition you just created and then type in 82 to set the partition type to "Linux Swap"
Next we will create the root partition

Code:
Command (m for help):n (for new partition)
Command action
  e   extended
  p   primary partition (1-4)

(we want to create a primary partition for /
 p
Partition number (1-4): 4
First cylinder (1-3876, default 1):(hit enter)
Using default value 1 (use first cylinder of partition for starting point)
Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876):(hit enter to use rest of free space or enter the amount in M or G that you want to allocate)  

3b. Formatting the partitions

Introduction

Now that your partitions are created, it is time to place a filesystem on them. If you don't care about what filesystem to choose and are happy with what we use as default in this handbook, continue with Applying a Filesystem to a Partition. Otherwise read on to learn about the available filesystems...

Filesystems?

The Linux kernel supports various filesystems. We'll explain ext2, ext3, ReiserFS, XFS and JFS as these are the most commonly used filesystems on Linux systems.

ext2 is the tried and true Linux filesystem but doesn't have metadata journaling, which means that routine ext2 filesystem checks at startup time can be quite time-consuming. There is now quite a selection of newer-generation journaled filesystems that can be checked for consistency very quickly and are thus generally preferred over their non-journaled counterparts. Journaled filesystems prevent long delays when you boot your system and your filesystem happens to be in an inconsistent state.

ext3 is the journaled version of the ext2 filesystem, providing metadata journaling for fast recovery in addition to other enhanced journaling modes like full data and ordered data journaling. It uses an HTree index that enables high performance in almost all situations. In short, ext3 is a very good and reliable filesystem.

ReiserFS is a B+tree-based filesystem that has very good overall performance and greatly outperforms both ext2 and ext3 when dealing with small files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales extremely well and has metadata journaling. ReiserFS is solid and usable as both general-purpose filesystem and for extreme cases such as the creation of large filesystems, very large files and directories containing tens of thousands of small files.

XFS is a filesystem with metadata journaling which comes with a robust feature-set and is optimized for scalability. We only recommend using this filesystem on Linux systems with high-end SCSI and/or fibre channel storage and an uninterruptible power supply. Because XFS aggressively caches in-transit data in RAM, improperly designed programs (those that don't take proper precautions when writing files to disk and there are quite a few of them) can lose a good deal of data if the system goes down unexpectedly.

JFS is IBM's high-performance journaling filesystem. It has recently become production-ready and there hasn't been a sufficient track record to comment positively nor negatively on its general stability at this point.

For time proven stable filesystems use ext3 for root and ext2 for /boot

Reiserfs is best suited for partitions with many small files so as you progress through Linux and start breaking up partitions you can use the best file system for the type of files on that partition to maximize efficiency and speed up your apps.

There are 2 other file systems that I use as well. They are ext4 and Reiser4 and will require the use of the Justboot cd listed in the install media above.

If you want pure speed and are willing to make regular backups use Reiser4. It is still under development, has never caused me any problems but I still don't use it on critical data partitions as even a buggy kernel patch can kill the data.

3c. Applying a Filesystem to a Partition

To create a filesystem on a partition or volume, there are tools available for each possible filesystem:

Code:
Filesystem	Creation Command
  ext2	----               # mke2fs
  ext3 & 4 ----           # mke2fs -j
  reiserfs -----            # mkreiserfs
  xfs	   ----              # mkfs.xfs
  jfs	----                  # mkfs.jfs
  reiser4   --------        # mkfs.reiser4 (must use a custom cd such as justboot)
For instance, to have the boot partition (/dev/hda1 in our example) in ext2 and the root partition (/dev/hda3 in our example) in ext3 (as in our example), you would use:
Code:
  # mke2fs /dev/hda1
  # mke2fs -j /dev/hda3
Activating the Swap Partition

mkswap is the command that is used to initialize swap partitions:

Creating a Swap signature

Code:
 # mkswap /dev/hda2
To activate the swap partition, use swapon:

Code:
 # swapon /dev/hda2

3d. Mounting

Now that your partitions are initialized and are housing a filesystem, it is time to mount those partitions. Use the mount command. Don't forget to create the necessary mount directories for every partition you created. As an example we mount the root and boot partition:

Mounting partitions

Code:
 # mount /dev/hda3 /mnt/gentoo
 # mkdir /mnt/gentoo/boot
 # mount /dev/hda1 /mnt/gentoo/boot
4. Installing the Gentoo Installation Files

4.a Setting the Date/Time Right

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

To verify the current date/time, run date:

Code:
 # date
Fri Mar 29 16:21:18 UTC 2007
If the date/time displayed is wrong, update it using the date MMDDhhmmYYYY syntax (Month, Day, hour, minute and Year). At this stage, you should use UTC time. You will be able to define your timezone later on. For instance, to set the date to March 29th, 16:21 in the year 2007:

Code:
 # date 032916212007
4b. Using a stage from the internet

Downloading the Stage Tarball

Code:
 # cd /mnt/gentoo
For x86 (32bit) users

Code:
 # wget http://gentoo.mirrors.easynews.com/linux/gentoo/releases/x86/2007.0/stages/stage1-x86-2007.0.tar.bz2
For x86_64 users

Code:
 # http://gentoo.mirrors.easynews.com/linux/gentoo/releases/amd64/2007.0/stages/stage1-amd64-2007.0.tar.bz2

Code:
 # tar xvjpf stage1*
Make sure that you use the same options (xvjpf). The x stands for Extract, the v for Verbose to see what happens during the extraction process (optional), the j for Decompress with bzip2, the p for Preserve permissions and the f to denote that we want to extract a file, not standard input.

4c. Installing a Portage snapshot

You now have to install a Portage snapshot, a collection of files that inform Portage what software titles you can install, which profiles are available, etc.

Download and Install a Portage Snapshot

Code:
 # wget http://gentoo.mirrors.easynews.com/linux/gentoo/snapshots/portage-latest.tar.bz2
In the next step, we extract the Portage snapshot onto your filesystem. Make sure that you use the exact command; the last option is a capital C, not c.

Code:
 # tar xvjf portage-latest* -C /mnt/gentoo/usr
4d. Configuring the Compile Options

Compiler flags (Cflags) are an area with much controversy and many opinions, most of which do nothing but break packages, yet show no real world speed increase. Keep it simple at first.

Likewhoa has 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.

Code:
 # 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

Code:
# 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 have a dual processor system
* 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

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

Code:
 # 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 you have a dual processor rig
* 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)

Code:
 # 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)

Code:
 # 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

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

Code:
 # 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 / Core2 Duo-Quad

Code:
 # cd /mnt/gentoo/etc 
 # mv make.conf make.conf.original
 # wget http://weboperative.com/gentoo/nocona/x86/make.conf
64bit Core Duo / Core2 Duo-Quad

Code:
 # 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

Pentium2

Code:
 # 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

Pentium3

Code:
 # 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


Pentium-M

Code:
 # 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



32bit Pentium4

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

Code:
 # 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 or if you have hyperthreading enabled on a single core
* 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 (Prescott)

Code:
 # cd /mnt/gentoo/etc 
 # mv make.conf make.conf.original
 # wget http://weboperative.com/gentoo/p4-prescott/x86/make.conf
64bit Pentium4 (Prescott)

Code:
 # 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

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

Code:
 # 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

Code:
 # 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

Code:
 # 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)

Code:
 # 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

4e. Selecting Fast Mirrors

Code:
 # mirrorselect -s4 -o -D >> /mnt/gentoo/etc/make.conf
First -s4 says the number of mirrors to use. Change the 4 to something else if you want to have a diffrent number of mirrors. The -o is just so we can get output redirected and not written directlly to /etc/make.conf (which we don't want). The -D is for deep mode this means that mirrorselect will download about 100k from each mirror to get a better idea of thier speed. So if you have slow connection definitlly remove this

4f. Mounting /proc

Before chrooting you must mount procfs from the running livecd into the hard drive's newly extracted filesystem for stuff to operate properly while chrooted

Code:
 # mount -t proc proc /mnt/gentoo/proc
4g. Optional - Mounting /dev Into the extracted Stage

/dev on the livecd should be mounted into the chroot also as you may experience some difficulties setting up grub if your using a promise or other offboard ide card

Code:
 # mount -o bind /dev /mnt/gentoo/dev
4h.Copying the dns server address file into the base stage

resolv.conf is the primary file resposible 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 doesnot exist by default in the base system stage. We must copy /etc/resolv.conf to provide for the dns resolver configuration.

Code:
 # cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
4i. Chrooting

Chroot is defined in the manpage as " chroot - run command or interactive shell with special root directory"
"chroot" is short for "change root". After preparing the base system stage we need to change to the "new root" in the base stage.

Code:
 # chroot /mnt/gentoo /bin/bash
>> note: to leave the Gentoo base system chroot at any time type 'exit' once.

4j. Rehashing the $path environment

Code:
 # env-update && source /etc/profile
Syncing the Portage Tree

Code:
 # emerge --sync
>> note: You will recieve a message to update portage after the sync, do not do this now as it will draw in the dependancies with it and without having a base system installed it will fail. Portage will be updated during the bootstrap.

Selecting a Locale

Code:
 # nano -w /etc/locale.gen
 uncomment the locales you need (uncomment means remove the # sign from in front of the line)
 en_US ISO-8859-1
 en_US.UTF-8 UTF-8
(if you need other locales select them now)
(32 bit users only) Check and Change the Profile

Code:
 # ls -FGg /etc/make.profile
lrwxrwxrwx 1 root 46 2007-03-20 17:34 /etc/make.profile -> /usr/portage/profiles/default-linux/x86/no-nptl/
If you see no-nptl as the link, fix it.

Code:
 # unlink /etc/make.profile
 # ln -s /usr/portage/profiles/default-linux/x86/2007.0 /etc/make.profile
Code:
 # env-update && source /etc/profile
5. Installing the Gentoo Base System

5a. Bootstrapping the System

Code:
 # emerge --oneshot --nodeps gcc-config && USE="-* build bootstrap" emerge linux-headers && /usr/portage/scripts/bootstrap.sh
>> Note: This step takes a while so go find something to do. Time is about 1 hour on a C2D system, 1.5 hours for A64 and 3 hours on an AthlonXP.

5b. Rebuilding the toolchain

Now that the system has been bootstrapped we want to rebuild our toolchain so that it is built on top of itself. Thenen our system will be built using the updated toolchain.

Code:
 # emerge gcc-config linux-headers glibc binutils gcc libstdc++-v3 portage
>> Note: This will take as long as the bootstrap.

5c. Finish with the Bootstrap Process

Code:
 # emerge --deep system; emerge gettext; emerge --deep world; python-updater; emerge -Pv python
5d. Emerge system tools

Code:
 # emerge syslog-ng grub vixie-cron reiserfsprogs sysfsutils dhcpcd && USE="-zlib" emerge pciutils
5d. Adding tools to system runlevels

Code:
 # rc-update add syslog-ng default && rc-update add net.eth0 default && rc-update add vixie-cron default
5e. 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.

Code:
 # emerge ntp && rc-update add ntp-client default && ntpdate -u -b pool.ntp.org
5f. Setting the System's Timezone Symlink

List the timezone files in the system and find the timezone that closest matches your location on our big blue ball in the dark universe. Keep in mind they will not be added until after bootstrap or until after glibc compiles.


Code:
 Output of # ls /usr/share/zoneinfo/

Africa      Atlantic   Canada  EST5EDT  Factory  GMT-0      Iceland  Japan      MST7MDT  Navajo   Portugal   Turkey     W-SU         posixrules
America     Australia  Chile   Egypt    GB       GMT0       Indian   Kwajalein  Mexico   PRC      ROC        UCT        WET          right
Antarctica  Brazil     Cuba    Eire     GB-Eire  Greenwich  Iran     Libya      Mideast  PST8PDT  ROK        US         Zulu         zone.tab
Arctic      CET        EET     Etc      GMT      HST        Israel   MET        NZ       Pacific  Singapore  UTC        iso3166.tab
Asia        CST6CDT    EST     Europe   GMT+0    Hongkong   Jamaica  MST        NZ-CHAT  Poland   SystemV    Universal  posix
Now you must remove the default timezone symlink and create a new one which is linked to the timezone info file that matches your timezone. I'm currently in Mountain Standard Time Phoenix AZ so i chose /usr/share/zoneinfo/America/Phoenix as my timezone file. Note that locating the closest city in your timezone will help your system automatically adjust for daylight savings time changes appropriately. Replace /usr/share/zoneinfo/{path/to/your/timezonefile} in the code example below with the correct and appropriate timezone file for your location.

Code:
 # rm /etc/localtime
 # ln -s /usr/share/zoneinfo/{path/to/your/timezonefile} /etc/localtime
When you are finished you will want to run etc-update to merge all configuration files

Code:
 # etc-update
use the -5 option this time. ( You will want to be careful in the future with this option as -5 can overwrite the files you have edited.)
6. Installing the Kernel

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 lspci Output

Code:
 #lspci
00:00.0 Host bridge: Intel Corporation DRAM Controller (rev 02)
00:01.0 PCI bridge: Intel Corporation PCI Express Root Port (rev 02)
00:1a.0 USB Controller: Intel Corporation USB UHCI Controller #4 (rev 02)
00:1a.1 USB Controller: Intel Corporation USB UHCI Controller #5 (rev 02)
00:1a.2 USB Controller: Intel Corporation USB UHCI Controller #6 (rev 02)
00:1a.7 USB Controller: Intel Corporation USB2 EHCI Controller #2 (rev 02)
00:1d.0 USB Controller: Intel Corporation USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation USB UHCI Controller #3 (rev 02)
00:1d.7 USB Controller: Intel Corporation USB2 EHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)
00:1f.0 ISA bridge: Intel Corporation LPC Interface Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 6 port SATA AHCI Controller (rev 02)
00:1f.3 SMBus: Intel Corporation SMBus Controller (rev 02)
01:00.0 VGA compatible controller: nVidia Corporation G80 [GeForce 8800 GTS] (rev a2)
02:02.0 Multimedia audio controller: Creative Labs SB Audigy (rev 04)
02:02.1 Input device controller: Creative Labs SB Audigy Game Port (rev 04)
02:02.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port (rev 04)
02:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8110SC/8169SC Gigabit Ethernet (rev 10)
Example of lsmod Output

Code:
 # lsmod
Module ------------   Size - Used by
snd_seq_midi --------------   7168 --- 0
snd_emu10k1_synth -------- 6912 --- 0
snd_emux_synth ------------ 29696 -- 1 snd_emu10k1_synth
snd_seq_virmidi ------------  6144 --- 1 snd_emux_synth
snd_seq_midi_event -------- 7104 --- 2 snd_seq_midi,snd_seq_virmidi
snd_seq_midi_emul --------- 6144 --- 1 snd_emux_synth
snd_seq ---------------------  48064 -- 5 snd_seq_midi,snd_emux_synth,snd_seq_virmidi,snd_seq_midi_event,snd_seq_midi_emul
snd_pcm_oss ---------------- 39456 -- 0
snd_mixer_oss -------------- 14784 -- 1 snd_pcm_oss
coretemp -------------------- 6720 --- 0
hwmon ----------------------- 3208 --- 1 coretemp
uinput ------------------------ 8192 --- 1
nvidia ------------------------ 6999620 - 24
snd_emu10k1 --------------- 130064 -- 2 snd_emu10k1_synth
snd_rawmidi ---------------- 20768 --- 3 snd_seq_midi,snd_seq_virmidi,snd_emu10k1
snd_ac97_codec ------------ 106888 -- 1 snd_emu10k1
ac97_bus -------------------- 3008 ---- 1 snd_ac97_codec
snd_pcm -------------------- 73288 --- 3 snd_pcm_oss,snd_emu10k1,snd_ac97_codec
snd_seq_device ------------ 6544 ---- 4 snd_seq_midi,snd_emu10k1_synth,snd_emu10k1,snd_rawmidi
snd_timer ------------------ 19912 --- 3 snd_seq,snd_emu10k1,snd_pcm
snd_page_alloc ------------ 8592 ---- 2 snd_emu10k1,snd_pcm
snd_util_mem ------------- 4352 ---- 2 snd_emux_synth,snd_emu10k1
snd_hwdep ----------------  8136 ---- 2 snd_emux_synth,snd_emu10k1
snd ------------------------- 50168 --- 14 snd_emux_synth,snd_seq_virmidi,snd_seq,snd_pcm_oss,snd_mixer_oss,snd_emu10k1,snd_rawmidi,snd_ac97_codec,snd_pcm,snd_seq_device,snd_timer,snd_hwdep
floppy ---------------------- 57288 --- 0
soundcore ------------------ 6992 --- 1 snd
>> (Small note: lspci is part of pciutils, so use "emerge pciutils" if you don't have it.)

6b. Emerging Kernel

For this guide we will be using Gentoo-sources for our kernel. Part 2 of the guide will cover various other custom kernels, all of which have their own merits.

Code:
 # emerge gentoo-sources
6c. Configuring the Kernel

Introduction

Manually configuring a kernel is often seen as the most difficult procedure a Linux user ever has to perform. Nothing is less true -- after configuring a couple of kernels you don't even remember that it was difficult

However, one thing is true: you must know your system when you start configuring a kernel manually. Most information can be gathered by running lspci & lsmod (it might provide you with a nice hint on what to enable).

The default config from Gentoo will have most of the required options already selected, Go through each menu / submenu and use the "help" tab to find out what an option is. Take your time here, a properly configured kernel can reduce system load, improve system responsiveness and improve boot times. If you are not sure about something you can always shoot me a PM. Google searches or the Gentoo Wiki can also be of assistance. If none of these options shed the light for you, contact me and we will see if we can work out some remote assistance.

Now go to your kernel source directory and execute make menuconfig. This will fire up an ncurses-based configuration menu.


Code:
 cd /usr/src/linux
 make menuconfig
You will be greeted with several configuration sections. We'll first list some options you must activate (otherwise Gentoo will not function, or not function properly without additional tweaks).

Specifically you must change the following items to suit your configuration.

* General Setup --> leave as-is

* Enable loadable module support --> leave as-is

* Enable the block layer --> Change default I/O scheduler to CFQ

* Processor type and features --> Set Processor family, set or unset symmetric multiprocessing support and other multi-cpu options depending on CPU

* Bus Options --> enable PCI-Express if needed

* Networking support --> leave as is

* Device Drivers --> Go through each menu and enable only those items you need. Disable any that you don't

* Character devices - agpgart and agp chipset type, dri driver ( if required)
(Note that if your using an nvidia videocard it's best to leave the character devices as-is)

* Sound support ~>> Advanced Linux Sound Architecture ~~> Pci devices
Set the correct driver module for your soundcard here.(M)

Use a module as the alsa-utils package demands that at least one module be present for your system to use
the startup script correctly
Disable OSS support in sound support

USB support - Three primary items to be concerned with here...
If you have usb2 add the EHCI module as
The output recieved from lspci is important here as you cannot have both ohci AND uhci included.
You much choose one or the other and add it as a module
* EHCI HCD (USB 2.0) support
* OHCI HCD support
* UHCI HCD (most Intel and VIA) support

* File systems --> enable support for all file systems you intend to use, also enable joliet under CDROM and ntfs support if you plan to share files with your windows installation

This is a pretty quick run through on configuring a kernel but it should give you an idea of what to enable. Configuring a kernel is machine and user specific so covering everything is just not possible.

Once you are finished configuring the kernel, exit back out to the command line and execute this command.

Code:
 # make && make modules_install
Then copy the kernel image to /boot

>>Note. Type uname -r at the command prompt to get your kernel version

32 bit users

Code:
 # cp arch/i386/boot/bzImage /boot/ (output from uname -r )
64 bit users

Code:
 # cp arch/x86_64/boot/bzImage /boot/ (output from uname -r )
6c. Kernel Modules

For guide to keep things simple and avoid complications, I have had you configure the kernel with everything but the sound driver built in. As you learn to configure kernels I recommend configuring the kernel using modules anywhere you can. A dynamically loading system will save valuable memory address space in your system kernel, decrease boot times and give you control over wether a modules is loaded or not. (i.e. I rarely use ntfs support in linux but I do use it. Compiled as a module I can enable it when needed then disable it when I am done.) lsmod is your eyes into a running modular linux system but it's only usable with modules.

Configuring the Modules

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:

Code:
 # find /lib/modules// -type f -iname '*.o' -or -iname '*.ko'
For instance, to automatically load the 3c59x.ko module, edit the kernel-2.6 file and enter the module name in it.

We will be using nano as the default editor for this guide, there are a few others but nano is the easiest to work with. After altering your files use CTRL+X, then ENTER to save the file as you have written it.

Code:
 # nano -w /etc/modules.autoload.d/kernel-2.6
3c59x
>> Tip: You can use "echo" to speed up the process of adding a line to /etc/modules.autoload.d/kernel-2.6 or any other file for that matter

Using the 3c59x example from above the command would be:

Code:
 # echo "3c59x" >> /etc/modules.autoload.d/kernel-2.6
Next we will run update-modules

Code:
 # update-modules
7. Configuring the system

7a. Filesystem Information

What is fstab?

Under Linux, all partitions used by the system must be listed in /etc/fstab. This file contains the mount points of those partitions (where they are seen in the file system structure), how they should be mounted and with what special options (automatically or not, whether users can mount them or not, etc.)

Creating /etc/fstab

/etc/fstab uses a special syntax. Every line consists of six fields, separated by whitespace (space(s), tabs or a mixture). Each field has its own meaning:

* The first field shows the partition described (the path to the device file)
* The second field shows the mount point at which the partition should be mounted
* The third field shows the filesystem used by the partition
* The fourth field shows the mount options used by mount when it wants to mount the partition. As every filesystem has its own mount options, you are encouraged to read the mount man page (man mount) for a full listing. Multiple mount options are comma-separated.
* The fifth field is used by dump to determine if the partition needs to be dumped or not. You can generally leave this as 0 (zero).
* The sixth field is used by fsck to determine the order in which filesystems should be checked if the system wasn't shut down properly. The root filesystem should have 1 while the rest should have 2 (or 0 if a filesystem check isn't necessary).

Code:
 # nano -w /etc/fstab
Let us take a look at how we write down the options for the /boot partition. This is just an example, if you didn't or couldn't create a /boot, don't copy it.

In our default partitioning example, /boot is usually the /dev/hda2 partition (or /dev/sda* if you use SCSI or SATA drives), with ext2 as filesystem. It needs to be checked during boot, so we would write down:

Code:
 /dev/hda1   /boot     ext2    defaults        1 2
Some users don't want their /boot partition to be mounted automatically to improve their system's security. Those people should substitute defaults with noauto. This does mean that you need to manually mount this partition every time you want to use it. ( I never automount the boot partition, there is no need)

Add the rules that match your partitioning scheme and append rules for your CD-ROM drive(s), and of course, if you have other partitions or drives, for those too.

Now use the example below to create your /etc/fstab:

Code:
 
/dev/hda1   /boot        ext2    defaults,noatime     1 2
/dev/hda2   none         swap    sw                   0 0
/dev/hda3   /            ext3    noatime              0 1

/dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0
auto makes mount guess for the filesystem (recommended for removable media as they can be created with one of many filesystems) and user makes it possible for non-root users to mount the CD.

To improve performance, most users would want to add the noatime mount option, which results in a faster system since access times aren't registered (you don't need those generally anyway).

Double-check your /etc/fstab, save and quit to continue.

>> Note the default config is pretty close and should only need minor alterations to the /dev lines and to fix the typo on the CDROM line, also replace ro with user on the CDROM line so the drive will be mountable to all users.

7b. Networking Information

Host name, Domainname, etc

One of the choices the user has to make is name his/her PC. This seems to be quite easy, but lots of users are having difficulties finding the appropriate name for their Linux-pc. To speed things up, know that any name you choose can be changed afterwards. For all we care, you can just call your system tux and domain homenetwork.

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

(Set the HOSTNAME variable to your host name)
HOSTNAME="tux"
Second, if you need a domainname, set it in /etc/conf.d/net. You only need a domain if your ISP or network administrator says so, or if you have a DNS server but not a DHCP server. You don't need to worry about DNS or domainnames if your networking is setup for DHCP.

Code:
 # nano -w /etc/conf.d/net

(Set the dns_domain variable to your domain name)
dns_domain_lo="homenetwork"
If you have a NIS domain (if you don't know what that is, then you don't have one), you need to define that one too:

Code:
# nano -w /etc/conf.d/net

(Set the nis_domain variable to your NIS domain name)
nis_domain_lo="my-nisdomain"
All networking information is gathered in /etc/conf.d/net. It uses a straightforward yet not intuitive syntax if you don't know how to set up networking manually. But don't fear, we'll explain everything. A fully commented example that covers many different configurations is available in /etc/conf.d/net.example.

If you need to configure your network connection either because you need specific DHCP options or because you do not use DHCP at all, open /etc/conf.d/net with your favorite editor (nano is used in this example):

Code:
 # nano -w /etc/conf.d/net
You will see the following file:

Code:
 # This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
To use DHCP and add specific DHCP options, define config_eth0 and dhcp_eth0:

Code:
config_eth0=( "dhcp" )
dhcp_eth0="nodns nontp nonis"
To enter your own IP address, netmask and gateway, you need to set both config_eth0 and routes_eth0:

Code:
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
routes_eth0=( "default via 192.168.0.1" )
Please read /etc/conf.d/net.example for a list of all available options.

If you have several network interfaces repeat the above steps for config_eth1, config_eth2, etc.

Now save the configuration and exit to continue.

Code:
# cd /etc/init.d
# ln -s net.lo net.eth1
# rc-update add net.eth1 default
Writing Down Network Information

You now need to inform Linux about your network. This is defined in /etc/hosts and helps in resolving host names to IP addresses for hosts that aren't resolved by your nameserver. You need to define your system. You may also want to define other systems on your network if you don't want to set up your own internal DNS system.

Code:
# nano -w /etc/hosts
Code:
This defines the current system)
127.0.0.1     tux.homenetwork tux localhost

(Define extra systems on your network,
they need to have a static IP to be defined this way.)
192.168.0.5   jenny.homenetwork jenny
192.168.0.6   benny.homenetwork benny
7c. System Information

First we set the root password by typing:

Code:
 # passwd
System Information

Gentoo uses /etc/conf.d/keymaps to handle keyboard configuration. Edit it to configure your keyboard.

Code:
 # nano -w /etc/conf.d/keymaps
Take special care with the KEYMAP variable. If you select the wrong KEYMAP, you will get weird results when typing on your keyboard.

When you're finished configuring /etc/conf.d/keymaps, save and exit.

Gentoo uses /etc/conf.d/clock to set clock options. Edit it according to your needs.

Code:
 # nano -w /etc/conf.d/clock
If your hardware clock is not using UTC (ie if you dual boot with Windows), you need to add CLOCK="local" to the file. Otherwise you will notice some clock skew.

You should define the timezone that you previously copied to /etc/localtime so that further upgrades of the sys-libs/timezone-data package can update /etc/localtime automatically. For instance, if you used the GMT timezone, you would add TIMEZONE="GMT" (Mine is America/Phoenix, check under /etc/localtime/America for your timezone)

When you're finished configuring /etc/conf.d/clock, save and exit.

9. Configuring the Bootloader

9a. Using GRUB

Understanding GRUB's terminology

The most critical part of understanding GRUB is getting comfortable with how GRUB refers to hard drives and partitions. Your Linux partition /dev/hda1 (for IDE drives) or /dev/sda1 (for SATA/SCSI drives) will most likely be called (hd0,0) under GRUB. Notice the parentheses around the hd0,0 - they are required.

Hard drives count from zero rather than "a" and partitions start at zero rather than one. Be aware too that with the hd devices, only hard drives are counted, not atapi-ide devices such as cdrom players and burners. Also, the same construct is used with SCSI drives. (Normally they get higher numbers than IDE drives except when the BIOS is configured to boot from SCSI devices.) When you ask the BIOS to boot from a different hard disk (for instance your primary slave), that harddisk is seen as hd0.

Assuming you have a hard drive on /dev/hda, a cdrom player on /dev/hdb, a burner on /dev/hdc, a second hard drive on /dev/hdd and no SCSI hard drive, /dev/hdd7 gets translated to (hd1,6). It might sound tricky and tricky it is indeed, but as we will see, GRUB offers a tab completion mechanism that comes handy for those of you having a lot of hard drives and partitions and who are a little lost in the GRUB numbering scheme.

Configuring and Installing Grub

Code:
 # nano -w /boot/grub/grub.conf
If you followed the partitioning layout in this guide your grub.conf will look like this:

Code:
 
# Which listing to boot as default. 0 is the first, 1 the second etc.
default 0
# How many seconds to wait before the default listing is booted.
timeout 30

title=Gentoo Linux 
# Partition where /boot is located
root (hd0,1)
kernel /boot/ root=/dev/hda4

title=Gentoo Linux (rescue)
# Partition where the kernel image (or operating system) is located
root (hd0,1)
kernel /boot/ root=/dev/hda3 init=/bin/bb

# The next four lines are only if you dualboot with a Windows system.
# In this case, Windows is hosted on /dev/hda0.
title=Windows XP
rootnoverify (hd0,0)
makeactive
chainloader +1
Setting up GRUB using grub-install

To install GRUB you will need to issue the grub-install command. However, grub-install won't work off-the-shelf since we are inside a chrooted environment. We need to create /etc/mtab which lists all mounted filesystems. Fortunately, there is an easy way to accomplish this - just copy over /proc/mounts to /etc/mtab, excluding the rootfs line if you haven't created a separate boot partition. The following command will work in both cases:

Code:
 # grep -v rootfs /proc/mounts > /etc/mtab
Now we can install GRUB using grub-install:

Code:
 # grub-install --no-floppy /dev/hda
9c.Tweaking Device Access Parameters

We've gone throught he procedures above for utilizing hdparm for obtaining the fastest i/o transfer modes for your hard drive however the changes made only affect the livecd's running kernel therefore we should setup hdparm for the installation that you have created so that performance is maintained after booting into your running system. Allot of very useful options for Gentoo Linux dwell in /etc/conf.d This time we are to be concerned with the contents of /etc/conf.d/hdparm Below you will see an example of hdparm's config file. Change to suit the layout of your disks for your system appropriately. Each device may need the modes set for your systems hardware configuration. Here's a typical configuration for a system with one cdrom and hard disk. You can safely skip this step if using sata or scsi.

Code:
 # nano -w /etc/conf.d/hdparm

 # Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-conf.d.3,v 1.2 2004/09/06 02:17:08 swegener Exp $

# You can either set hdparm arguments for each drive using hdX_args,
# discX_args, cdromX_args and genericX_args, e.g.
#

hda_args="-d1c1u1m16"

# disc1_args="-d1"

cdrom0_args="-d1c1u1"

# or, you can set hdparm options for ALL drives using all_args, e.g.
#
#all_args="-d1"
After editing the contents of /etc/conf.d/hdparm type the following command to add hdparm to the boot runlevel

Code:
 # rc-update add hdparm boot
9d. Rebooting the System

Exit the chrooted environment and unmount all mounted partitions. Then type in that one magical command you have been waiting for: reboot.

Code:
 # exit
 ~# cd
 ~# umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
 ~# reboot
Now that you have a working Gentoo system, it is time to get a desktop environment installed and working.

On to page2.
__________________

Last edited by ccperf721p; 21st February, 2009 at 02:20 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #2 (permalink)  
Old 1st November, 2007, 09:49 PM
Member
 
Join Date: April 2005
Location: AZ
Posts: 2,446

10. Post install clean up and creating user accounts

After you log in as root we will remove the installation folders downloaded at the beginning of the guide

Code:
 # rm /*.tar.bz2
[b]10a. User Administration[/color]

Adding a User for Daily Use

Working as root on a Unix/Linux system is dangerous and should be avoided as much as possible. Therefore it is strongly recommended to add a user for day-to-day use.

The groups the user is member of define what activities the user can perform. The following table lists a number of important groups you might wish to use:

Code:
Group  	Description
audio -->	be able to access the audio devices
cdrom -->      be able to directly access optical devices
floppy -->	be able to directly access floppy devices
games -->      be able to play games
portage -->    be able to use emerge --pretend as a normal user
usb -->        	 be able to access USB devices
plugdev -->    Be able to mount and use pluggable devices such as cameras and USB sticks
video -->       be able to access video capturing hardware and doing hardware acceleration
wheel -->      be able to use su
To create a user account for a primary user with access to everything run the following command

Code:
 
 # groupadd games
 # groupadd plugdev
 # useradd -m -G users,wheel,video,audio,plugdev,games,cdrom,portage,usb,cron -s /bin/bash 
 # passwd  
>> Note: Do not add any user to the wheel group you do not want to have root privileges. (Usually you will be the only member of the wheel group)

Installing Sudo

Sudo is an app to allow users temporary root privileges without logging in as root, as soon as it runs the command or commands it drops root privileges. Sudo also gives you the ability to control which users can run commands. I will assume you are on a single user computer not get to in depth on sudo for this guide. I will add a linux security section in the FAQ portion at some point just to keep the guide going with decent material.

Code:
 # emerge sudo
Next we will configure sudo to allow users in the wheel group to run all commands

Code:
 # visudo
scroll to and uncomment (remove the # sign) this line > %wheel ALL=(ALL)       ALL
> Note: To use sudo, log in as the user you created, lets say you wanted to install foo, you would type # sudo emerge foo , sudo will ask for the password, you use your user password and not your root password.

Lets move on to installing X server

11. Installing X server

11a. Configuring the make.conf variables

Use variables

The ideas behind USE flags

When you are installing Gentoo (or any other distribution, or even operating system for that matter) you make choices depending on the environment you are working with. A setup for a server differs from a setup for a workstation. A gaming workstation differs from a 3D rendering workstation.

This is not only true for choosing what packages you want to install, but also what features a certain package should support. If you don't need OpenGL, why would you bother installing OpenGL and build OpenGL support in most of your packages? If you don't want to use KDE, why would you bother compiling packages with KDE support if those packages work flawlessly without?

I have put together a list of use flags that will give most users everything they need to have a fully functioning multi-media capable system. It will still need slight changes depending on your machine and which Desktop Environment you choose. (Check section 12 and pick your Desktop environment. before altering your use flags If you choose to run KDE add these to the USE= line > kde qt3 qt4 qt3support , if you choose to run gnome add > gnome gtk to the line

>> Note: Before emerging a package use -pv (--pretend --verbose) to see what Use flags it will use. Example: # emerge -pv sudo.
Code:
 # nano -w /etc/make.conf 

USE="a52 aac acpi alsa bash-completion -bindist cairo cdr dbus dvd dvdr dvdread encode ffmpeg firefox flac gif glitz hal -ipv6 jpeg jpeg2k lm_sensors logrotate mad mmx mp3 mp4 mpeg nptl nptlonly opengl openntpd pdf png sse sse2 spell symlink theora tiff truetype type1 usb vorbis win32codecs X xcomposite xine xv"
Also check Gentoo-Portage - USE Flags for a list of Use flags and there descriptions.

>> Note: Try to stay light on Use flags, if you have a specific package that needs a certain use flag you can allow the Use flag for just that package instead of system wide by using /etc/portage/package.use. As an example, I compile pciutils with the -zlib flag set, but this will break other packages if set system wide so:

Code:
 # nano -w /etc/portage/package.use
 sys-apps/pciutils* - zlib (the star indicates any version of that app)
You can also use echo to accomplish this. # echo "sys-apps/pciutils* -zlib" >> /etc/portage/package.use

Video Cards and Input Devices

Next we will add a couple of lines to the make.conf

Code:
 # nano -w /etc/make.conf 

(use "nvidia" for nvidia cards   11b. Emerging X-server 

With over 100 packages this step will take a while. Find something to do for 1.5 hours or so

Code:
 # emerge xorg-x11
When it's finished reinitialize the environment

Code:
 # env-update
# source /etc/profile
Configuring Xorg

The configuration file of Xorg is called xorg.conf and it resides in /etc/X11. The Xorg-X11 package provides an example configuration as /etc/X11/xorg.conf.example which you can use to create your own configuration. It is heavily commented, but if you are in need of more documentation regarding the syntax, don't hesitate to read the man page, but it is not necessary

Code:
 # man 5 xorg.conf
Xorg itself is able to guess most parameters for you. In most cases, you will only have to change some lines to get the resolution you want up and running. If you are interested in more in-depth tweaking, be sure to check the resources at the end of this chapter. But first, let us generate a (hopefully working) Xorg configuration file.

Generating an xorg.conf file

Code:
 # Xorg -configure
Be sure to read the last lines printed on your screen when Xorg has finished probing your hardware. If it tells you it failed at some point, you're forced to manually write an xorg.conf file. Assuming that it didn't fail, it will have told you that it has written /root/xorg.conf.new ready for you to test. So let's test.

Code:
 # X -config /root/xorg.conf.new
If all goes well, you should see a simple black and white pattern. Verify if your mouse works correctly and if the resolution is good. If you received errors about "/dev/mouse", try changing your mouse device to /dev/input/mice in the "InputDevice" section of xorg.conf. You might not be able to deduce the exact resolution, but you should be able to see if it's too low. You can exit any time by pressing Ctrl-Alt-Backspace.

If this does not work try:

Semi-Automatic Generation of xorg.conf

Xorg provides a tool called xorgconfig which will ask you for various information regarding your system (graphical adapter, keyboard, ...). Based on your input it will create a xorg.conf file.

Code:
 # xorgconfig
Go through the questions, answer no to the card database question as we will load binary drivers from nvidia or ati

After running xorgconfig we will need to edit xorg.conf

Code:
 # nano -w /etc/X11/xorg.conf 
 nvidia users uncomment the "Load glx" line > ATI users uncomment the "Load glx and Load dri" lines
 Scroll down to "Section Device" nvidia users will change > Driver "vga" to Driver "nvidia"  flgrx users will change it to flgrx. 
 CTRL + X to save and exit
Nvidia users:
Code:
# eselect opengl set nvidia
# env-update; source /etc/profile
ATI users:
Code:
 eselect opengl set ati 
# env-update; source /etc/profile
Lets find out if our config works

Code:
 # startx
If you get a screen with a few white boxes then your set and it is time to install a desktop environment

>> Note:: These are basic configs for the video section, they will have hardware accleration but there are many more features that can be enable for both sets of drivers. I hope to cover these options soon enough in a part 3 of the guide..

12. Installing a Desktop Environment

Choices, Choices

There are many choices for a Desktop Environment under Linux. The two most popular are Gnome and KDE for full featured Desktops with programs to handle most tasks built in. If you are working with an old system running a small amount of memory you may also want to look into Xfce4 and Fluxbox

To help you decide I have included links to KDE and Gnome. Take a look at the feature set offered by both, decide what you need then emerge it.

K Desktop Environment - Conquer your Desktop!

GNOME: The Free Software Desktop Project

Code:
 # emerge kde
Code:
 # emerge gnome
Both Desktop environments take a while to compile so take a break or scratch a honey-do off the list.

Once they are compiled we need to edit a couple of files to let Gentoo know which Window manager and Desktop environment we will be using.

For KDE users:

Code:
 # nano -w /etc/rc.conf

scroll down and change the line to this  XSESSION="kde-3.5"
We will also need to change the Display manager

Code:
 # nano -w /etc/conf.d/xdm
 scroll and change DISPLAYMANGER="xdm" to DISPLAYMANGER="kdm"
For Gnome users:

Code:
 # nano -w /etc/rc.conf

 Uncomment the XSESSION line
Changing the display manager
Code:
 # nano -w /etc/conf.d/xdm

 scroll and change DISPLAYMANGER="xdm" to DISPLAYMANGER="gdm"
Now run these commands to set run levels for hald dbus and xdm

Code:
 # rc-update add hald default
 # rc-update add xdm default
I usually just reboot at this point

Code:
 shutdown -r now
After reboot you will be greeted with a login screen and will now have a working desktop environment..

Welcome to Gentoo Linux and open source freedom..

Sources:
LikeWhoa
Gentoo.org: Gentoo Linux -- Gentoo Documentation Resources
Official IRC Channel: irc.freenode.net #gentoo
Official Gentoo Linux Guides: Gentoo Linux -- Gentoo Documentation Resources
Official Gentoo Overlays: Gentoo Overlays
Forums: Gentoo Forums :: Index
Gentoo Wiki: Main Page - Gentoo Linux Wiki
Grub Error Collection: Gentoo Linux Documentation -- Gentoo Grub Error Collection
__________________
Biostar TForce X58 - Core i7 920 - 12GB Corsair Dominator DDR3 - EVGA 560ti - PCP&C 750W - Dual boot, Arch Linux/WinXP
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3 (permalink)  
Old 1st November, 2007, 09:50 PM
Member
 
Join Date: April 2005
Location: AZ
Posts: 2,446

Reserved for FAQ and bug fixes
__________________
Biostar TForce X58 - Core i7 920 - 12GB Corsair Dominator DDR3 - EVGA 560ti - PCP&C 750W - Dual boot, Arch Linux/WinXP
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AOA Gentoo Install Guide ccperf721p OS, Software, Firmware, and BIOS 20 23rd December, 2007 08:04 PM
USB Flash Drive under Gentoo Gizmo OS, Software, Firmware, and BIOS 5 6th July, 2005 10:16 AM
Gentoo installation issue... Áedán OS, Software, Firmware, and BIOS 5 9th December, 2004 11:14 PM
Geforce2 TV Out on Gentoo Áedán OS, Software, Firmware, and BIOS 7 15th February, 2004 07:32 PM
PMS Guide for Men Betty Mookydooky's Just for laughs! 3 17th June, 2002 06:34 PM


All times are GMT +1. The time now is 06:06 AM.


Copyright ©2001 - 2010, AOA Forums
Don't Click Here Don't Click Here Either

Search Engine Friendly URLs by vBSEO 3.3.0