HOWTO Install Gentoo - The Gentoo Developers Method with NPTL and 2.6 from Stage1
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Please format this article according to the guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article
Based on the forum guide by: --ali3nx, eMail
[edit] 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 metadistribution 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 textfiles. In other words, openness everywhere.
[edit] What is Stage1 About?
Starting from a stage1 install allows you to have total control over the optimization settings and optional build-time functionality that is initially enabled on your system. This makes stage1 installs good for power users who know what they are doing. It is also a great installation method for those who would like to know more about the inner workings of Gentoo Linux.
A stage1 installation can only be performed when you have a working Internet connection.
| Stage1 | Pros and Cons |
| + | Allows you to have total control over the optimization settings and optional build-time functionality that is initially enabled on your system |
| + | Suitable for powerusers that know what they are doing |
| + | Allows you to learn more about the inner workings of Gentoo |
| - | Takes a long time to finish the installation |
| - | If you don't intend to tweak the settings, it is probably a waste of time |
| - | Not suitable for networkless installations |
Now take a look at the available installation media.
[edit] Gentoo LiveCDs
The Gentoo LiveCDs are bootable CDs which contain a self-sustained Gentoo environment. They allow you to boot Linux from the CD. During the boot process your hardware is detected and the appropriate drivers are loaded. They are maintained by Gentoo developers.
All LiveCDs allow you to boot, set up networking, initialize your partitions and start installing Gentoo from the Internet. However, some LiveCDs also contain all necessary source code so you are able to install Gentoo without a working network configuration.
As we are concerned with an install from stage1 the Minimal LiveCD is all that is required.
[edit] Gentoo's Minimal LiveCD
This is a small, no-nonsense, bootable CD, the sole purpose of which is to boot the system, prepare the networking and continue with the Gentoo installation. It does not contain any stages (or, in some cases, a single stage1 file), source code or precompiled packages. For example the x86 variant of this LiveCD can be found in the livecd/ subdirectory and is called install-x86-minimal-2006.0.iso.
[edit] Download, Burn and Boot a Gentoo LiveCD
[edit] Downloading and Burning the LiveCDs
We'll first start by downloading and burning the chosen LiveCD. We previously discussed the available LiveCDs, but where can you find it?
You can download the LiveCDs from one of our mirrors or via a torrent
Inside that directory you'll find so-called ISO-files. Those are full CD images which you can write on a CD-R. 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 we provide (such as install-x86-minimal-2004.3.iso.md5). You can check the MD5 checksum with the md5sum tool under Linux/Unix or md5sum for Windows.
To burn the downloaded ISO(s), you have to select raw-burning. How you do this is highly program-dependent. We will discuss cdrecord and K3B here; more information can be found in our Gentoo FAQ.
- With cdrecord, you simply type
> cdrecord dev=/dev/hdc livecd.iso
Replace /dev/hdc with your CD-RW drive's device path and livecd.iso with the name of your ISO image file. :)
- With K3B, select Tools→CD→Burn Image. Then you can locate your ISO file within the 'Image to Burn' area. Finally click Start.
[edit] Booting the LiveCD(s)
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 them. Remove all CDs from your CD drives, reboot your system and enter the BIOS. This is usually done by hitting DEL, F1 or ESC, depending on your BIOS. Inside the BIOS, change the boot order so that the CD-ROM is tried before the hard disk. This is often found under "CMOS Setup". If you don't do this, your system will just reboot from the hard disk, ignoring the CD-ROM.
Now place the installation CD in the CD-ROM drive and reboot. You should see a boot prompt. At this screen, you can hit Enter to begin the boot process with the default boot options, or boot the LiveCD with custom boot options by specifying a kernel followed by boot options and then hitting Enter.
[edit] Installation
[edit] About the Gentoo Linux Installation
[edit] Optional: Starting the SSH Daemon
Setting up Gentoo is easiest via a 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.
First let's give the 'virtual' livecd root account a password
# passwd
and if it is easier for you to make alterations through sshd let's start it up
# /etc/init.d/sshd start
Run 'ifconfig' and note down the ip address of the system, you will need to 'ssh root@recordedip' to continue with the installation.
[edit] Optimizing Media Access
So you have the sexiest windows box in the universe eh...? Think it's quick..? I think not.
In Windows you do not have a way to make 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-RWs, DVD-RWs 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:
# 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:
# 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.
# hdparm -d1c1u1 /dev/cdroms/cdrom0
The optimized results:
# 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)
[edit] Setting Up the Network
2004.3 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.
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:04:5A:8E:03:6D
inet addr:10.0.0.20 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::204:5aff:fe8e:36d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:22023 errors:0 dropped:0 overruns:0 frame:0
TX packets:18541 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4518758 (4.3 MiB) TX bytes:1445428 (1.3 MiB)
Interrupt:10 Base address:0xec00
# ping -c 5 www.google.com
PING www.google.akadns.net (64.233.161.147) 56(84) bytes of data.
64 bytes from 64.233.161.147: icmp_seq=1 ttl=235 time=373 ms
64 bytes from 64.233.161.147: icmp_seq=3 ttl=235 time=376 ms
64 bytes from 64.233.161.147: icmp_seq=4 ttl=235 time=364 ms
--- www.google.akadns.net ping statistics ---
5 packets transmitted, 3 received, 40% packet loss, time 4011ms
rtt min/avg/max/mdev = 364.373/371.535/376.466/5.230 ms, pipe 2
If you see packet traffic it's time to continue. If not head over to gentoo's irc chans for user support.
[edit] Preparing the Disks
[edit] Fdisk Primer and Setting up Filesystems
First check your system for available disks. If this command prints nothing you have a problem that is outside the scope of this handbook:
| Code: Check your system for available disks |
# fdisk -l Disk /dev/hda: 54.8 GB, 54896492544 bytes 255 heads, 63 sectors/track, 6674 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes |
Using fdisk - fdisk in a nutshell..
| Code: The manual of fdisk |
The number of cylinders for this disk is set to 14593. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) |
Proceed to create each partition by entering options:
- n - new partition
- p - primary (or e for extended)
- # - this is the number of partition
Here is a guide for how you should setup the partitions
Filesystem Type Size Mounted on /dev/hda1 ext3 509M /boot /dev/hda2 swap 1.0G <Linux Swap> /dev/hda3 ext3 10.0G /
[edit] Optional: Other Partitions
Some users may find it useful to have have folders such as '/opt' and '/home' mounted in differnt a) partitions and or b) drives. There can only be a maximum of either four primary partitions or three primary partitions and an 'extended partition' that can house many 'logical partitions', and due to this we allocate the rest of the space to the extended partition and then setup each logical partition as needed (inside that). Seems complicated but it is quite easy once you get the hang of it.
/dev/hda4 ext3 Rest <Extended Partition> /dev/hda5 ext3 1.0G /opt /dev/hda6 ext3 Rest /home
Set hda1 to Active with "a" and also change the swap partition "type" of hda2 to swap By pressing "t" and entering type "82", which is the hex code for linux swap. See the fdisk manual above if you're confused.
What you'll see if correctly set up via fdisk
Device Boot Start End Blocks Id System /dev/hda1 * 1 970 488848+ 83 Linux /dev/hda2 971 2909 977256 82 Linux swap /dev/hda3 2910 22286 9766008 83 Linux
optionally seen if included in the partition table
/dev/hda4 22287 238216 108828720 5 Extended /dev/hda5 22287 24225 977224+ 83 Linux /dev/hda6 24226 238216 107851432+ 83 Linux
[edit] Filesystems and Mounting
Using ext2 or ext3 would be such a waste. It's slow, it cannot output I/O at the rates of reiserfs 3.6 or reiser4... Yes I tested Reiser4 stability for Gentoo and it's fsckin killa over 80MB/s I/O on hard drives *not* properly tuned with hdparm for udma133 with no raid.
Reiser4 was recently released as a stable filesystem. and if you've been folIowing the news on reiser4.. It's the fastest filesystem on the planet. I will be adding Reiser4 as an optional filesystem in this tutorial in the very near future as time permits.
To create file systems:
If you have a sata or SCSI system replace hda with sda appropriately in the following code examples. |
# mkreiserfs /dev/hda1 && mkreiserfs /dev/hda3 && mkreiserfs /dev/hda5 && mkreiserfs /dev/hda6
or if you would like to stick with ext3
# mke2fs -j /dev/hda1 && mke2fs -j /dev/hda3 && mke2fs -j /dev/hda5 && mke2fs -j /dev/hda6
swap
# mkswap /dev/hda2 && swapon /dev/hda2
# mount /dev/hda3 /mnt/gentoo && mkdir /mnt/gentoo/boot && mount /dev/hda1 /mnt/gentoo/boot
[edit] Installing the Gentoo Installation Files
[edit] 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:
# date Fri Oct 29 16:21:18 CEST 2004
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 October 29th, 16:21 in the year 2004:
# date 102916212004
[edit] Retrieving a Base System Stage
If you're planning a stage1 installation, use a generic x86 stage1 gentoo stage. It's the only stage that will let you build a full posix install with the native linux posix threading model that makes pthreading look like child's play. To use it you must compile every application to support it specifically toolchain, which primarily consists of glibc and gcc. For this example we're going for brutal speed and agility. So, if you've been following, it's stage1 we're planning to build. Precompilied applications in a can will leave you with broken libs or unsupported features. I find that the best results are obtained by compiling it all. Linux systems are akin to a tree; if the tree has no roots its leaves will fall and the tree will die.
# cd /mnt/gentoo/ # wget http://mirror.datapipe.net/gentoo/releases/x86/2005.1/stages/x86/stage1-x86-2005.1.tar.bz2 # tar -xvjpf stage?-*.tar.bz2
or for the "current" stage
# cd /mnt/gentoo/ # wget http://mirror.datapipe.net/gentoo/releases/x86/current/stages/stage1-x86-2006.1.tar.bz2 # tar -xvjpf stage1*
[edit] Updated make.conf
I have a completed make.conf available for everyone to download and edit to suit their requirements. I've made notes and comments where appropriate to reflect any known bugs and have done my best to make this configuration as heterogeneous as possible. 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,
| Code: take a look at the man page |
man make.conf |
and to get a better idea of how portage works, check out Gentoo's official portage documentation.
[edit] Configured for Athlon-XP Processors
Download the file by performing
- NOTE You must now add "nptlonly" to the use flags.
- I have already done this in the box below but I do not have access to
- bsodmike.com.
During the creation of the article I ended up documenting anything and everything that was edited/created and the following file is what was actually used in the move from stage 1 to stage 2. If you look at the USE flags at the end of this list you will see some 'undeclared' flags in there such as sse which is also supported by this processor and these flags were found by performing the following:
| File: /etc/make.conf |
# ********************************************************************** # /etc/make.conf - Edited 4th Jan, 2005 - bsodmike # ********************************************************************** #For Athlon-XP Processors: #----------------------------------------------------------------------- # My personal 2100XP running @ 2700XP... #processor : 0 #vendor_id : AuthenticAMD #cpu family : 6 #model : 8 #model name : AMD Athlon(tm) Processor #stepping : 1 #cpu MHz : 2171.575 #cache size : 256 KB #fdiv_bug : no #hlt_bug : no #f00f_bug : no #coma_bug : no #fpu : yes #fpu_exception : yes #cpuid level : 1 #wp : yes #flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr # sse syscall mmxext 3dnowext 3dnow #bogomips : 4276.22 #---------------------------------------------------------------------- #Use # cat /proc/cpuinfo to find CPU Info #********************************************************************** # Copyright 2000-2003 Daniel Robbins, Gentoo Technologies, Inc. # Contains local system settings for Portage system # $Header: /home/cvsroot/gentoo-src/portage/cnf/make.conf,v 1.70 2004/01/12 07:34:38 carpaski Exp $ # Please review 'man make.conf' for more information. # Build-time functionality # ======================== # The USE variable is used to enable optional build-time functionality. For # example, quite a few packages have optional X, gtk or GNOME functionality # that can only be enabled or disabled at compile-time. Gentoo Linux has a # very extensive set of USE variables described in our USE variable HOWTO at # http://www.gentoo.org/doc/use-howto.html # # The available list of use flags with descriptions is in your portage tree. # Use 'less' to view them: --> less /usr/portage/profiles/use.desc <-- # # 'ufed' is an ncurses/dialog interface available in portage to make handling # useflags for you. 'emerge app-admin/ufed' # # Example: #USE="X gtk gnome -alsa" # Host Setting # ============ # If you are using a Pentium Pro or greater processor, leave this line as-is; # otherwise, change to i586, i486 or i386 as appropriate. All modern systems # (even Athlons) should use "i686-pc-linux-gnu". All K6's are i586. # CHOST="i686-pc-linux-gnu" # Host and optimization settings # ============================== # For optimal performance, enable a CFLAGS setting appropriate for your CPU. # # Please note that if you experience strange issues with a package, it may be # due to gcc's optimizations interacting in a strange way. Please test the # package (and in some cases the libraries it uses) at default optimizations # before reporting errors to developers. # # -mcpu=<cpu-type> means optimize code for the particular type of CPU without # breaking compatibility with other CPUs. # # -march=<cpu-type> means to take full advantage of the ABI and instructions # for the particular CPU; this will break compatibility with older CPUs (for # example, -march=athlon-xp code will not run on a regular Athlon, and # -march=i686 code will not run on a Pentium Classic. # # CPU types supported in gcc-3.2 and higher: athlon-xp, athlon-mp, # athlon-tbird, athlon, k6, k6-2, k6-3, i386, i486, i586 (Pentium), i686 # (PentiumPro), pentium, pentium-mmx, pentiumpro, pentium2 (Celeron), # pentium3, and pentium4. # # Note that Gentoo Linux 1.4 and higher include at least gcc-3.2. # # CPU types supported in gcc-2.95*: k6, i386, i486, i586 (Pentium), i686 # (Pentium Pro), pentium, pentiumpro Gentoo Linux 1.2 and below use gcc-2.95* # # CRITICAL WARNINGS: ****************************************************** # # K6 markings are deceptive. Avoid setting -march for them. See Bug #24379. # # ************************************************************************* # # # Unset ONE of the cflag examples that best resembles your cpu # You must uncomment one that matches your cpu # # Athlon class cpu's below # #CFLAGS="-march=athlon -O2 -fomit-frame-pointer -pipe" #CFLAGS="-march=athlon-tbird -O2 -fomit-frame-pointer -pipe" CFLAGS="-march=athlon-xp -O2 -fomit-frame-pointer -pipe"
#CFLAGS="-march=athlon-4 -O2 -fomit-frame-pointer -pipe"
# Pentium class cpu's below
#
#CFLAGS="-march=pentium-mmx -O2 -fomit-frame-pointer -pipe"
#CFLAGS="-march=pentium2 -O2 -fomit-frame-pointer -pipe"
#CFLAGS="-march=pentium3 -O2 -fomit-frame-pointer -pipe"
#CFLAGS="-march=pentium4 -O2 -fomit-frame-pointer -pipe"
# If you set a CFLAGS above, then this line will set your default C++ flags to
# the same settings.
CXXFLAGS="${CFLAGS}"
#
# Setting LDFLAGS is still experimental use them only if you are truly experienced
#
# man ld to learn how use flags affect gentoo linux
#
#LDFLAGS="-Wl,-O1 -Wl,--relax -Wl,--enable-new-dtags -Wl,--sort-common -s"
#
# Advanced Masking
# ================
# Gentoo is using a new masking system to allow for easier stability testing
# on packages. KEYWORDS are used in ebuilds to mask and unmask packages based
# on the platform they are set for. A special form has been added that
# indicates packages and revisions that are expected to work, but have not yet
# been approved for the stable set. '~arch' is a superset of 'arch' which
# includes the unstable, in testing, packages. Users of the 'x86' architecture
# would add '~x86' to ACCEPT_KEYWORDS to enable unstable/testing packages.
# '~ppc', '~sparc' are the unstable KEYWORDS for their respective platforms.
#
# Please note that this is not for development, alpha, beta, nor cvs release
# packages. "Broken" packages will not be added to testing and should not be
# requested to be added. Alternative routes are available to developers
# for experimental packages, and it is at their discretion to use them.
#
# DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
# IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
## ACCEPT_KEYWORDS="~x86"
# Portage Directories
# ===================
# Each of these settings controls an aspect of portage's storage and file
# system usage. If you change any of these, be sure it is available when
# you try to use portage. *** DO NOT INCLUDE A TRAILING "/" ***
#
# PORTAGE_TMPDIR is the location portage will use for compilations and
# temporary storage of data. This can get VERY large depending upon
# the application being installed.
PORTAGE_TMPDIR=/var/tmp
#
# PORTDIR is the location of the portage tree. This is the repository
# for all profile information as well as all ebuilds. This directory
# itself can reach 200M. WE DO NOT RECOMMEND that you change this.
PORTDIR=/usr/portage
#
# DISTDIR is where all of the source code tarballs will be placed for
# emerges. The source code is maintained here unless you delete
# it. The entire repository of tarballs for gentoo is 9G. This is
# considerably more than any user will ever download. 2-3G is
# a large DISTDIR.
DISTDIR=${PORTDIR}/distfiles
#
# PKGDIR is the location of binary packages that you can have created
# with '--buildpkg' or '-b' while emerging a package. This can get
# upto several hundred megs, or even a few gigs.
PKGDIR=${PORTDIR}/packages
#
# PORT_LOGDIR is the location where portage will store all the logs it
# creates from each individual merge. They are stored as YYMMDD-$PF.log
# in the directory specified. This is disabled until you enable it by
# providing a directory. Permissions will be modified as needed IF the
# directory exists, otherwise logging will be disabled.
#PORT_LOGDIR=/var/log/portage
#
# PORTDIR_OVERLAY is a directory where local ebuilds may be stored without
# concern that they will be deleted by rsync updates. Default is not
# defined.
#PORTDIR_OVERLAY=/usr/local/portage
# Fetching files
# ==============
# If you need to set a proxy for wget or lukemftp, add the appropriate "export
# ftp_proxy=<proxy>" and "export http_proxy=<proxy>" lines to /etc/profile if
# all users on your system should use them.
#
# Portage uses wget by default. Here are some settings for some alternate
# downloaders -- note that you need to merge these programs first before they
# will be available.
#
# Default fetch command (5 tries, passive ftp for firewall compatibility)
#FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp \${URI} -P \${DISTDIR}"
#RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp \${URI} -P \${DISTDIR}"
#
# Using wget, ratelimiting downloads
#FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}"
#RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}"
#
# Lukemftp (BSD ftp):
#FETCHCOMMAND="/usr/bin/lukemftp -s -a -o \${DISTDIR}/\${FILE} \${URI}"
#RESUMECOMMAND="/usr/bin/lukemftp -s -a -R -o \${DISTDIR}/\${FILE} \${URI}"
#
# Prozilla (turbo downloader)
#FETCHCOMMAND='/usr/bin/proz --no-getch -s ${URI} -P ${DISTDIR}'
#
# Portage uses GENTOO_MIRRORS to specify mirrors to use for source retrieval.
# The list is a space seperated list which is read left to right. If you use
# another mirror we highly recommend leaving the default mirror at the end of
# the list so that portage will fall back to it if the files cannot be found
# on your specified mirror. We _HIGHLY_ recommend that you change this setting
# to a nearby mirror by merging and using the 'mirrorselect' tool.
# Portage uses PORTAGE_BINHOST to specify mirrors for prebuilt-binary packages.
# The list is a single extry specifying the full address of the directory
# serving the tbz2's for your system. Running emerge with either '--getbinpkg'
# or '--getbinpkgonly' will cause portage to retrieve the metadata from all
# packages in the directory specified, and use that data to determine what will
# be downloaded and merged. '-g' or '-gK' are the recommend parameters. Please
# consult the man pages and 'emerge --help' for more information.
#PORTAGE_BINHOST="ftp://login:pass@grp.mirror.site/pub/grp/i686/athlon-xp/"
#PORTAGE_BINHOST="http://grp.mirror.site/gentoo/grp/1.4/i686/athlon-xp/"
# Synchronizing Portage
# =====================
# Each of these settings effects how Gentoo synchronizes your Portage tree.
# Synchronization is handled by rsync and these settings allow some control
# over how it is done.
#
# SYNC is the server used by rsync to retrieve a localized rsync mirror
# rotation. This allows you to select servers that are geographically
# close to you, yet still distribute the load over a number of servers.
# Please do not single out specific rsync mirrors. Doing so places undue
# stress on particular mirrors. Instead you may use one of the following
# continent specific rotations:
#
# Default: "rsync://rsync.gentoo.org/gentoo-portage"
# North America: "rsync://rsync.namerica.gentoo.org/gentoo-portage"
# South America: "rsync://rsync.samerica.gentoo.org/gentoo-portage"
# Europe: "rsync://rsync.europe.gentoo.org/gentoo-portage"
# Asia: "rsync://rsync.asia.gentoo.org/gentoo-portage"
# Australia: "rsync://rsync.au.gentoo.org/gentoo-portage"
#SYNC="rsync://rsync.eliteitminds.com/gentoo-portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
# RSYNC_RETRIES sets the number of times portage will attempt to retrieve
# a current portage tree before it exits with an error. This allows
# for a more successful retrieval without user intervention most times.
RSYNC_RETRIES="3"
# RSYNC_TIMEOUT sets the length of time rsync will wait before it times out
# on a connection. Most users will benefit from this setting as it will
# reduce the amount of 'dead air' they experience when they run across
# the occasional, unreachable mirror. Dialup users might want to set this
# value up around the 300 second mark.
RSYNC_TIMEOUT=180
# Advanced Features
# =================
# MAKEOPTS provides extra options that may be passed to 'make' when a
# program is compiled. Presently the only use is for specifying
# the number of parallel makes (-j) to perform. The suggested number
# for parallel makes is CPUs+1.
MAKEOPTS="-j2"
#
# PORTAGE_NICENESS provides a default increment to emerge's niceness level.
# Note: This is an increment. Running emerge in a niced environment will
# reduce it further. Default is unset.
#PORTAGE_NICENESS=3
#
# AUTOCLEAN enables portage to automatically clean out older or overlapping
# packages from the system after every successful merge. This is the
# same as running 'emerge -c' after every merge. Set with: "yes" or "no".
# This does not affect the unpacked source. See 'noclean' below.
AUTOCLEAN="yes"
#
# FEATURES are settings that affect the functionality of portage. Most of
# these settings are for developer use, but some are available to non-
# developers as well.
#
# 'autoaddcvs' causes portage to automatically try to add files to cvs
# that will have to be added later. Done at generation times
# and only has an effect when 'cvs' is also set.
# 'buildpkg' causes binary packages to be created of all packages that
# are merged.
# 'ccache' enables ccache support via CC.
# 'cvs' feature for developers that causes portage to enable all
# cvs features (commits, adds) and all USE flags in SRC_URI
# will be applied for digests.
# 'digest' autogenerate a digest for packages.
# 'distcc' enables distcc support via CC.
# 'fixpackages' allows portage to fix binary packages that are stored in
# PKGDIR. This can consume a lot of time. 'fixpackages' is
# also a script that can be run at any given time to force
# the same actions.
# 'keeptemp' prevents the clean phase from deleting the temp files ($T)
# from a merge.
# 'keepwork' prevents the clean phase from deleting the WORKDIR.
# 'noauto' causes ebuild to perform only the action requested and
# not any other required actions like clean or
# 'noclean' prevents portage from removing the source and temporary files
# after a merge -- for debugging purposes only.
# 'nostrip' prevents stripping of binaries.
# 'notitles' disables xterm titlebar updates (which contain status info).
# 'sandbox' enable sandbox-ing when running emerge and ebuild
# 'strict' causes portage to react strongly to conditions that
# have the potential to be dangerous -- like missing or
# incorrect Manifest files.
# 'userpriv' allows portage to drop root privleges while it is compiling
# as a security measure, and as a side effect this can remove
# sandbox access violations for users.
# 'usersandbox' enables sandboxing while portage is running under userpriv.
# unpack -- for debugging purposes only.
#FEATURES="sandbox ccache distcc"
FEATURES="sandbox ccache"
#
# CCACHE_SIZE sets the space use limitations for ccache. The default size is
# 2G, and will be set if not defined otherwise and ccache is in features.
# Portage will set the default ccache dir if it is not present in the
# user's environment, for userpriv it sets: ${PORTAGE_TMPDIR}/ccache
# (/var/tmp/ccache), and for regular use the default is /root/.ccache.
# Sizes are specified with 'G' 'M' or 'K'.
# '4G' for 4 gigabytes, '4096M' for 4 gigabytes, etc... Default is 2G
CCACHE_SIZE="2G"
#
# DISTCC_DIR sets the temporary space used by distcc.
#DISTCC_DIR="${PORT_TMPDIR}/.distcc"
#
# RSYNC_EXCLUDEFROM is a file that portage will pass to rsync when it updates
# the portage tree. Specific chucks of the tree may be excluded from
# consideration. This may cause dependency failures if you are not careful.
# The file format is one pattern per line, blanks and ';' or '#' lines are
# comments. See 'man rsync' for more details on the exclude-from format.
#RSYNC_EXCLUDEFROM=/etc/portage/rsync_excludes
#GENTOO_MIRRORS="ftp://mirrors.tds.net/gentoo http://mirrors.tds.net/gentoo \
http://gentoo.seren.com/gentoo http://gentoo.mirrors.pair.com/"
#############
# Use the USE= below during bootstrap to ensure you have no problems during bootstrap
# IMPORTANT!!! Adjust mmx, mmx2, sse, sse2, 3dnow, 3dnowext use flags appropriately
# for your cpu type or you will have a bad day
# public service message from ali3nx
#
# USE adjusted to reflect gcj gcc ebuild bootstrap bug. 29/09/2004
#
# wiki use edited by ali3nx 01/01/2005
USE="16bit aac acl acpi activefilter aim amd ansi apache2 \
artworkextra audiofile authdaemond avantgo bash-completion \
bcmath bdf bidi blender-game bluetooth bzip2 bzlib cap cddb cdinstall \
cdparanoia cdrom cgi chroot cjk clanJavaScript clanVoice client \
code imap jython kadu-modules kadu-voice kakasi kerberos krb4 \
latex lcms leim libclamav libdsk libgd libgda libsamplerate libwww \
live lua lufsusermount lzo lzw lzw-tiff m17n-lib maildir matroska \
mbox mcal mdb memlimit migemo mime mixer mjpeg mls mmap mng \
monkey mozcalendar mozdevelop mozp3p mozsvg mozxmlterm mp3 mpeg4 \
mpi mplayer msn mule music mythtv mysql nagios-dns \
nagios-ntp nagios-ping nagios-ssh native net netcdf network \
neural nis nowin nptl nptlonly ntlm nviz oav objc ocaml \
offensive ofx openal opie oscar ospfapi \
parse-clocks pcap pcntl pcre pdf pg-hier pg-intdatetime \
pg-vacuumdelay php physfs pic plotutils portaudio posix postgresql \
povray ppds pri print procmail pthreads quotas quotes real \
resperl rhino rogue rplay S3TC samba sasl servlet-2.3 servlet-2.4 session \
sftplogging shared sharedmem silc simplexml skk slp smime sndfile \
snortsam sockets socks5 softquota sox spl ssl stencil-buffer stroke \
struts svg sysvipc szip t1lib tcsim tga theora tidy transcode \
truetype-fonts type1-fonts uim underscores unicode usb v4l v4l2 vcd \
vda videos virus-scan wddx winbind wmf wxwindows X509 xanim xatrix \
xchatdccserver xchattext xemacs xface xgetdefault xine xmlrpc xosd \
xpm xprint xrandr xscreensaver xsl xvid xvmc yahoo yaz yp yv12 zaptel \
zeo zvbi" |
WARNING: Also, beware of ACCEPT_KEYWORDS="~x86". Notice that the "~" before the architecture actually means that you're going to install your new system in the testing/unstable branch. If you want to remain in the stable branch, remove that character. |
[edit] Configured for Pentium 4 Processors
For the Pentium 4 processor, the following make.conf settings work nicely. The P4 in my notebook has hyperthreading, which makes the kernel see 2 CPUs, hence the increased "jX" number in MAKEOPTS.
CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j3"
[edit] Selecting Fast Mirrors
# 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.
Removed -a, mirrorselect uses -a by default
[edit] 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
# mount -t proc proc /mnt/gentoo/proc
[edit] 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
# mount -o bind /dev /mnt/gentoo/dev
[edit] Installing the Gentoo Base System
[edit] 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.
# cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
[edit] 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.
# chroot /mnt/gentoo /bin/bash
>> note: to leave the Gentoo base system chroot at any time type 'exit' once.
[edit] Rehashing the $path environment
# env-update && source /etc/profile
[edit] Getting the Portage Tree
# emerge --sync
or download a portage snapshot and extract :: jud
When doing emerge --sync you may find you recieve the following.
!!! Invalid token (not "=") file !!! ParseError: Invalid token (not '='): //etc/make.conf: line 397 in //etc/make.conf !!! Incorrect multiline literals can cause this. Do not use them.
you may find an extra line in make.conf that you do not want there, this is what is breaking it.
nano /etc/make.conf
Scroll down to the bottom of the file and you will see
xpm xprint xrandr xscreensaver xsl xvid xvmc yahoo yaz yp yv12 zaptel \ zeo zvbi" Binary file (standard input) matches
Comment out or delete the line
Binary file (standard input) matches
Save and retry
if you get:
>>> Updating Portage cache: Traceback (most recent call last): File "/usr/bin/emerge", line 3004, in ? conf = portage.config(config_profile_path=portage.settings.profile_path[:], \ TypeError: unsubscriptable object
then run again
emerge --sync
[edit] Update Portage
After emerge --sync, you will likely see that there is an update for portage. It is recommended that you update portage before doing anything else.
emerge portage
NOTE: if you receive "Can't locate ExtUtils/MakeMaker/Config.pm" while emerging portage dependency "dev-perl/Locale-gettext-1.05" you'll need to "emerge --nodeps gdbm libperl perl" now.
[edit] Selecting a Locale
# nano -w /etc/locale.gen en_US ISO-8859-1 en_US.UTF-8 UTF-8
Important quote from the official Gentoo Installation Handbook about setting up locales: This will not work for the bootstrapping, but when you recompile glibc afterwards it will.
[edit] Check and Change the Profile
Make sure make.profile points to the right directory, before you emerge linux-headers and bootstrap your system. The profile determines what system the bootstrap is going to make. This link isn't always correct, especially if you're using an old stage 1.
| Note: If you just updated portage from an old version, you may have to do another emerge --sync to download the latest profiles. |
ls -FFg /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.
unlink /etc/make.profile ln -s /usr/portage/profiles/default-linux/x86/2007.0 /etc/make.profile
[edit] Bootstrapping the System, Emerging System, Setting Runlevels
env-update && source /etc/profile && emerge --oneshot --nodeps gcc-config && USE="-* build bootstrap" emerge linux-headers && emerge --nodeps gdbm libperl perl && \ /usr/portage/scripts/bootstrap.sh
Finish with the Bootstrap Process
emerge -O libperl && emerge -O python && emerge shadow && emerge --deep system && \ emerge syslog-ng grub hotplug vixie-cron reiserfsprogs reiser4progs sysfsutils udev dhcpcd && \ USE="openntpd" emerge --nodeps acpid ntp && rc-update add syslog-ng default && rc-update add net.eth0 default && rc-update add vixie-cron default && \ rc-update add xinetd default && rc-update add sshd default && rc-update add hotplug default && \ rc-update add acpid default
- NOTE Since "coldplug" is now included automatically in the "udev" package, it has been removed from the above command.
Make sure to replace reiserfsprogs with jfsutils or xfsprogs if you plan to use those filesystem types User:Rukie
Make sure to emerge eselect and eselect-compiler after emerging of gcc-config (so emerge python will not break) NonWikiUser:Memoreyx
Gentoo 2006.1 doesn't need the eselect-compiler (masked) but eselect was necessary. User:Heywood
If you get "error while loading shared libraries: libexpat.so.0: cannot open shared object file: No such file or directory" during kbd emerge, try: User:ventura10
emerge expat ln -s /usr/lib/libexpat.so.1.5.0 /usr/lib/libexpat.so.0
expat is now updated, you should probably create the symlink against version 1.5.2 User:Meliorator
ln -fs /usr/lib/libexpat.so.1.5.2 /usr/lib/libexpat.so.0
I think the correct thing to do is to simply relink anything that depended on old expat against the new expat, in my case it was only the /usb/bin/xgettext executable and the following command fixed it (don't forget to clean /var/tmp/portage work directories if you have "noauto noclean" in FEATURES):
emerge gettextNon-user:balrog-kun
libperl is a metaname for perl during the base system installation. I added it redundantly to the base installation to satisfy emerge halting after the first emerge libperl which also would halt the base system install with various perl dependency issues -ali3nx
When I was doing the bootstrapping on an amd64 I discovered that libperl would not emerge properly even by entering it twice. To solve this I did this, and it appears to be working fine.
emerge --nodeps libperl
libperl is a part of the system build and doesn't appear to need to be emerged on its own. I have removed emerge libperl; emerge libperl && from in front of the emerge -e system. Let us know if this presents any problems. - User:GoldenEternity
*** note that if you've changed the CFLAGS at all, then the above command will fail during the "emerge --emptytree system", specifically when emerging "python-fchksum" (see this forum post). In order to fix this, ensure that you "emerge python" before the "emerge --emptytree system" - User:Nobbie
***Note: If emerge -O python fails with an error pertaining to the C Compiler, you must run emerge gcc-config; gcc-config -l; gcc-config X where X is equal to the most recent version of gcc (currently 4.1.1, my X was 6). Then continue with emerge python and so on. User:Rukie ***If this still fails, check if gcc-config is already emerged and follow the instructions above.
If the man pages of glibc can't be installed after its compilation, try the following: echo ">=sys-libs/glibc-2.3.4.20041102-r1" >> /etc/portage/package.mask
If you are not using 2005.0 or later Linux Kernel 2.6, then change linux-headers to linux26-headers if you are using the 2.6 kernel. This is because kernel 2.6 was not the standard kernel.
There seems to be issues with the lastest problems of portage and --emptytree, changed to --deep to fix problem --qnetjoe
The latest 2006.1 (and maybe earlier) have a broken stage1. This can be fixed by (before doing the command list above) executing the following command: emerge --nodeps gdbm libperl perl Emerge should then just run as normal --Sariel Amraphel
Added "emerge shadow" to above. It's a required dependency of net-nds/openldap-2.3.27-r2 which is a dependency in "emerge --deep system". - Dirk R. Gently
- NOTE removed coldplug from rc-update command above since that's allready handle by udev & added USE=openntpd to ntp emerge line. also added emerge --nodeps gdbm libperl perl before the bootstrap.sh command is run to avoid problems with perl. --User Likewhoa
- NOTE Gentoo's 2006.1 profile defaults to the no-nptl profile and the nptl,no-nptl USE flags will have no effect unless you update your profile. you must update your profile before you bootstrap the system and or you'll have a glibc without NPTL support. --User Likewhoa
[edit] 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.
# rc-update add ntp-client default # ntpdate -u -b pool.ntp.org
[edit] 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 Pacific Standard Time (Vancouver, Canada) so i chose /usr/share/zoneinfo/America/Vancouver 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.
# rm /etc/localtime
# ln -s /usr/share/zoneinfo/{path/to/your/timezonefile} /etc/localtime
[edit] Configuring the Kernel
[edit] Configuring the Kernel - With udev and gensplash!!!
This section is unnessary if you are using an amd64 as udev is the default and devfs is not included.
Since devfs is being deprecated soon you should be prepared to switch to udev when you're required. Hotplug and sysfsprogs are a must for udev. udev runs so much better for desktop environments than devfsd so i've decided to take you all under the knife. It's very simple to setup. Add Hotplug firmware loading in your kernel config, remove devfs filesystem support, emerge udev sysfsutils and make two changes to /etc/conf.d/rc that restrict devfsd from starting on boot and another that makes the rc system not extract the /dev tarball that is initially nonexistant on boot. My kernel config has all the needed changes premade to utilize udev appropriately. Here's a cutout from /etc/conf.d/rc with the needed changes made. Edit them in nano on your system and save the config file.
| File: /etc/conf.d/rc |
# ********************************************************************** # Edited 1st Jan, 2005 - bsodmike # ********************************************************************** RC_NET_STRICT_CHECKING="no" # Use this variable to control the /dev management behavior. # auto - let the scripts figure out what's best at boot # devfs - use devfs (requires sys-fs/devfsd) # udev - use udev (requires sys-fs/udev) # static - let the user manage static nodes RC_DEVICES="udev" # Set to "yes" if you want to save /dev to a tarball on shutdown # and restore it on startup. This is useful if you have a lot of # custom device nodes that udev does not handle/know about. # (ONLY used by UDEV enabled systems!) RC_DEVICE_TARBALL="no" |
lspci && lsmod (copy the output to a txt file that you can use for reference then use my base kernel .config and modify to your requirements. Genkernel will get you up and going but your system will not run as efficiently as it could.
(Small note: lspci is part of pciutils, so use "emerge pciutils" if you don't have it.)
This is what I see when I run lspci
pcilib: Cannot open /sys/bus/pci/devices 0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333] 0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333 AGP] 0000:00:06.0 Ethernet controller: Linksys NC100 Network Everywhere Fast Ethernet 10/100 (rev 11) 0000:00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80) 0000:00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82) 0000:00:11.0 ISA bridge: VIA Technologies, Inc. VT8235 ISA Bridge 0000:00:11.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06) 0000:00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 50) 0000:01:00.0 VGA compatible controller: nVidia Corporation NV34 [GeForce FX 5200] (rev a1)
and lsmod
Module Size Used by ipv6 182560 10 evdev 6464 0 tulip 36000 0 crc32 3040 1 tulip parport_pc 27072 0 parport 22728 1 parport_pc sbp2 16744 0 ohci1394 24836 0 ieee1394 62008 2 sbp2,ohci1394 ohci_hcd 15044 0 uhci_hcd 23152 0 usb_storage 46208 0 ehci_hcd 21028 0
To overcome this
# emerge gentoo-sources
or whatever kernel you want then To get the kernel config skel file do the following
# cd /usr/src/linux && wget http://stuff.bsodmike.com/gentoo/2004.3-r1/kernel-bsodmike.config && \ mv kernel-bsodmike.config .config && \ make oldconfig && \ make menuconfig
Welcome to the linux kernel configuration menu. Here you must change a few items for your configuration if your using my kernel config. My config is sutable for most systems however it's built to run on my system. Specifically you must change the following items to suit your configuration. # Processor type and features - mainly be concerned with your cpu type here # ATA/ATAPI/MFM/RLL support for storage controllers # Networking support - NIC Device drivers are your main concern Use Modules =] # 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. 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 # USB support - Three primary items to be concerned with here... If you have usb2 add the EHCI module as <m> 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
After configuring your kernel for supported devices exit from menuconfig and type the following
# make && make modules modules_install install
The command above will compile the kernel image, compile the kernel modules, install the modules and install the kernel in /boot creating symlinks for easier kernel upgrade management.
Note: Also, the stable source does not come ready for gensplash so you must use dev kernel or patch it (have not tried). - tikka
[edit] Installing Separate Kernel Modules
I always build tons of modules wherever possible unless doing so is not advisable. 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 insmod 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-kernel & nvidia-glx - Accelerated NVIDIA graphics for xorg-x11
- nforce-audio - On-board audio on NVIDIA NForce(2) motherboards (for 2.4 kernels only)
- e100 - Intel e100 Fast Ethernet Adapters (for 2.4 kernels only)
- e1000 - Intel e1000 Gigabit Ethernet Adapters (for 2.4 kernels only)
- emu10k1 - Creative Sound Blaster Live!/Audigy support (for 2.4 kernels only)
- ati-drivers - Accelerated ATI Radeon 8500+/FireGL graphics for xorg-x11
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. For instance, for the nvidia-kernel package:
# emerge --pretend nvidia-kernel
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 "<kernel version>" with the version of the kernel you just compiled:
# find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko'
Of the huge list this gave these are the modules I were interested in
/lib/modules/2.6.9-gentoo-r13/kernel/drivers/net/tulip/tulip.ko /lib/modules/2.6.9-gentoo-r13/kernel/drivers/usb/host/ehci-hcd.ko /lib/modules/2.6.9-gentoo-r13/kernel/drivers/usb/host/uhci-hcd.ko /lib/modules/2.6.9-gentoo-r13/kernel/sound/pci/ac97/snd-ac97-codec.ko /lib/modules/2.6.9-gentoo-r13/kernel/sound/pci/snd-via82xx.ko
The tulip driver is for my Linksys network card and supports many of the 100BaseTX cards out there.
Now lets edit /etc/modules.autoload.d/kernel-2.6 as shown below
# /etc/modules.autoload.d/kernel-2.6: kernel modules to load when system boots. # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/modules.autoload.d/kernel-2.6,v 1.1 2003/07/16 18:1$# # Note that this file is for 2.6 kernels. # # Add the names of modules that you'd like to load when the system # starts into this file, one per line. Comments begin with # and # are ignored. Read man modules.autoload for additional details. # For example: # 3c59x nvidia tulip ehci-hcd uhci-hcd snd-ac97-codec snd-via82xx
Now run modules-update to commit your changes to the /etc/modules.conf file:
# modules-update
[edit] Configuring Your System
[edit] Setting Up Hostnames and Domain Names
On older versions, it is sufficient to do:
echo gentoo1 > /etc/hostname echo kicks-ass.net > /etc/dnsdomainname rc-update add domainname default
However, newer versions require that you set variables in the hostname and domainname files. Edit the HOSTNAME, DNSDOMAIN and NISDOMAIN variables in these files. Then run rc-update add domainname default
| File: /etc/conf.d/hostname |
# /etc/conf.d/hostname # Set to the hostname of this machine HOSTNAME="gentoo1" |
| File: /etc/conf.d/domainname |
# /etc/conf.d/domainname # When setting up resolv.conf, what should take precedence? # If you wish to always override DHCP/whatever, set this to 1. OVERRIDE=1 # To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf # properly (domain entry in /etc/resolv.conf, and FQDN in /etc/hosts). # DNSDOMAIN="kicksass-net" # This only set what /bin/hostname returns. If you need to setup NIS, meaning # what /bin/domainname returns, please see: # # http://www.linux-nis.org/nis-howto/HOWTO/ # NISDOMAIN="kicksass-net" |
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:
# ********************************************************************** # /etc/hosts - Edited 1nd Jan, 2005 - bsodmike # ********************************************************************** # /etc/hosts: This file describes a number of hostname-to-address # mappings for the TCP/IP subsystem. It is mostly # used at boot time, when no name servers are running. # On small systems, this file can be used instead of a # "named" name server. Just add the names, addresses # and any aliases to this file... # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/hosts,v 1.7 2002/11/18 19:39:22 azarah Exp $ # 127.0.0.1 gentoo1.kicksass-net gentoo1 localhost.localdomain localhost # IPV6 versions of localhost and co ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
[edit] Configuring a Second Network Card
Perform the following for your second card
cd /etc/init.d ln -s net.lo net.eth1 rc-update add net.eth1 default
[edit] Setting up the network config file for first reboot
[edit] 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, iface_eth0 and dhcpcd_eth0, in the dhcp section about half way through the file.
| File: /etc/conf.d/net |
# ********************************************************************** # /etc/conf.d/net - Edited 1st Jan, 2005 - bsodmike # ********************************************************************** # /etc/conf.d/net: # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $ # Global config file for net.* rc-scripts # This is basically the ifconfig argument without the ifconfig $iface # # iface_eth0="10.0.0.30 broadcast 10.255.255.255 netmask 255.0.0.0" #iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0" # For DHCP set iface_eth? to "dhcp" # For passing options to dhcpcd use dhcpcd_eth? # iface_eth0="dhcp" dhcpcd_eth0="-t 10" # For adding aliases to a interface # #alias_eth0="192.168.0.3 192.168.0.4" # NB: The next is only used for aliases. # # To add a custom netmask/broadcast address to created aliases, # uncomment and change accordingly. Leave commented to assign # defaults for that interface. # #broadcast_eth0="192.168.0.255 192.168.0.255" #netmask_eth0="255.255.255.0 255.255.255.0" # For setting the default gateway # # gateway="eth0/10.0.0.138" |
[edit] Static IP setup
For a static configuration notice the changes made below, namely the commented-out iface_eth0 and dhcpcd_eth0 and the un-commented gateway:
| File: /etc/conf.d/net |
# ********************************************************************** # /etc/conf.d/net - Edited 1st Jan, 2005 - bsodmike # ********************************************************************** # /etc/conf.d/net: # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $ # Global config file for net.* rc-scripts # This is basically the ifconfig argument without the ifconfig $iface # iface_eth0="10.0.0.30 broadcast 10.255.255.255 netmask 255.0.0.0" #iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0" # For DHCP set iface_eth? to "dhcp" # For passing options to dhcpcd use dhcpcd_eth? # #iface_eth0="dhcp" #dhcpcd_eth0="-t 10" # For adding aliases to a interface # #alias_eth0="192.168.0.3 192.168.0.4" # NB: The next is only used for aliases. # # To add a custom netmask/broadcast address to created aliases, # uncomment and change accordingly. Leave commented to assign # defaults for that interface. # #broadcast_eth0="192.168.0.255 192.168.0.255" #netmask_eth0="255.255.255.0 255.255.255.0" # For setting the default gateway # gateway="eth0/10.0.0.138" |
[edit] Configuring Grub & fstab - Now with gensplash and grub skins!!
There's nothing cooler than spock ;) well or spock the gentoo developer's tizzight gensplash on the system you've managed to build by following this tutorial Cool so like that bitchin splash image on the livecd? hehe so do i... and why horde it to myslef and cackle and laugh alone looking at my computer boot gentoo linux for fun and kix. So here it is folks. More creature features courtesy of ali3nx
[edit] Adding gensplash
emerge splashutils && \ splash_geninitramfs -v -g /boot/fbsplash-emergence-1024x768 -r 1024x768 emergence && \ rc-update add splash default
The magic is done... Now you have an initrd that you must load with grub in menu.lst
[edit] Installing the Bootsectors
Make sure you have an mtab file for grub won't install correctly:
grep -v rootfs /proc/mounts > /etc/mtab
then:
grub grub> root (hd0,0) grub> setup (hd0) grub> quit
[edit] Editing /boot/grub/menu.lst
Perform the following:
# cd /boot/grub # nano -w /boot/grub/menu.lst
Edit the menu.lst file (this is really a symlink) as follows
| File: /boot/grub/grub.conf |
# ********************************************************************** # /boot/grub/grub.conf - Edited 2nd Jan, 2005 - bsodmike # ********************************************************************** # # Grub boot menu configuration file # # Boot automatically after 30 secs. timeout 30 # By default, boot the first entry. default 0 # Fallback to the second entry. fallback 1 splashimage=(hd0,0)/grub/gentoo.xpm.gz # For booting GNU/Linux title Gentoo-2.6.9-gentoo-r13 root (hd0,0) kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1024x768-32@85 splash=verbose,theme:emergence initrd (hd0,0)/fbsplash-emergence-1024x768 # note make certain the kernel line does not wrap to the next line!!!! title Gentoo-2.6.9-gentoo-r13-backup root (hd0,0) kernel (hd0,0)/vmlinuz.old ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1024x768-32@85 splash=verbose,theme:emergence initrd (hd0,0)/fbsplash-emergence-1024x768 # note make certain the kernel line does not wrap to the next line!!!! |
[edit] Changing The Resolution Later On
Now you have setup Gentoo but want this to be at 1280x1024...what do you do?
Enter the following
# splash_geninitramfs -v -g /boot/fbsplash-emergence-1280x1024 -r 1280x1024 emergence
And you should get the following output
o Creating directory structure.. o Copying /sbin/splash_helper.. o Copying themes.. - emergence o Creating initramfs image..
Now edit /boot/grub/menu.lst as follows and either add the following block as 'another' boot-up alternative or simply edit the current entry
| File: /boot/grub/menu.lst |
title Gentoo-2.6.9-gentoo-r13 root (hd0,0) kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1280x1024-32@75 splash=verbose,theme:emergence initrd (hd0,0)/fbsplash-emergence-1280x1024 # note make certain the kernel line does not wrap to the next line!!!! |
[edit] Installing a Custom Gentoo Labelled Grub Skin
I recently found a pimp grub splash themed just for gentoo linux that everyone and there momma's momma needs for gentoo boxen =] Thanks to schultz for making these fine examples of grub splash themes. Artistic credit due to the artisit here so we use the originating url.
# cd /boot/grub && wget http://www.schultz-net.dk/downloads/grub/gentoo.xpm.gz
[edit] Setting Up fstab
Tis is a step you do not want to do before installing grub... for some reason grub has a spaz attack and calls die() when it finds an fstab in completed fashion.
# nano -w /etc/fstab
Here's mine:
| File: /etc/fstab |
# ********************************************************************** # /etc/fstab - Edited 1st Jan, 2005 - bsodmike # ********************************************************************** # /etc/fstab: static file system information. # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.14 2003/10/13 20:03:38 azarah Exp $ # # noatime turns off atimes for increased performance (atimes normally aren't # needed; notail increases performance of ReiserFS (at the expense of storage # efficiency). It's safe to drop the noatime options if you want and to # switch between notail and tail freely. # <fs> <mountpoint> <type> <opts> <dump/pass> # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts. /dev/hda1 /boot ext3 noauto,noatime 1 1 /dev/hda2 none swap sw 0 0 /dev/hda3 / xfs noatime 1 1 /dev/hda5 /opt ext3 defaults 0 1 /dev/hda6 /home ext3 defaults 0 1 /dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro,user,exec 0 0 #/dev/fd0 /mnt/floppy auto noauto 0 0 # NOTE: The next line is critical for boot! none /proc proc defaults 0 0 # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for # POSIX shared memory (shm_open, shm_unlink). # (tmpfs is a dynamically expandable/shrinkable ramdisk, and will # use almost no memory if not populated with files) # Adding the following line to /etc/fstab should take care of this: none /dev/shm tmpfs defaults 0 0 |
Notice how I tell the system about hda5 and hda6 here. When you boot for the first time you will get an error saying that '/opt' does not exist. This is because you need to do the following:
# mkdir /opt
user,exec mount opts on cdrom devices allows users to mount cdroms without sudo or su privleges. Covered in the documentation for cedega by transgaming.
[edit] 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.
# 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
# rc-update add hdparm boot
[edit] System Information
[edit] 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 ;)
passwd to change root's pass useradd <yourname> -m -k /etc/skel -g users -G audio,cron,wheel,portage,games -d /home/<yourname> -s /bin/bash passwd <yourname>
[edit] System Information
Gentoo uses /etc/rc.conf for general, system-wide configuration.
This file has quite a few options that should be looked at and will need to be edited if you want to be able to have gnome (or some windowmanager) load up at boot. Of course you'll need to emerge gnome before your next reboot.
Open up /etc/rc.conf and configure it as follows to load up gnome at next boot
| File: /etc/rc.conf |
# /etc/rc.conf: Global startup script configuration settings # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/rc.conf,v 1.22 2003/10/21 06:09:42 vapier Exp $ # Use KEYMAP to specify the default console keymap. There is a complete tree # of keymaps in /usr/share/keymaps to choose from. This setting is used by the # /etc/init.d/keymaps script. KEYMAP="us" # Should we first load the 'windowkeys' console keymap? Most x86 users will # say "yes" here. Note that non-x86 users should leave it as "no". SET_WINDOWKEYS="no" # The maps to load for extended keyboards. Most users will leave this as is. EXTENDED_KEYMAPS= #EXTENDED_KEYMAPS="backspace keypad" # CONSOLEFONT specifies the default font that you'd like Linux to use on the # console. You can find a good selection of fonts in /usr/share/consolefonts; # you shouldn't specify the trailing ".psf.gz", just the font name below. # To use the default console font, comment out the CONSOLEFONT setting below. # This setting is used by the /etc/init.d/consolefont script (NOTE: if you do # not want to use it, run "rc-update del consolefont" as root). CONSOLEFONT="default8x16" # CONSOLETRANSALTION is the charset map file to use. Leave commented to use # the default one. Have a look in /usr/share/consoletrans for a selection of # map files you can use. #CONSOLETRANSLATION="8859-1_to_uni" # Set CLOCK to "UTC" if your system clock is set to UTC (also known as # Greenwich Mean Time). If your clock is set to the local time, then set CLOCK # to "local". This setting is used by the /etc/init.d/clock script. CLOCK="UTC" # Set EDITOR to your preferred editor. EDITOR="/bin/nano" #EDITOR="/usr/bin/vim" #EDITOR="/usr/bin/emacs" # Set PROTOCOLS to the protocols that you plan to use. Gentoo Linux will only # enable module auto-loading for these protocols, eliminating annoying module # not found errors. # # NOTE: Do NOT uncomment the next lines, but add them to 'PROTOCOLS=...' line!! # # Num Protocol # 1: Unix # 2: IPv4 # 3: Amateur Radio AX.25 # 4: IPX # 5: DDP / appletalk # 6: Amateur Radio NET/ROM # 9: X.25 # 10: IPv6 # 11: ROSE / Amateur Radio X.25 PLP # 19: Acorn Econet # Most users want this: PROTOCOLS="1 2" #For IPv6 support: #PROTOCOLS="1 2 10" # What display manager do you use ? [ xdm | gdm | kdm | entrance ] DISPLAYMANAGER="gdm" # XSESSION is a new variable to control what window manager to start # default with X if run with xdm, startx or xinit. The default behavior # is to look in /etc/X11/Sessions/ and run the script in matching the # value that XSESSION is set to. The support scripts is smart enouth to # look in all bin directories if it cant find a match in /etc/X11/Sessions/, # so setting it to "enligtenment" can also work. This is basically used # as a way for the system admin to configure a default system wide WM, # allthough it will work if the user export XSESSION in his .bash_profile, etc. # # NOTE: 1) this behaviour is overridden when a ~/.xinitrc exists, and startx # is called. # 2) even if a ~/.xsession exist, if XSESSION can be resolved, it will # be executed rather than ~/.xsession, else KDM breaks ... # # Defaults depending on what you install currently include: # # Gnome - will start gnome-session # kde-<version> - will start startkde (ex: kde-3.0.2) # Xsession - will start a terminal and a few other nice apps XSESSION="Gnome" |
As you can see, this file is well commented to help you set up the necessary configuration variables. Take special care with the KEYMAP setting: if you select the wrong KEYMAP you will get weird results when typing on your keyboard.
PPC uses x86 keymaps on most systems. Users who want to be able to use ADB keymaps on boot have to enable ADB keycode sendings in their kernel and have to set a mac/ppc keymap in rc.conf.