http://forums.gentoo.org/viewtopic-t-345229.html
The Text of This Tutorial is Copyright 2005 by Bob P. / The Jackass! Project. All Rights Reserved.
----------------------------------------------------------------------------------------------------------------------------
Stage 1/3 Installation for Gentoo 2005.0 and GCC 3.4.3
This is an Update to the Stage 1/3 NPTL Installation Method for Gentoo 2004.3
WARNING: This is an ADVANCED installation method. The amount of time required for you to complete this type of installation will equal or exceed that of any other Gentoo installation method. Your time will be well invested, though, as the result will be a very stable Gentoo system. This installation method may prove to be somewhat difficult and cumbersome for users who are new to Gentoo. It will prove especially painful for users who plan to install Gentoo old hardware.
NOTE: The Documentation, Tips & Tricks Forum is NOT a support forum. If you should encounter problems during your Gentoo installation, please DO NOT post requests for assistance to this thread. Please seek help in the support thread that is dedicated to this installation method.
Faster than a Speeding Bullet...
More Powerful than a Locomotive!
How To Build a Fast and Bulletproof Gentoo System -- Stage 1 NPTL Installation on a Stage 3 Tarball Using GCC 3.4.3
Introduction
Any Gentoo installation that is performed with anything other than a Stage 3 tarball suffers from two problems: They suffer from circular dependencies within the base system, and they have the potential to leave behind unwanted files from the stage tarball because /var/db/pkg is incomplete.
As rac noted, "There are some 80+ packages in a stage1ball that are not listed in /var/db/pkg. Why? When you do your "emerge system", you would want your new toolchain to be used to compile all software. If portage sees that a particular version from the stageball is still current, it will omit it. The solution that somebody apparently chose was to make portage forget that most of this software is installed at all, which has the unfortunate side effect of making portage be unable to clean it when your "emerge system" finishes."
So it seems that there are some good reasons to never install from a Stage 1 tarball, and some good reasons to always install from a Stage 3 tarball. The good news is that you can perform a Stage 1 installation using a Stage 3 tarball and have the best of both worlds.
With the advent of Gentoo 2005.0 the situation has improved markedly for users who wish to perform Stage 1 installs. Unfortunately, the GCC 3.4.3 toolkit components remain testing branch ebuilds. As such, Gentoo 2005.0 continues to ship with a stable branch GCC 3.3.x compiler. Until such time that the GCC 3.4.3 compiler is reclassified into the stable software branch, the Stage 1/3 installation method will continue to be necessary for those who wish to upgrade to a GCC 3.4.3-based toolkit.
Objective
This Installation Guide will describe how to perform a "Stage 1 on 3" installation of Gentoo on a Pentium-class x86 platform using 2005.0 installation media, a single CD-ROM drive and a single EIDE hard disk. It will take advantage of the latest 2.6 kernels, NPTL threading, udev, and the latest GCC 3.4.3 compiler.
As you read this, you might be thinking: "Why a Pentium-class PC?" Depending upon how you look at it, the answer can be simple or complex; The simple answer is that a Pentium-class PC was the only computer that I had left when I was developing this Guide that didn't already have Gentoo installed on it. As I wrote the original version of this Guide I was working on a project to turn that PC into a linux-based a router.
The complex answer relates to compatability of this installation method on a heterogeneous group of PCs; A pentium processor is probably the most recent platform that is a common ancestor for all of the x86-class processors (AMD or Intel) that Gentoo is likely to run upon.
When you follow this Guide, please resist the temptation to blindly follow it unless you are installing on a system that has a Pentium processor. You should always choose the correct tarball and CHOST setting for your processor.
To perform a 2005.0 Stage 1/3 Installation, follow these steps:
1. Download and Burn the Minimal Installation CD. The .ISO image required for the hardware used in this example is
Code: Select all
http://gentoo.osuosl.org/releases/x86/2005.0/installcd/install-x86-minimal-2005.0.iso3. Configure LAN Card. We're assuming that your LAN card has been recognized and that you can obtain a LAN connection via DHCP.
Code: Select all
# dhcpcd eth04.1 View the Hard Drive's Operational Parameters. In this example we will assume that only one hard disk will be installed on the system. It will be recognized by Gentoo as /dev/hda. We will start off by viewing the default disk parameters at boot:
Code: Select all
# hdparm /dev/hda
/dev/hda:
multcount = 16 (on)
IO_support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 1 (on)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 256 (on)
geometry = 16383/255/63, sectors = 120034123776, start = 0
# hdparm -i /dev/hda
/dev/hda:
Model=WDC WD1200JB-00GVA0, FwRev=08.02D08, SerialNo=WD-WMAL92634373
Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq}
RawCHS=16383/16/63, TrkSize=57600, SectSize=600, ECCbytes=74
BuffType=DualPortCache, BuffSize=8192kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=234441648
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
AdvancedPM=no, WriteCache=enabled
Drive conforms to: device does not report version:
* signifies the current active mode Code: Select all
# hdparm -a256A1c1d1m16u1 /dev/hda
/dev/hda:
setting fs readahead to 256
setting 32-bit IO_support flag to 1
setting multcount to 16
setting unmaskirq to 1 (on)
setting using_dma to 1 (on)
setting drive read-lookahead to 1 (on)
multcount = 16 (on)
IO_support = 1 (32-bit)
unmaskirq = 1 (on)
using_dma = 1 (on)
readahead = 256 (on)Typical results for a Pentium-class PC without UDMA:
Code: Select all
# hdparm -tT /dev/hda
/dev/hda:
Timing cached reads: 144 MB in 2.04 seconds = 70.60 MB/sec
Timing buffered disk reads: 26 MB in 2.65 seconds = 9.81 MB/secCode: Select all
# hdparm -tT /dev/hda
/dev/hda:
Timing cached reads: 520 MB in 2.01 seconds = 258.75 MB/sec
Timing buffered disk reads: 114 MB in 3.01 seconds = 37.90 MB/sec4.4.1 Display the Partition Information
Technically, the syntax of this command is used to change the partition information, but on an unpartitioned drive it will display the partition information that is available:
Code: Select all
# fdisk /dev/hda
The number of cylinders for this disk is set to 14593.
There is nothing wrong with that, but this is larger than 1024,
and in certain setups could 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): p
Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): To keep it simple, we're going to use the following partition scheme. I'll leave out the details, assuming that you know how to partition your hard disk.
Code: Select all
Partition File System ID Size Description
/dev/hda1 ReiserFS 3.6 83 100 MB Boot partition
/dev/hda2 (swap) 82 512 MB Swap partition
/dev/hda3 ReiserFS 3.6 83 Remainder Root Partition4.4.4 Verify the partition configuration.
Code: Select all
Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 76 506047+ 82 Linux swap
/dev/hda3 77 14593 116607802+ 83 LinuxCode: Select all
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks
4.5.1 Install Reiser FS on /dev/hda1 and /dev/hda3:
Code: Select all
# mkreiserfs /dev/hda1 && mkreiserfs /dev/hda34.5.2 Install the swap partition on /dev/hda2:
Code: Select all
# mkswap /dev/hda2 && swapon /dev/hda2Code: Select all
# mount /dev/hda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mount /dev/hda1 /mnt/gentoo/boot5. Installing the Gentoo Installation Files.
5.1 Download the Stage 3 Tarball from the Internet.
Go to the gentoo mount point on your hard disk:
Code: Select all
# cd /mnt/gentooWe will download the following four files using the "wget" command at the bash prompt. The entire command must be typed on one line:
Code: Select all
# wget http://gentoo.osuosl.org/releases/x86/2005.0/stages/x86/stage3-x86-2005.0.tar.bz2
# wget http://gentoo.osuosl.org/releases/x86/2005.0/stages/x86/stage3-x86-2005.0.tar.bz2.md5(If your architecture is not x86 you will need to change the path and filename to suit your needs.)
5.2 Verify the md5sum of the Tarballs.
Code: Select all
# md5sum -c stage3-x86-2005.0.tar.bz2.md5
stage3-x86-2005.0.tar.bz2: OKCode: Select all
tar -xjpvf stage3-x86-2005.0.tar.bz25.4 Installing Portage
5.4.1 Download a Fresh Portage Snapshot from the Internet.
Code: Select all
# wget http://gentoo.osuosl.org/snapshots/<most_recent_snapshot>.tar.bz2Code: Select all
tar -xjvf /mnt/gentoo/<portage_snapshot>.tar.bz2 -C /mnt/gentoo/usrCode: Select all
# wget http://gentoo.osuosl.org/snapshots/portage-20050326.tar.bz2
# wget http://gentoo.osuosl.org/snapshots/portage-20050326.tar.bz2.md5sum
# md5sum -c portage-20050326.tar.bz2.md5sum
# tar -xjvf /mnt/gentoo/portage-20050326.tar.bz2 -C /mnt/gentoo/usr6. Installing the Gentoo Base System
6.1 Copy DNS Information Copy the DNS information in /etc/resolv.conf to ensure that networking works in our new Gentoo environment.
Code: Select all
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf 6.2 Mount the proc filesystem We will mount the /proc file system to allow our Gentoo installation to use kernel-provided information within the chrooted environment.
Code: Select all
# mount -t proc none /mnt/gentoo/proc
# cp /proc/mounts /mnt/gentoo/etc/mtab6.3 Chroot into the New Environment
Code: Select all
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile6.4 Set the Date and Time
6.4.1 Set the Correct Date and Time.
The date command uses the syntax MMDDHHMMYYYY, where MM is the month, DD is the day, HHMM is the time, and YYYY is the year. As I type this, it is Sunday March 27, 2005 at 19:30:
Code: Select all
# date 032719302005
Sun Mar 27 19:30:00 Local time zone must be set--see zic manual page 2005This example displays the available time zone selections for the Western Hemisphere:
Code: Select all
# ls /usr/share/zoneinfo/AmericaCode: Select all
# rm /etc/localtime
# ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
Sun Mar 27 19:32:50 CST 2005The previous example showed how to select a city when setting the timezone symlink. It is my opinion that you should always choose a city that is in your time zone, and use the city to set the time zone symlink. You should NEVER choose a time zone as your symlink for the setting the time zone. Here's why:
I live in Chicagoland. By setting the timezone symlink to the nearest major city, Chicago, I don't have to worry about implementing Daylight Savings Time. Linux is smart enough to spring forward and fall back so that no changes to the system time are necessary on my part. This past weekend, when Chicago changed from Central Standard Time to Central Daylight Time, I watched with glee as the clocks on all of my linux PCs ticked from 01:59:59 CST to 03:00:00 CDT. (Just in case you were wondering, THAT is confirmation that I am a basement-dwelling linux g33k!) If I had made the mistake of setting the timezone symlink to CST, then linux would have kept my PC's clock on CST, even though the city that I live in had switched to CDT. In this case, I would either have to manually change my clock over from CST to CDT, or learn to live with a PC who's clock is off by an hour.
6.5 Configuring the USE Flags, Portage Options, and Compile Options: /etc/make.conf
In this example, we're compiling for the x86 architecture and a Pentium-class i586 subarchitecture. Our CHOST setting will be i586-pc-linux-gnu. Do not blindly follow the Guide and use this setting unless you are building for a 586-class computer! Use the appropriate tarball, CHOST setting, and architecture specifications for your processor.
This Guide uses a minimalist setting of the USE variable. You are free to add additional USE flags as needed for your specific system requirements, but it is recommended that you do not add them to /etc/make.conf until after you have completed the entire installation.
Please note: The specification of the "nptl" and the exclusion of the "nptlonly" USE flag is intentional, in order to provide both NPTL threading support in glibc as well as fallback support for linuxthreads. Use of the "nptlonly" USE flag is NOT recommended! The use of hardened GCC 3.4.3 is not recommended on any x86 systems except AMD64.
Code: Select all
# cat /etc/make.conf
CHOST="i586-pc-linux-gnu"
CFLAGS="-O2 -march=pentium -fomit-frame-pointer -pipe"
CXXFLAGS=${CFLAGS}
ACCEPT_KEYWORDS="x86"
PORTAGE_TMPDIR=/var/tmp
PORTDIR=/usr/portage
DISTDIR=${PORTDIR}/distfiles
PKGDIR=${PORTDIR}/packages
PORT_LOGDIR=/var/log/portage
PORTDIR_OVERLAY=/usr/local/portage
GENTOO_MIRRORS="<your mirror goes here> http://gentoo.osuosl.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
RSYNC_RETRIES="3"
RSYNC_TIMEOUT=180
MAKEOPTS="-j2"
PORTAGE_NICENESS=3
AUTOCLEAN="yes"
FEATURES="ccache distlocks sandbox userpriv usersandbox"
CCACHE_SIZE="512M"
RSYNC_EXCLUDEFROM=/etc/portage/rsync_excludes
USE="nptl"
6.6 Additional Portage Configuration
6.6.1 Create Portage Directories
The sample /etc/make.conf listed above specifies directories for Portage log files and overlays that are not included as part of a standard Gentoo installation. If you are going to use the logging and overlay functions listed in the sample make.conf file, then you will need to create two additional directories on your system.
Code: Select all
# mkdir /var/log/portage
# mkdir /usr/local/portageSkip this step and proceed to the next section if you have configured your system to use the "~x86" testing branch.
At the time that I write this guide, GCC 3.4.3 is part of the unstable or "testing" branch in Portage. If you will be using the "x86" stable branch of the software, then we need to configure Portage to enable the use of GCC 3.4.3 and some other toolkit components, even though they are currently classified in the testing branch.
To configure a stable branch system to utilize a testing branch ebuild, we need to let Portage know that we have approved this subset of the testing branch for use on our system. This is accomplished by specifying the name of the package and the applicable keyword in the /etc/portage/package.keywords file. We will enable support for four testing branch ebuilds in our system.
Code: Select all
# cat /etc/portage/package.keywords
# for a 586 CHOST
~sys-devel/gcc-3.4.3.20050110 ~x86
sys-devel/gcc-config ~x86
sys-libs/libstdc++-v3 ~x86
~sys-libs/glibc-2.3.4.20050125 ~x86Code: Select all
# cat /etc/portage/package.keywords
# for a 686 CHOST:
~sys-devel/gcc-3.4.3.20050110 ~x86
sys-devel/gcc-config ~x86
sys-libs/libstdc++-v3 ~x86
sys-libs/glibc ~x86We will now update our portage snapshot to include the current portage tree.
Code: Select all
emerge --sync6.7 Activate User Locales
When compiling glibc (we'll do this in an upcoming step), Gentoo's default behavior is to compile a full set of all of the available user locales. We will activate the userlocales local USE flag to limit the compilation of userlocales to those that we specify. Limiting the scope of userlocales will save us a tremendous amount of time while compiling glibc. (While we're editing this file, we'll also add "ithreads" as a package-specific USE flag for perl and libperl to allow interpreter level threading. This flag is optional but recommended.)
6.7.1 Activate the userlocales USE flag for glibc
Code: Select all
# cat /etc/portage/package.use
sys-libs/glibc userlocales
sys-devel/libperl ithreads
dev-lang/perl ithreadsCreate the /etc/locales.build file with your favorite editor. I'm located in the USA, so I'll use the following values.
Code: Select all
# cat /etc/locales.build
en_US/ISO-8859-1
en_US.UTF-8/UTF-8 7.1 Building the Toolkit: GCC 3.3.5
To enable NPTL support we are required to use a 2.6 kernel and linux26-headers. Linux26-headers is now contained in the 2005.0 Stage 3 tarball, so it is no longer necessary to manipulate the linux headers as it was when installing with 2004.3 media.
Code: Select all
# env-update && source /etc/profile
# emerge gcc-config glibc binutils gcc7.2 Re-Building the Toolkit: GCC 3.4.3
After emerging a new version of GCC, we need to pause for a moment and think about what we've done. We've just used GCC 3.3.5 and a toolchain built with GCC 3.3.5 to compile GCC 3.4.3. Before we spend any more time building our Gentoo system we should rebuild the entire toolchain, re-compiling it so that we have GCC 3.4.3 that was built with GCC 3.4.3.
Before we do this we need to examine /etc/make.conf and make changes to the CFLAGS statements in order to take advantage of the new performance-enhancing features of GCC 3.4.3. After making necessary updates to /etc/make.conf we need to rebuild the toolkit using the new GCC 3.4.3 compiler. The result will be a 3.4.3 tooklit, compiled by a 3.4.3 toolkit that was built with a 3.3.5 toolkit. Clear as mud?
7.2.1 Updating make.conf
Here are some settings for /etc/make.conf that may be worth considering. They are the actual CFLAGS that I used to build my systems and have proven reliable on multiple installations. They include extreme levels of code optimization (notice the -O3 flag), and some very safe and stable performance-enhancing CFLAGS. Depending upon your individual hardware, you may have to simplify some of the CFLAGS settings. Note that the referenced architecture in this example is Intel Pentium.
Code: Select all
CFLAGS="-O3 -march=pentium -fforce-addr -momit-leaf-frame-pointer -fomit-frame-pointer -ftracer -pipe"
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"Code: Select all
CFLAGS="-O2 -march=pentium -fomit-frame-pointer -pipe"
CXXFLAGS=${CFLAGS} Although we have emerged GCC 3.4.3, it has not been automatically installed as our default compiler. If you have any doubts about this, take a quick peek at the output of "emerge info" or "gcc-config -l". Although GCC 3.4.3 has already been emerged, GCC 3.3.5 is still installed as out default compiler:
Code: Select all
# gcc-config -l
[1] i686-pc-linux-gnu-3.3.5 *
[2] i686-pc-linux-gnu-3.3.5-hardened
[3] i686-pc-linux-gnu-3.3.5-hardenednopie
[4] i686-pc-linux-gnu-3.3.5-hardenednossp
[5] i686-pc-linux-gnu-3.4.3-20050110
[6] i686-pc-linux-gnu-3.4.3-20050110-hardened
[7] i686-pc-linux-gnu-3.4.3-20050110-hardenednopie
[8] i686-pc-linux-gnu-3.4.3-20050110-hardenednossp Code: Select all
# gcc-config 5An additional command updates our system environment:
Code: Select all
# env-update && source /etc/profileNow that GCC 3.4.3 has been installed as our default compiler, we can prune GCC 3.3.5 from our system by issuing the following commands. First, verify that GCC 3.4.3 has indeed been installed as the default compiler using the "l" parameter with gcc-config. (Just to avoid any confusion, the parameter used is a small letter "L", not a "one."). Then, after confirming that GCC 3.4.3 has been installed as the default compiler, prune GCC 3.3.5 from your system.
Code: Select all
# gcc-config -l
# emerge -P gccNow its time to rebuild the toolkit. We'll start off by recompiling glibc, binutils, gcc, and by updating portage. This will rebuild our GCC 3.4.3 compiling toolkit (which had previuosly been compiled with GCC 3.3.5) with the GCC 3.4.3 compiler, taking advantage of our new USE flags and CFLAGS compiler settings.
Code: Select all
# emerge glibc binutils gcc portage The result will be a 3.4.3 tooklit and an entire system that is built with a 3.4.3 toolkit, that was built with a 3.4.3 toolkit.
Code: Select all
# emerge -e system Although these command have been broken down into separate steps for the purpose of clarity, they can be concatenated into three steps. The one-liners in Steps 1 and 3 will take quite some time to complete, and represent good opportunities for you to take an extended break while Gentoo does its thing.
Step 1:
Code: Select all
# env-update && source /etc/profile && emerge gcc-config glibc binutils gcc Step 3:
Code: Select all
# gcc-config 5 && env-update && source /etc/profile && emerge -P gcc && emerge glibc binutils gcc portage && emerge -e system 8.0 Building the World
8.1 Emerge Ccache (Optional)
Now that our toolkit has been built, we'll emerge the ccache program. Ccache is a compiler cache that will help to reduce compile times when previously compiled programs are being recompiled. It will not effect the time required to compile programs on the first pass, so this is an optional step. (Note: the ccache_size was set to 512 MB in the sample make.conf. If you have sufficient disk space, and you're planning on emerging a bloated window manager like Gnome or KDE (or if you are performing an emerge -e system or an emerge -e world), then you may want to increase the to something like ccache_size="2G".)
Code: Select all
# emerge ccacheNow its time to add a few useful packages to our world profile:
Code: Select all
# emerge syslog-ng xinetd grub vixie-cron reiserfsprogs sysfsutils dhcpcd hotplug coldplug gentoolkit
# emerge --nodeps acpid ntp8.3 Updating the Environment
Now we'll add these services to the default runlevel. Here two ways to accomplish this task that are functionally equivalent. Choose the one you like best.
Code: Select all
# 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 coldplug default
# rc-update add acpid default
# rc-update add ntp-client defaultCode: Select all
for x in syslog-ng net.eth0 vixie-cron xinetd sshd hotplug coldplug acpid ntp-client ; do rc-update add $x default ; done In the previous steps we emerged a Network Time Protocol client to allow us to use NTP time servers to synchronize our system clock. In this step we'll configure the ntp-client to eliminate clock skew:
Code: Select all
# ntpdate -b -u pool.ntp.org9. Kernel
9.1 Downloading the Kernel
The decision to enable NPTL support requires that we use a 2.6 kernel. You are free to choose any flavor of 2.6 kernel that you like. In this example, we'll be using the Gentoo (Development) Sources kernel. Note that a 2.4 kernel will not work properly with this Installation Guide.
Code: Select all
# emerge gentoo-sourcesCode: Select all
# rm /usr/src/linux
# cd /usr/src
# ln -s linux-2.6.11-gentoo-r4 linux 9.3.1 Enable udev Support
Edit your /etc/conf.d/rc file so that it contains the following statements:
Code: Select all
RC_NET_STRICT_CHECKING="no"
RC_DEVICES="udev"
RC_DEVICE_TARBALL="no" If you're following this Installation Guide, we're going to assume that you want the best performance from your system, and that you'll be using a custom-compiled kernel instead of genkernel. When configuring your kernel, be sure to include support for hotplug firmware loading. Also be sure to remove devfs filesystem support, as we are designing udev support into our system.
Configure the kernel:
Code: Select all
# cd /usr/src/linux
# make menuconfig To compile your kernel and install the kernel and selected modules, issue the following command. I find that this one works a bit better than some of the other one-liner kernel compilation commands. If you should run into a problem where kernel compilation fails, its easy to determine where the problem was. In addition, this command will also install the kernel for you:
Code: Select all
# make && make modules && make modules_install && make install 10. Configuring the System
10.1 Configure Network Adapters
Configure your network adapters as recommended in the Gentoo Installation Handbook. In our case, we'll use DHCP:
Code: Select all
# cat /etc/conf.d/net
iface_eth0="dhcp"
dhcpcd_eth0="-t 10"
Code: Select all
# (For DHCP)
iface_eth0="dhcp"
# Some network admins require that you use the
# hostname and domainname provided by the DHCP server.
# In that case, add the following to let dhcpcd use them.
# That will override your own hostname and domainname definitions.
dhcpcd_eth0="-HD"
# If you intend on using NTP to keep your machine clock synchronized, use
# the -N option to prevent dhcpcd from overwriting your /etc/ntp.conf file
dhcpcd_eth0="-N"
#(For static IP)
iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
gateway="eth0/192.168.0.1"
#(For rp-pppoe)
iface_eth0="up"
10.2 Set Hostnames and Domainnames
The following hostname and domainname locations referenced in the Gentoo Installation Handbook and some of the other HowTo appear to have been deprecated. The first example in each of the following two sections uses the old configuration method, which has been deprecated but this is not yet reflected in many of the installation guides. The second option in each of the following two examples is more current:
10.2.1 Set Your Hostname
The following examples provide instruction for setting the hostname on your Gentoo box. Since we're installing Gentoo on an old Pentium-class PC, we'll use the "boatanchor" as the hostname in this example.
Code: Select all
# echo boatanchor > /etc/hostname Code: Select all
# cat /etc/conf.d/hostname
HOSTNAME="boatanchor"
Code: Select all
# echo mydomain.com > /etc/dnsdomainname
# echo nis.mydomain.com > /etc/nisdomainname Code: Select all
# cat /etc/conf.d/domainname
OVERRIDE=1
DNSDOMAIN="mydomain.com"
NISDOMAIN="nis.mydomain.com"
If nameservers on your network handle all name resolution, then you can skip this step.
If your PC is a standalone system, or if your PC has a static IP address and you don't have DNS entries for your machine in a nameserver somwehere on your network, then you should specify the following information in the /etc/hosts file.
Code: Select all
127.0.0.1 localhost.localdomain localhost
static.ip.addr.ess boatanchor.mydomain.com boatanchorCode: Select all
127.0.0.1 localhost.localdomain localhost
192.168.0.5 boatanchor.mydomain.com boatanchorCode: Select all
# rc-update add domainname default
10.3 Gensplash
For all of you eye-candy addicts who can't live without it, here's the section where we add gensplash to give us those ultra-cool
Code: Select all
# emerge splashutils && splash_geninitramfs -v -g /boot/fbsplash-emergence-1024x768 -r 1024x768 emergence && splash_geninitramfs -v -g /boot/fbsplash-emergence-1280x1024 -r 1280x1024 emergence && splash_geninitramfs -v -g /boot/fbsplash-emergence-1600x1200 -r 1600x1200 emergence && rc-update add splash default 10.4 Grub Bootloader
10.4.1 Grub.conf
To boot our installation of Gentoo Linux we'll need to configure a boot menu for the Grub Bootloader. Use your favorite text editor to create the /boot/grub/grub.conf file. In this case we'll use nano:
Code: Select all
# cd /boot/grub
# nano -w grub.confCode: Select all
# Grub boot menu configuration file
#
# Boot automatically after 30 secs.
timeout 30
# By default, boot the second entry.
default 1
# Fallback to the first entry.
fallback 0
# Use default Grub Splash image
# splashimage=(hd0,0)/grub/splash.xpm.gz
#
# Use custom (downloaded) Gentoo Splash Image
splashimage=(hd0,0)/grub/gentoo.xpm.gz
# Boot Gentoo Linux (no framebuffer)
title Gentoo-2.6.11-r5
root (hd0,0)
kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1024x768-16@85
# Boot Gentoo Linux at 1024x768 framebuffer resolution
title Gentoo-2.6.11-r5, 1024x768
root (hd0,0)
kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1024x768-24@85 splash=verbose,theme:emergence
initrd (hd0,0)/fbsplash-emergence-1024x768
# Boot Gentoo Linux at 1280x1024 framebuffer resolution
title Gentoo-2.6.11-r5, 1280x1024
root (hd0,0)
kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1280x1024-24@85 splash=verbose,theme:emergence
initrd (hd0,0)/fbsplash-emergence-1280x1024
# For installing GRUB into the hard disk
title Install GRUB into the hard disk
root (hd0,0)
setup (hd0)
10.4.2 Installing Grub onto the Hard Disk
Start Grub from the command prompt and use the following commands to embed grub into the hard disk. Remember, when counting hard disks we like to start at 1, but Grub likes to start at 0, so /dev/hda1 corresponds to hard disk 0, partition 0 in Grub.
Code: Select all
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
We'll also download a cool Gentoo-specific splash screen for Grub.
Code: Select all
wget http://www.schultz-net.dk/downloads/grub/gentoo.xpm.gz10.5 Filesystem - Configuring fstab
This is a sample /etc/fstab file that reflects the disk partition scheme used earlier in this Installation Guide. Make changes as appropriate if your partition scheme is different.
Code: Select all
# <fs> <mountpoint> <type> <opts> <dump/pass>
/dev/hda1 /boot reiserfs noauto,notail 1 2
/dev/hda3 / reiserfs notail 0 1
/dev/hda2 none swap sw 0 0
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 user,noauto,ro,exec 0 0
/dev/fd0 /mnt/floppy auto noauto,users 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 nodev,nosuid 0 0
10.6 Setting HD Paramaters
Back in Section 4 we developed optimized operating parameters for our hard disk. Now that we're in the chrooted environment of our newly designed Gentoo system, we need to make these configuration changes permanent. To do this, we'll write the HD parameters to the /etc/conf.d/hdparm file:
Code: Select all
# cat /etc/conf.d/hdparm
disc0_args="-a256A1c1d1m16u1"
cdrom0_args="-d1c1u1"
Code: Select all
# rc-update add hdparm boot 10.7 Set-Up User Accounts
We must change the password of the root user in our newly installed system. Then we will add non-root users to the system. Substitute the username examples "bob" and "mary" with your own usernames.
First, change the root password:
Code: Select all
# passwd
New password: (Enter your new password)
Re-enter password: (Re-enter your password) Code: Select all
# useradd -m -G users,wheel bob
# passwd bob
New password: (Enter bob's password)
Re-enter password: (Re-enter bob's password) Code: Select all
# useradd -m -G users mary
# passwd mary
New password: (Enter mary's password)
Re-enter password: (Re-enter mary's password) 10.8 Toggle NUMLOCK ON at Boot
If you'd like the NUMLOCK key to be toggled ON at system boot, execute the following command.
Code: Select all
# rc-update add numlock default10.9 Define Console Screen Blanking Interval
If youre not happy with the standard screen blanking interval for the console (to me the screen always seems to blank too quickly), you can specify the desired interval (from 1 to 60 minutes) using the following command. Substitute n with the value of the desired blanking interval in minutes. A value of zero will disable screen blanking.
Code: Select all
# setterm -blank nCode: Select all
# echo setterm blank n >> /etc/conf.d/local.start10.10 Exiting Chroot and Unmounting Partitions
We will now exit the chrooted environment and unmount all of the mounted partitions.
Code: Select all
exit
cd ~/
umount /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo
swapoff /dev/hda2
11. REBOOT!
And now, the moment you've been waiting for!
Code: Select all
# shutdown -r now Code: Select all
This is boatanchor.mydomain.com (Linux i586 2.6.10-gentoo-r2) HH:MM:SS
boatanchor login:12. TROUBLESHOOTING
If you encounter problems after rebooting, consider the following:
Have fun with your new Gentoo system!
13. If You Need Help
Remember: The Documentation, Tips & Tricks forum is not a support forum:
Please bear in mind that this thread is located in the Documentation, Tips & Tricks Forum, which is not a support forum. For this reason I would like to ask that we limit the context of this thread to posts that discuss problems with the Installation Guide that need to be corrected, or to ideas about how to improve the Stage 1 on 3 installation procedure itself. If you have a problem and you need help, please post your support request in the Official 2005.0 Stage 1 on 3 Support Thread in the Installing Gentoo forum.Documentation, Tips & Tricks
Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Moderator: Global Moderators
At this time this Installation Guide has evolved to a fairly mature state, such that most problems that are likely to be encountered during an install are likely to be related to individual factors not attributable to the Installation Guide. It would seem fair if those who encountered problems with architecture specification, CFLAGS, etc. could post their requests for help in the appropriate support forums. (That way, once your personal support request is resolved, your problem will scroll off into oblivion instead of being preserved here forever, interspersed with this documentation.)
NOTE: Documentation, Tips & Tricks is NOT a support forum. Please do not post installation support requests into this thread. Please post in the support thread that is dedicated to this installation method.
14. Another Essential Tool: Emerge Wrapper for System Updates
This installation guide is focused on how to install Gentoo, and it specifically avoids the issue of how to maintain your Gentoo installation. Hielvc and MindEraser have developed a fabulous emerge wrapper for system updates that his highly recommended. Check out the following thread: An emerge wrapper for correctly building the toolchain.
15. Corrections, Errors, Omissions
Please let me know if there are any errors or omissions in this document by sending me a personal message through the Gentoo Forums by clicking the link below.
16. Downloadable PDF Now Available
A copy of this Installation Guide is now available in PDF format. Click Here.
Please note that this document is presently in a state of transition, and that revisions may be required if errors are found in the document.
17. Buy Me Stuff
If this Guide has helped you and you'd like to show your appreciation, feel free to visit my Stage 1/3 Web Page.
18. Revision History
04/05/05: Cut and Paste from Installing Gentoo.
04/15/05: PDF version of the Guide.
04/18/05: emerge -P gcc. Updated PDF.
06/04/05: package.keywords
07/14/05: corrected typos





