View previous topic :: View next topic |
Author |
Message |
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Sat Aug 02, 2008 8:56 pm Post subject: Instant Rice Guide - The likewhoa recipe (Gentoo Install) |
|
|
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 Instant RICE (sorry no CFLAGS ricing like the good ol' -mrice -omg-optimized days) Guide or The likewhoa recipe (Gentoo Install) is written for users new to Gentoo and advanced users that are looking to get the most out of a fresh install that implements, Linux Software RAID (mdadm) & The Logical Volume Manager (lvm2), plus a host or other great ingredients to get the most out of your hardware components. This guide uses the unstable keywords ~x86 & ~amd64; Futhermore we will set file system optimization tweaks, multiple filesystems for various directories & good ol ricing but not enough to grow you some chest hair for that you'll need to add "-mrice -omg-chest-hair" CFLAGS. Anyways, get ready to have your hardware rawr!!! but first there are a some minimum requirements which must be met before you begin.
- Users with less than two hard drives. "RAID requirement."
- Users with less than 256MB of RAM. "512MB or more is recommended. 1024K for liveDVD"
1b. User Agreement
NOT Following directions will not get you Instant RICE and this recipe will only work if you follow it's directions. Remember it's not as hard as it looks just stay focus and get it done. Finally I like to add that the Gentoo Linux Foundation is in no way interested in breaking your system nor supports this guide. By following the instructions below, you agree to take full responsibility. You may not blame me or any contributors if you skip, break, melt or explode your system. Help is NOT guaranteed, but will be provided on the basis that you followed directions in this guide alone. Good luck and don't worry it's only RICE.
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 Minimal CD/InstallCD
The Gentoo Install CDs 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 Install CDs 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 stage file), source code or precompiled packages.
For example the amd64 variant of this Minimal Install CD can be found in the releases/amd64/2008.0/installcd/ subdirectory and is called install-amd64-minimal-2008.0.iso.
2b. Alternative Install CDs
- JustBOOT ™
The JustBOOT is a customized Gentoo variant Install CD maintained by me and should be used when dealing with very new hardware. for example some Minimal Install CDs will fail to identify your system's SATA/IDE,Ethernet & WIFI devices; thus using this Install CD will JustBOOT ™. You will need to manually pick the Install CD to download as they are archived by release date.
- System Rescue CD
SystemRescueCd is a Linux system on a bootable CD-ROM for repairing your system and recovering your data after a crash. It aims to provide an easy way to carry out admin tasks on your computer, such as creating and editing the partitions of the hard disk. It contains a lot of system utilities (parted, partimage, fstools, ...) and basic tools (editors, midnight commander, network tools). It is very easy to use: just boot the CDROM. The kernel supports most of the important file systems (ext2/ext3, reiserfs, reiser4, xfs, jfs, vfat, ntfs, iso9660), as well as network filesystems (samba and nfs).
Disclaimer:
Above Install CDs are NOT affiliated with Gentoo.
USE these Install CDs at your own risk.
2c. Downloading and Burning the Install CD
We'll first start by downloading and burning the chosen Install CD. We previously discussed the available Install CDs, but where can you find them?
You can download the Installation CDs from one of the Gentoo mirrors or via a torrent.
Inside that directory you'll find the ISO images (Gentoo and JustBOOT ONLY). 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 installcd-amd64-minimal-2008.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 Install CD Architecture?
32bit or 64bit? The choice is yours. (x86 Processors ONLY)
If you know for sure that your CPU is 64bit capable then download the amd64-minimal, otherwise download the 32bit x86-minimal install cd. If you're not completely sure and want to know if your processor is 64bit capable then just download the x86 Install CD.
Note: for networkless installs you will need to download the Gentoo Universal LiveCD instead.
Keep in mind the following tips.
- Commands begin after the "#" symbol.
- 32bit configuration commands will be highlighted in RED
- 64bit configuration commands will be highlighted in BLUE
- 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.
- If a command fails, make sure to scroll to the FAQ section, which should have solutions for most common compile errors.
- 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/Phenom Processors.
- AMD Sempron "E6 (Part No.: *BX)".
- Processor that shows the "ln" flag with "cat /proc/cpuinfo"
2e. Downloading the Install CD
Below are links to both the Official Gentoo Linux Install CD and my own customized Linux Install CD. 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 Install CDs only.
32bit Gentoo Install CD (Check the current-iso directory to get the latest iso for you!)
64bit Gentoo Install CD
Alternative Install CDs
JustBOOT Install CD
Pick your download medium here.
System Rescue CD
Pick your download medium here.
Burning the Installation CD
Replace installcd.iso with the name of your ISO image file. I will provide several ways to burn the iso image below.
Using cdrecord tool
Code: | # cdrecord -v -dao dev=/dev/dvd driveropts=burnfree installcd.iso |
If your system doesn't supply cdrecord try replacing "cdrecord" with "wodim".
Using growisofs to burn the image
Code: | # growisofs -Z /dev/dvd=installcd.iso |
Using K3B
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 Installation CD
Quote: |
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 Install CD.
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 Install CD with custom boot options by specifying a kernel followed by boot options and then hitting Enter.
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 -g". I will explain this later in the guide.
First let's give the 'virtual' install cd root account a password, since this is auto scrambled by the install cd for security purposes. you can also type:
Gain root access.
Change root password.
Starting the SSHD server.
Code: | # rc-service 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.
To set the optimized settings for the installation cd do the following.
Code: | # hdparm -d1c1u1 /dev/cdroms/cdrom0 |
Optional setting.
Code: | # hdparm -d1c1u1m16 /dev/hda |
3c. Setting Up the Network
2008.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.
View network settings.
Test network connection.
Code: | # ping -c3 google.com |
If you see packet traffic it's time to continue. If not head over to Gentoo's irc chans for user support (Gentoo InstallCD/DVD ONLY). Also see references at the bottom of this guide.
Quote: | note: Before heading over to irc, try running net-setup from the Install CD. This will usually set things up properly. |
Quote: | TIP: Sometimes 'net-setup eth0' doesn't work but 'net-setup eth1' will. |
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.
The Partition Layout
Quote: |
/dev/sda1 = 15MB -> /boot
/dev/sda2 = 2GB -> Linux SWAP
/dev/sda3 = 2GB -> /
/dev/sda4 = "remaining space or about 70GB for LVM2" |
Quote: | 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 of your ram.
After setting up your partition table, you can copy the partition schema to another identical drive using sfdisk. |
Example:
Code: | # sfdisk /dev/sda -d | sfdisk /dev/sdb |
After completion you should have a layout similar to this.
Code: | # 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.
RAID levels 101.
Remember that even though some of the raid levels explained below provide redundancy against one or more failed drives, Raid is not a subtitute for backups and "# rm important_data" removes all copies on the raid array set. This guide focuses on using RAID0 so keep backups outside of the array or use one of the fault tolerance raid levels that I will explain below. For this guide i will explain raid levels 0,1,5 & 6 only.
- RAID0 - Striped Disk Array without Fault Tolerance
RAID Level 0 requires a minimum of 2 drives to implement
Advantages:
RAID 0 implements a striped disk array, the data is broken down into blocks and each block is written to a separate disk drive I/O performance is greatly improved by spreading the I/O load across many channels and drives. Best performance is achieved when data is striped across multiple controllers with only one drive per controller. No parity calculation overhead is involved
Disadvantages:
Not a "True" RAID because it is NOT fault-tolerant. The failure of just one drive will result in all data in an array being lost. Should never be used in mission critical environments or without keeping backups of the array contents.
- RAID1 - Mirroring
For Highest performance, the controller must be able to perform two concurrent separate Reads per mirrored pair or two duplicate Writes per mirrored pair.
RAID Level 1 requires a minimum of 2 drives to implement
Advantages:
One Write or two Reads possible per mirrored pair. Twice the Read transaction rate of single disks, same Write transaction rate as single disks
100% redundancy of data means no rebuild is necessary in case of a disk failure, just a copy to the replacement disk. Transfer rate per block is equal to that of a single disk
Disadvantages:
Highest disk overhead of all RAID types (100%) - inefficient
- RAID5 - Independant Data Disk & Distributed Single Parity Blocks.
Each entire data block is written on a data disk; parity for blocks in the same rank is generated on Writes, recorded in a distributed location and checked on Reads. RAID Level 5 requires a minimum of 3 drives to implement
Advantages:
Highest Read data transaction rate. Medium Write data transaction rate. Low ratio of ECC (Parity) disks to data disks means high efficiency. Good aggregate transfer rate.
Disadvantages:
Disk failure has a medium impact on throughput. Difficult to rebuild in the event of a disk failure (as compared to RAID level 1). Individual block data transfer rate same as single disk
- RAID6 - Independent Data Disks with Two Independent Distributed Parity Schemes.
Two independent parity computations must be used in order to provide protection against double disk failure. Two different algorithms are employed to achieve this purpose. RAID Level 6 requires a minimum of 4 drives to implement
Advantages:
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). Data is striped on a block level across a set of drives, just like in RAID 5, and a second set of parity is calculated and written across all the drives; RAID 6 provides for an extremely high data fault tolerance and can sustain multiple simultaneous drive failures. Perfect solution for mission critical applications
Disadvantages:
Requires N+2 drives to implement because of dual parity scheme.
Now that you learned more information on the different raid levels we can continue to load the require modules.
Loading require raid modules.
Code: | # for i in raid0 raid1 raid456; do modprobe $i;done |
Create RAID1 for /boot partition.
Code: | # mdadm --create /dev/md0 /dev/sd[ab]1 --level=1 --raid-devices=2 |
Create RAID0 for /.
Tip: The chunk a.k.a stripe value will be used later to determent the file system extended options, which will increase I/O performance.
Code: | # mdadm --create /dev/md1 /dev/sd[ab]3 --level=0 --chunk=128 --raid-devices=2 |
Create RAID0 for LVM2 physical volume.
Code: | # mdadm --create /dev/md2 /dev/sd[ab]4 --chunk=128 --level=0 --raid-devices=2 |
Monitoring units until they are fully synched. (raid1,5 or 6 ONLY)
Code: |
# watch -n1 cat /proc/mdstat |
Check detailed information about the arrays.
4b. Create the 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.
Code: | # pvcreate /dev/md2 |
4c. Create LVM2 Volume Group
We will now create the Volume Group from the newly created physical volume.
Code: | # 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.
Code: |
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.
Display Logical Volumes.
5. File Systems and Mounting
We will focus on tweaking the ext2 & ext3 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. Note that if you decided to use RAID5 or 6 you'll need to change both the stride and stripe-width extended options accordanly. The formula used in this guide to obtain "stride=32,stripe-width=64" was calculated by dividing the raid chunk value of 128k by the filesystem block value of 4k which equals to 32k then was multiplied by the number of drives in the array & that got us a stripe-width of 64.
Tip: RAID5 which uses single parity calculations the number of drives is subtracted by one and by two with RAID6 since it provides double parity calculation.
Create FS for /boot.
Code: | # mke2fs -L boot /dev/md0 |
Create FS for /.
Code: | # mke2fs -L root -j -b 4096 -E stride=32,stripe-width=64 /dev/md1 |
5a. Create FS for LVM2 Logical Volumes.
Code: |
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,stripe-width=64 /dev/lvg/opt
mke2fs -L portage -b 1024 -E stride=8,stripe-width=16 -N 200000 /dev/lvg/portage
mke2fs -L vartmp /dev/lvg/vartmp
mke2fs -L distfiles -b 4096 -E stride=32,stripe-width=64 /dev/lvg/distfiles
|
5b. Creating and Starting Swap.
I will present 2 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.
- 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.
- SWAP on RAID5 "Striped with Single Parity"
Highest Read data transaction rate & Medium Write data transaction rate.
- 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.
Code: |
# mkswap /dev/sda2 && mkswap /dev/sdb2
# swapon -p 1 /dev/sda2 && swapon -p 1 /dev/sdb2
|
Confirm SWAP is on and priorities match.
5c. Mounting the partitions.
Mount / partition.
Code: | # mount /dev/md1 /mnt/gentoo |
Mount /boot partition.
Code: |
# mkdir /mnt/gentoo/boot
# mount /dev/md0 /mnt/gentoo/boot
|
Mount LVM2 volumes.
Code: |
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.
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 Wed Apr 17 21:28:12, in the year 2013.
Code: | # date 041721282013 |
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) gaining your hardware great performance and stability.
Note: Remember only download one of the stages. you may also check Gentoo mirrors page for alternative mirrors.
32bit Gentoo stage3 tarball.
Code: |
# cd /mnt/gentoo
# wget http://gentoo.mirrors.tds.net/gentoo/releases/x86/current-stage3/default/20130416/stage3-i686-20130416.tar.bz2
# tar xvjpf stage3*
|
64bit Gentoo 2008.0 stage3 tarball.
Code: |
# cd /mnt/gentoo
# wget http://gentoo.mirrors.tds.net/gentoo/releases/amd64/autobuilds/current-stage3/default/20130411/stage3-amd64-20130411.tar.bz2
# tar xvjpf stage3*
|
Gentoo Portage Tree Snapshot
Code: |
# 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. These make.conf files are located here. 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.
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.
Notes on different processor features.
- MAKEOPTS="-j2" edit this to MAKEOPTS="-j3" if your processor has dual-cores. The suggested value is CPU+1.
- If your processor is missing any of the sse,sse2,sse3 flags edit these out from the USE="..." in the make.conf
- (Intel ONLY), 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.
- (Intel ONLY). 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.
- To view available flags type or to check if you have two cores. type
# cat /proc/cpuinfo
Configuration for Athlon-XP Processor
32bit Athlon-XP
Code: |
# cd /mnt/gentoo/etc
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/athlon-xp/x86/make.conf
|
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
|
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
|
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
|
Configuration for Intel Core Duo/ Core 2 Duo Processors
32bit Core Duo
Code: |
# cd /mnt/gentoo/etc
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/nocona/x86/make.conf
|
64bit Core Duo
Code: |
# cd /mnt/gentoo/etc
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/nocona/amd64/make.conf
|
Configuration for Pentium2 Processors
32bit Pentium2
Code: |
# cd /mnt/gentoo/etc
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium2/x86/make.conf
|
Configuration for Pentium3 Processors
32bit Pentium3
Code: |
# cd /mnt/gentoo/etc
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium3/x86/make.conf
|
Configuration for Pentium-M (Centrino)/Celeron M (Intel) Processors
32bit Pentium-M
Code: |
# cd /mnt/gentoo/etc
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/pentium-m/x86/make.conf
|
Configuration for Pentium4 Processors
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
|
Configuration for Pentium4 (Prescotts) Processors
32bit Pentium4
Code: |
# cd /mnt/gentoo/etc
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/p4-prescott/x86/make.conf
|
64bit Pentium4
Code: |
# cd /mnt/gentoo/etc
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/p4-prescott/amd64/make.conf
|
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
|
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
|
Configuration for Xeon w/ EM64T Processors
32bit Xeon w/o EM64T
Code: |
# 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
Code: |
# cd /mnt/gentoo/etc
# mv make.conf make.conf.original
# wget http://weboperative.com/gentoo/xeon_w_em64t/amd64/make.conf
|
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
|
6d. Selecting Fast Mirrors
Mirror-Select is a wonderful tool which will test available mirrors and determent the best one for you.
Code: | # 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.
Code: |
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# mount -o bind /sys /mnt/gentoo/sys
|
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.
Code: | # 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.
Code: |
# screen
# chroot /mnt/gentoo /bin/bash
# env-update && source /etc/profile
# export PS1="(chroot) $PS1"
|
Quote: |
To leave the gentoo base system chroot at any time type 'exit && exit' once. |
7c. Updating the Portage Tree.
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.
Code: | # nano /etc/locale.gen |
Generate locales.
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.
Code: |
# [ -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. 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.
Performing the bootstrap.
Code: |
# emerge gcc-config linux-headers glibc binutils gcc portage -1
# gcc-config 2 && env-update && source /etc/profile
|
8c. Finish toolchain build.
Last but not least we will rebuild our toolchain against itself. "Note: This is not needed when going from 4.6 to 4.6.x.x but require from 4.6 to 4.7 since those are major version updates"
Code: |
# emerge linux-headers glibc binutils gcc -1
|
Create binpkg from toolchain packages then prune old GCC from system.
Note: Ignore the below warning while running "emerge -Pv gcc".
Quote: |
!!! You have no world file.
!!! Proceeding is likely to break your installation.
|
Code: |
# [ ! -d /usr/portage/packages ] && mkdir /usr/portage/packages
# quickpkg gcc glibc binutils linux-headers && emerge -Pv --ask n 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.
Emerging all packages against the newly compiled toolchain.
Code: |
# while read ebuild; do emerge -v1 "${ebuild}" || echo "${ebuild}" >>failed; done < <(emerge -ep --columns --color=n @system | grep ebuild | awk '{print$4}' | egrep -v "(glibc|/portage|binutils|gcc|linux-h|^])")
# env-update && source /etc/profile
|
Emerge any packages that failed the system build.
Code: | # while read package; do emerge -1 ${package};done < <(cat failed) |
Merge changes from new system packages
Since we have rebuild our system packages using ~arch keyword, we will merge those changes using etc-update. We will merge all changes to all available configuration updates.
Code: | # etc-update --automode -5 |
Edit this list of packages here to suit your needs, these are common system tools and misc packages.
Code: |
# emerge syslog-ng ntp grub vixie-cron sysfsutils dhcpcd eix gentoolkit portage-utils
# for i in syslog-ng vixie-cron; 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.
Code: | # ntpdate -u -b pool.ntp.org |
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 Install CD 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:
Quote: |
# lspci
00:00.0 Host bridge: Advanced Micro Devices [AMD] RS780 Host Bridge
00:02.0 PCI bridge: Advanced Micro Devices [AMD] RS780 PCI to PCI bridge (ext gfx port 0)
00:03.0 PCI bridge: Advanced Micro Devices [AMD] RS780 PCI to PCI bridge (ext gfx port 1)
00:07.0 PCI bridge: Advanced Micro Devices [AMD] RS780 PCI to PCI bridge (PCIE port 3)
00:0a.0 PCI bridge: Advanced Micro Devices [AMD] RS780/RS880 PCI to PCI bridge (PCIE port 5)
00:11.0 SATA controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
00:12.0 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.1 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0 USB OHCI1 Controller
00:12.2 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:13.0 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:13.1 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0 USB OHCI1 Controller
00:13.2 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:14.0 SMBus: Advanced Micro Devices [AMD] nee ATI SBx00 SMBus Controller (rev 3a)
00:14.1 IDE interface: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 IDE Controller
00:14.2 Audio device: Advanced Micro Devices [AMD] nee ATI SBx00 Azalia (Intel HDA)
00:14.3 ISA bridge: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 LPC host controller
00:14.4 PCI bridge: Advanced Micro Devices [AMD] nee ATI SBx00 PCI to PCI Bridge
00:14.5 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
00:18.0 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor HyperTransport Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Miscellaneous Control
00:18.4 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Link Control
01:00.0 VGA compatible controller: NVIDIA Corporation G94 [GeForce 9600 GT] (rev a1)
02:00.0 SCSI storage controller: LSI Logic / Symbios Logic SAS1068E PCI-Express Fusion-MPT SAS (rev 0
03:00.0 Network controller: Atheros Communications Inc. AR5418 Wireless Network Adapter [AR5008E 802.11(a)bgn] (PCI-Express) (rev 01)
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 02)
|
That is the output for my LGA 775 Intel Board.
Output of lsmod.
Quote: |
# lsmod
Module Size Used by
snd_usb_audio 99761 0
snd_usbmidi_lib 17918 1 snd_usb_audio
snd_rawmidi 19002 1 snd_usbmidi_lib
snd_hwdep 6477 1 snd_usb_audio
snd_hda_codec_realtek 57201 1
evdev 12093 4
kvm_amd 47631 0
snd_hda_intel 22624 0
snd_hda_codec 64999 2 snd_hda_codec_realtek,snd_hda_intel
snd_pcm 79003 3 snd_usb_audio,snd_hda_codec,snd_hda_intel
snd_page_alloc 7323 2 snd_pcm,snd_hda_intel
snd_timer 21895 1 snd_pcm
psmouse 47933 0
snd 56109 9 snd_hda_codec_realtek,snd_usb_audio,snd_hwdep,snd_timer,snd_pcm,snd_rawmidi,snd_usbmidi_lib,snd_hda_codec,snd_hda_intel
pcspkr 1772 0
soundcore 841 1 snd
nouveau 888410 2
video 10840 1 nouveau
mxm_wmi 1316 1 nouveau
i2c_algo_bit 5060 1 nouveau
ttm 58533 1 nouveau
drm_kms_helper 24840 1 nouveau
drm 218675 4 ttm,drm_kms_helper,nouveau
i2c_core 18740 4 drm,drm_kms_helper,i2c_algo_bit,nouveau
ohci_hcd 20965 0
wmi 7880 2 mxm_wmi,nouveau
processor 19798 0
xts 2912 10
ext4 295810 0
crc16 1232 1 ext4
jbd2 54287 1 ext4
mbcache 5351 1 ext4
zfs 890586 16
zunicode 319257 1 zfs
zavl 4366 1 zfs
zcommon 32124 1 zfs
znvpair 40627 2 zfs,zcommon
spl 53057 5 zfs,zavl,zunicode,zcommon,znvpair
aes_x86_64 7372 20
lrw 3358 0
usbhid 18722 0
usb_storage 45841 0
ehci_hcd 39476 0
usbcore 146506 6 snd_usb_audio,usb_storage,ohci_hcd,snd_usbmidi_lib,ehci_hcd,usbhid
usb_common 811 1 usbcore
dm_crypt 14752 10
dm_mod 67514 21 dm_crypt
r8169 53708 0
mptsas 51354 9
mptscsih 28842 1 mptsas
mptbase 87073 2 mptsas,mptscsih
ata_piix 22197 0
ahci 21109 10
libahci 19739 1 ahci
sd_mod 32387 12
|
continued below...
Last edited by likewhoa on Thu Apr 18, 2013 1:36 am; edited 23 times in total |
|
Back to top |
|
|
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Sat Aug 02, 2008 8:56 pm Post subject: |
|
|
9a. Downloading and Emerging The Gentoo Linux Sources
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.
Code: | # emerge gentoo-sources && cd $OLDPWD |
Now that you have downloaded the latest Linux Kernel with the Gentoo patchset you are ready to start configuring it. I have provided a Kernel configuration as a starting point for you.
32bit Linux Kernel Configuration:
Code: | # cd /usr/src/linux
# wget http://weboperative.com/gentoo/kernel/x86/.config
# make menuconfig |
64bit Linux Kernel Configuration:
Code: | # 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.
Quote: |
To fit your kernel to your unique hardware you must navigate to the following kernel menus and make require changes. |
- 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) Only for i386 compatible code; This option produces code that is instruction ordered for the selected CPU but will run on a i386.
- Next if you are currently a 64bit user make sure the following options are enabled. IA32 Emulation in the following section is enabled:
Executable file formats / Emulations --->
<*> IA32 Emulation
- 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) --->
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)
<*> 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 --->
<*> EHCI HCD (USB 2.0) support
<*> OHCI HCD support
<*> UHCI HCD (most Intel and VIA) support
- 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
Quote: |
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. Next we will compile the kernel but pay attention to the "-j2" option which you'll replace "2" with the number of processors your system currently have to speed things up, for example If you have a quad-core processor then you would use "-j5". The recommended value is CPUs+1 for parallel makes.
32bit Kernel Compilation
Code: | # make -j2 && make modules_install
# cp -v arch/x86/boot/bzImage /boot/3.7.5
# update-modules |
64bit Kernel Compilation:
Code: | # make -J2 && make modules_install
# cp -v arch/x86/boot/bzImage /boot/3.7.5
# update-modules |
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 Radeon Evergreen (HD5000 Series) and newer chipsets
- radeon-ucode - IRQ microcode for r6xx/r7xx/Evergreen/N.Islands/S.Islands Radeon GPUs and APUs
- 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:
Quote: |
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:
Code: | # emerge --pretend --verbose nvidia-drivers |
You should list the modules you want automatically loaded in /etc/conf.d/modules. 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 "<kernel version>" with the version of the kernel you just compiled:
Code: | # 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.
Quote: |
There modules are located here:
- C-Media:
/lib/modules/3.7.5-gentoo/kernel/sound/pci/snd-cmipci.ko
- AMD and nVidia IDE Support:
/lib/modules/3.7.5-gentoo/kernel/drivers/ide/pci/amd74xx.ko
- USB EHCI 2.0:
/lib/modules/3.7.5-gentoo/kernel/drivers/usb/host/ehci-hcd.ko
- USB OHCI:
/lib/modules/3.7.5-gentookernel/drivers/usb/host/ohci-hcd.ko
- USB UHCI:
/lib/modules/3.7.5-gentoo/kernel/drivers/usb/host/uhci-hcd.ko
|
Quote: | TIP:
to load modules that load on reboot add each module to
/etc/conf.d/modules
example:
to load the C-Media Sound Card Module on a reboot, add snd-cmipci to
/etc/conf.d/modules |
Now run update-modules to commit your changes to the /etc/modules.conf file:
9c. Configuring Your System
Setting Up Hostname
Code: | # nano -w /etc/conf.d/hostname |
File:/etc/conf.d/hostname
Quote: |
# /etc/conf.d/hostname
# Set to the hostname of this machine
HOSTNAME="ricearawr" |
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
Code: | # nano -w /etc/hosts |
Quote: |
# /etc/hosts: Local Host Database
# IPv4 and IPv6 localhost aliases
192.168.1.100 ricearawr |
9d. Configuring a Second Network Card(Optional)
Code: | # 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)
Quote: |
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)
Quote: |
config_eth0="66.90.101.18 netmask 255.255.255.0"
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.
- start grub console without floppy seek
- tell grub where your /boot directory resides. (hd0,0) equals /dev/sda1. if your /boot resides elsewhere make the changes below.
- install the Master Boot Record to /dev/sda or /dev/hda if using IDE.
- 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.
Code: | # grub --no-floppy
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)
grub> quit |
Editing /boot/grub/menu.lst.
Code: | # 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.
Quote: |
# Boot automatically after 30 secs.
timeout 7
# By default, boot the first entry.
default 0
# Splash image to show behind grub.
splashimage=(hd0,0)/grub/gentoo.xpm.gz
# For booting Gentoo GNU/Linux
title Gentoo 3.7.5
root (hd0,0)
kernel 3.7.5 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.
Code: | # nano -w /etc/fstab |
Quote: |
/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
Quote: | to change root's pass:
# passwd
to add a new user to system:
# useradd -m -d /home/<yourname> -s /bin/bash -g users -G audio,cron,wheel,portage,games,video <yourname>
to change <yourname> password:
# passwd <your username> |
Note: if you get the error message:
Quote: | useradd: invalid numeric argument 'games' | do the following:
then retry the 'useradd' command.
10d. Compiling the Linux RAID and Logical Volume Manager Package.
Lets not forget to compile the necessary tools for RAID & LVM2.
Code: | # emerge mdadm lvm2
# for i in lvm raid mdadm;do [ ! -L /etc/runlevels/boot/${i} ] && rc-update add ${i} boot;done
|
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.
Code: | # exit && exit
# cd ~
# umount /mnt/gentoo/{boot,proc,dev,tmp,opt,home}
# umount /mnt/gentoo/{usr/portage/distfiles,usr/portage,usr,var/tmp,var}
# umount /mnt/gentoo
# swapoff /dev/sda2 && swapoff /dev/sdb2
# vgdisplay
# vgchange -an
# sync |
10f. Rebooting to your newly installed Gentoo Linux
.: FAQ/Troubleshooting :.
- 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.
Code: | # 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 |
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: https://forums.gentoo.org
Gentoo Wiki: http://gentoo-wiki.com
Grub Error Collection: http://gentoo.org/doc/en/grub-error-guide.xml
Bugs Tracker: https://bugs.gentoo.org
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.
20080801 - Revised guide for 2008.0 profile.
20090709 - Revised guide with autobuild stages and added some code changes to toolchain build
20130417 - Revised guide for 13.0 profile.
.: TODO list :.
- Add / to lvm2
- initrd generation script
- Optional /boot on usb key using extlinux (gets rid of grub usage)
- Encryption for / using luks
Copyright © 2011-2013. Released under the Creative Commons Attribution-ShareAlike license version 2.5.
Last edited by likewhoa on Thu Apr 18, 2013 1:48 am; edited 6 times in total |
|
Back to top |
|
|
kernelOfTruth Watchman
Joined: 20 Dec 2005 Posts: 6111 Location: Vienna, Austria; Germany; hello world :)
|
|
Back to top |
|
|
nadio n00b
Joined: 03 Aug 2008 Posts: 1
|
Posted: Sun Aug 03, 2008 8:59 pm Post subject: Guide |
|
|
Hello great guide, minor modifications needed to make it more generic. _________________ Nadio |
|
Back to top |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Thu Aug 07, 2008 4:31 am Post subject: |
|
|
Looks great likewhoa, we'll add some of those params to the script, and add some scope for md5. should be able to encode all of that stuff without too many new data (md5 will be main one since lvm2 is done.). I should get some time for it next weekend.
Nice work. :D |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Fri Aug 08, 2008 2:51 am Post subject: |
|
|
Hi, at the point 2.b, you should talk about SystemRescueCD |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Fri Aug 08, 2008 3:01 am Post subject: |
|
|
Hi, are you sure that this grub :
Code: |
# 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.26
root (hd0,0)
kernel /boot/2.6.26 root=/dev/md1
|
Could be that instead :
Code: |
# Boot automatically after 30 secs.
timeout 7
# By default, boot the first entry.
default 0
# Splash image to show behind grub.
splashimage=(hd0,0)/grub/gentoo.xpm.gz
# For booting Gentoo GNU/Linux
title Gentoo 2.6.26
root (hd0,0)
kernel 2.6.26 root=/dev/md1
|
|
|
Back to top |
|
|
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Fri Aug 08, 2008 5:17 am Post subject: |
|
|
thanks d2_racing for pointing that out, changes have been made. I should be adding extlinux instructions for people that would like to put /boot on a usb stick. Also adding SystemRescueCD as an optional Install CD.
@stevelL Looking forward to your install script I should write up the experimental gcc-4.{2,3} hardened overlay guide soon.. that's gonna be fun.
@kernelOfTruth Thanks for helping with any errors/typos or crazy grammar errors, also looking forward to collaborating with you on some LiveCD action.
nadio your first post? heh thanks for making it here. |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Fri Aug 08, 2008 12:44 pm Post subject: |
|
|
Also, you should point out that this guide use ~x86 or ~amd64, because I saw the ACCEPT_KEYWORD inside all the /etc/make.conf that are available online. |
|
Back to top |
|
|
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Fri Sep 19, 2008 8:03 am Post subject: |
|
|
d2_racing wrote: | Also, you should point out that this guide use ~x86 or ~amd64, because I saw the ACCEPT_KEYWORD inside all the /etc/make.conf that are available online. |
I sure will, thanks for the input. |
|
Back to top |
|
|
Xanadu Guru
Joined: 10 Oct 2002 Posts: 335 Location: Hour West of Philly (USA)
|
Posted: Sat Sep 20, 2008 2:41 am Post subject: |
|
|
FANTASTIC!
One (hopefully) minor thing:
in 3b. Optimizing Media Access (Optional)
you "casually" mention using -m16 as an option. It may be a good idea to stick in the warning from hdparm's man page:
Quote: | Some drives claim to support multiple mode, but lose data at some settings.
Under rare circumstances, such failures can result in massive filesystem corruption. |
It's probably not a big deal these days, but, if that text is still in the official man page, it may be worth mentioning to someone reading through your (EXCELLENT!) post. _________________ I'm not a prophet or a stone-age man
I'm just a mortal with potential of a super man
-David Bowie |
|
Back to top |
|
|
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Mon Oct 13, 2008 7:23 am Post subject: |
|
|
Xanadu wrote: | FANTASTIC!
One (hopefully) minor thing:
in 3b. Optimizing Media Access (Optional)
you "casually" mention using -m16 as an option. It may be a good idea to stick in the warning from hdparm's man page:
Quote: | Some drives claim to support multiple mode, but lose data at some settings.
Under rare circumstances, such failures can result in massive filesystem corruption. |
It's probably not a big deal these days, but, if that text is still in the official man page, it may be worth mentioning to someone reading through your (EXCELLENT!) post. |
thanks for the pointer, will update guide. |
|
Back to top |
|
|
93nt00r0ck5 n00b
Joined: 17 Jul 2004 Posts: 35
|
Posted: Tue Dec 23, 2008 10:30 pm Post subject: |
|
|
The one-liner fails to work for me. I copied and pasted the entire line and when I try to run it all I get is:
Code: |
# while read ebuild; do emerge -v1 "${ebuild}" || echo "${ebuild}" >>failed; done < <(emerge -ep --columns --color=n system| cut -d] -f2 | awk '{print$4}' | egrep -v "(glibc|/portage|binutils|gcc|linux-h)"|sed '1,4d')
These are the packages that would be merged, in order:
Calculating dependencies /
!!! '' is not a valid package atom.
!!! Please check ebuild(5) for full details.
!!! (Did you specify a version but forget to prefix with '='?)
... done! |
This repeats over and over again; at least 100 times before returning to a prompt.
I gave up trying to figure out what that line is supposed to do, so I just ran "emerge -uNDav world".
L8r, Andrew |
|
Back to top |
|
|
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Wed Dec 24, 2008 2:47 am Post subject: |
|
|
93nt00r0ck5 wrote: | The one-liner fails to work for me. I copied and pasted the entire line and when I try to run it all I get is:
Code: |
# while read ebuild; do emerge -v1 "${ebuild}" || echo "${ebuild}" >>failed; done < <(emerge -ep --columns --color=n system| cut -d] -f2 | awk '{print$4}' | egrep -v "(glibc|/portage|binutils|gcc|linux-h)"|sed '1,4d')
These are the packages that would be merged, in order:
Calculating dependencies /
!!! '' is not a valid package atom.
!!! Please check ebuild(5) for full details.
!!! (Did you specify a version but forget to prefix with '='?)
... done! |
This repeats over and over again; at least 100 times before returning to a prompt.
I gave up trying to figure out what that line is supposed to do, so I just ran "emerge -uNDav world".
L8r, Andrew |
Code: |
# while read ebuild; do emerge -v1 "${ebuild}" || echo "${ebuild}" >>failed; done < <(emerge -ep --columns --color=n system| cut -d] -f2 | awk '{print$1}' | egrep -v "(glibc|/portage|binutils|gcc|linux-h)"|sed '1,4d') |
is the correct one to use now since some changes were made with portage. I will update guide to reflect those changes. only change was in the awk '{print$4}' command. |
|
Back to top |
|
|
93nt00r0ck5 n00b
Joined: 17 Jul 2004 Posts: 35
|
Posted: Wed Dec 24, 2008 2:48 pm Post subject: |
|
|
Sweet! Thanks for the quick reply and fix. It appears to be working fine now. Had I not upgraded portage after doing the "emerge --sync" it probably would have worked.
Also, I realized that after I ran the "emerge -uNDav world" that I should have just done "emerge -e world" (which I did run after "emerge -uNDav world" finished) since -e would emerge all packages, while -uNDav would only upgrade packages and/or use flags. oops.
Oh well. Luckily I have a fast system, so emerging the entire world won't take forever; plus your script takes out the biggies.
Thanks again,
Andrew
P.S. Could you break down your script and explain what it does/how it works. I am not very good at awk and sed commands and multiple pipings, etc. It would make a very good learning experience. Oh, and thanks for the great guide. |
|
Back to top |
|
|
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Wed Dec 24, 2008 4:01 pm Post subject: |
|
|
What the first pipe on script does is cut out the "]" charactor then show everything after the second column, the second pipe just prints the first row while the third strips out only the toolchain packages from the list and the last pipe which is a sed command that deletes the first 4 lines of the output. |
|
Back to top |
|
|
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Thu Jul 09, 2009 8:25 am Post subject: |
|
|
added some small changes to guide so it uses autobuild stages and some code changes to the system builds. |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Thu Jul 09, 2009 11:49 am Post subject: |
|
|
In fact, autobuild is a must nowdays |
|
Back to top |
|
|
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Thu Apr 18, 2013 1:49 am Post subject: |
|
|
updated for 13.0 and will implement the rest of the TODO items, specially initramfs generator for ZFS. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|