Gentoo Linux 1.1a PPP Installation Instructions

1.Initial Steps

First and foremost, you need to download, and burn to a blank CD-R, the Gentoo Linux 1.1a Stage3 ISO:

The ISO image is about 130Mb, and contains the same packages as the 16Mb ISO, plus a pre-built i686 base system. The Stage3 ISO requires a Pentium Pro or greater processor (K6 won't work). If you have an i686+ system, you should be fine.

You will also need some packages copied onto floppies, or burnt onto a CD.

The first is a System Logging Daemon. The three choices we have are:

Note: Only download these three files from the links above, as they are specifically for the Gentoo Linux Distrobution, and will "emerge" properly. Also. If you choose Metalog as your System Kernel Logger, you must download PCRE. It is located at: pcre-3.9.tar.bz2

The second is a Cron. The three choices we have are:

Note: Again, only download these three files from the links above, as they are specifically for the Gentoo Linux Distrobution, and will "emerge" properly.

The third is a set of packages for our Internet Connection. You will need the following packages copied onto a floppy:

Note: Again, only download these two files from the links above, as they are specifically for the Gentoo Linux Distrobution, and will "emerge" properly.

2.Booting

Once you've burnt the Stage3 ISO onto a CD, go ahead and boot it. You'll be greeted with a bunch of text and a boot: prompt at the bottom of the screen. At this prompt, hit enter, and Linux will begin to load from the CD.

Next, you'll be greeted with a small list of commands available on the boot CD, including nano (a pico editor clone) and instructions for setting up the network. Then, you'll be prompted to select your preferred keymap, followed by PCI autodection. The PCI autodetection process will automatically load the appropriate kernel modules for many popular PCI SCSI and ethernet devices. After this, you can hit enter to enter the minimal boot CD Linux environment. You should have a root ("#") prompt on the current console, and can also open new consoles by typing alt-f2, alt-f3, etc and then hitting enter.

3.Configure /etc/resolv.conf

Now, it's time to create the /etc/resolv.conf file so that name resolution (finding Web/FTP sites by name, rather than just by IP address) will work.

Note: At the moment the only editor installed by default is nano, a small and very easy-to-use visual editor. Use nano with the -w option to turn off automatic line-wrapping.

Here's a template to follow for creating your /etc/resolv.conf file:

/etc/resolv.conf template

   domain mydomain.com
   nameserver 10.0.0.1
   nameserver 10.0.0.2
   

Replace 10.0.0.1 and 10.0.0.2 with the IP addresses of your primary and secondary DNS servers respectively.

4.Set Up Partitions

Here's a quick overview of the standard Gentoo Linux partition layout. We're going to create at least three partitions: a swap partition, a root partition (to hold the bulk of Gentoo Linux), and a special boot partition. The boot partition is designed to hold GRUB boot loader information as well as your Linux kernel(s). The boot partition gives us a safe place to store everything related to booting Linux. During normal day-to-day Gentoo Linux use, your boot partition should remain unmounted. This prevents your kernel from being made unavailable to GRUB (due to filesystem corruption) in the event of a system crash, preventing the chicken-and-egg problem where GRUB can't read your kernel (since your filesystem isn't consistent) but you can't bring your filesystem back to a consistent state (since you can't boot!)

Now, on to filesystem types. Right now, you have four filesystem options: XFS, ext2, ext3 (journaling) and ReiserFS. ext2 is the tried and true Linux filesystem but doesn't have metadata journaling. ext3 is the new version of ext2 with both metadata journaling and ordered data writes, effectively providing data journaling as well. ReiserFS is a B*-tree based filesystem that promises very good small file performance, and greatly outperforms both ext2 and ext3 when dealing with small files (files less than 4k), often by a factor of 10x-15x. However, we do not recommend ReiserFS at this time, due to repeated occurances of file-system corruption with the 2.4.x series kernels. ReiserFS has metadata journaling, but no data journaling. XFS is a high-performance enterprise-class filesystem with metadata journaling that is fully supported under Gentoo Linux.

If you're looking for the most standard filesystem, use ext2. If you're looking for the most rugged journalled filesystem, use ext3. If you're looking for a high-performance filesystem with journaling support, use XFS; both ext3 and XFS are mature and refined. All filesystems except ReiserFS are production-ready. Here are our basic recommended filesystem sizes and types:

Partition Size Type Example Device
boot partition, containing kernel(s) and boot information 100 Megabytes ext2/3 highly recommended (easiest); if ReiserFS then mount with -o notail /dev/hda1
swap partition (no longer a 128 Megabyte limit) >=2*Amount of RAM in this system is recommended but no longer (as of kernel 2.4.10) required Linux swap /dev/hda2
root partition, containing main filesystem (/usr, /home, etc) >=1.5 Gigabytes XFS, ext3 recommended; ext2 ok /dev/hda3

Note: At this point, create your partitions using fdisk. Note that your partitions should be of type 0x82 if swap and 0x83 for regular filesystems (whether XFS, ReiserFS or ext2).

Once you've created your partitions using fdisk, it's time to initialize the filesystems that will be used to house our data. Initialize swap as follows:

Swap

# mkswap /dev/hda2

You can use the mke2fs command to create ext2 filesystems:

EXT2

# mke2fs /dev/hda1

To create an XFS filesystem, use the mkfs.xfs command:

XFS

# mkfs.xfs /dev/hda3

Note: You may want to add a couple of additional flags to the mkfs.xfs command: -d agcount=3 -l size=32m. The -d agcount=3 command will lower the number of allocation groups. XFS will insist on using at least 1 allocation group per 4 GB of your partition, so, for example, if you hava a 20 GB partition you will need a minimum agcount of 5. The -l size=32m command increases the journal size to 32 Mb, increasing performance.

Warning: If you are installing an XFS partition over a previous ReiserFS partition, later attempts to mount may fail without an explicit mount -t xfs. The solution is to zero out the partition before creating the XFS filesystem: dd if=/dev/zero of=/dev/hdx bs=1k.

If you'd like to use ext3, you can create ext3 filesystems using mke2fs -j:

EXT3

# mke2fs -j /dev/hda3

To create ReiserFS filesystems, use the mkreiserfs command:

ReiserFS

# mkreiserfs /dev/hda3

Warning: Again, we do not recommend ReiserFS at this time. While ReiserFS has worked fine for many, filesystem corruption has been too common a problem with ReiserFS and the 2.4.x series kernels.

Note: You can find out more about using ext3 under Linux 2.4 at http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html.

5.Mount partitions

Now, we'll activate our new swap, since we may need the additional virtual memory that provides later:

Enable Swap

# swapon /dev/hda2

Next, we'll create the /mnt/gentoo and /mnt/gentoo/boot mountpoints, and we'll mount our filesystems to these mountpoints.

Make And Mount Base Directories

# mkdir /mnt/gentoo
# mount /dev/hda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mount /dev/hda1 /mnt/gentoo/boot
   

If you are setting up Gentoo Linux with a separate /usr or /var, these would get mounted to /mnt/gentoo/usr and /mnt/gentoo/var, respectively.

Important: If your boot partition (the one holding the kernel) is ReiserFS, be sure to mount it with the -o notail option so GRUB gets properly installed. Make sure that notail ends up in your new /etc/fstab boot partition entry, too. We'll get to that in a bit.

6.Mounting the CD-ROM

Even though we've booted from the CD-ROM, the CD-ROM itself is not mounted under our minimal Linux boot CD environment. We'll need to mount it so that we can access the compressed build image tarball contained on the CD-ROM. To mount the CD-ROM, one typically types:

Mount The CD-Rom

# mount /dev/cdroms/cdrom0 /mnt/cdrom -o ro -t iso9660

With the CD-ROM mounted, you should be able to see the starge???.tbz2 file(s) by typing ls /mnt/cdrom.

7.Unpack the Stage3 Tarball

Now it's time to extract the compressed stage tarball of your choice to /mnt/gentoo. Then, we'll chroot over to the new Gentoo Linux build installation.

Important: Be sure to use the p option with tar. Forgetting to do this will cause certain files to contain incorrect permissions.

Unpack The Stage3 Tarball

# cd /mnt/gentoo
# tar -xvjpf /mnt/cdrom/stage?-*.tbz2
# mount -o bind /proc /mnt/gentoo/proc
# cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
   

Chroot Into Your New System

# chroot /mnt/gentoo /bin/bash
# env-update
Regenerating /etc/ld.so.cache...
# source /etc/profile
# 
   

After you execute these commands, you'll be "inside" your new Gentoo Linux environment.

8.Setting Your Timezone

At this point, you should have a Stage3 system that's ready for final configuration. We'll start this process by setting the timezone. By setting the timezone before building the kernel we ensure that users get reasonable uname -a output.

Look for your timezone (or GMT if you using Greenwich Mean Time) in /usr/share/zoneinfo. Then, make a symbolic link by typing:

Set Timezone

# ln -sf /usr/share/zoneinfo/path/to/timezonefile /etc/localtime
   

9.Compiling the Kernel

Since you're installing a Gentoo Linux 1.1+ stage3 tarball, we've made things convenient for you and included recent Linux sources in /usr/src/linux.

Now it's time to compile your own custom kernel:

Compile Your kernel

# cd /usr/src/linux
# make menuconfig
# make dep && make clean bzImage modules modules_install
# mv /boot/bzImage /boot/bzImage.orig [if bzImage already exists]
# cp /usr/src/linux/arch/i386/boot/bzImage /boot
   

Warning: For your kernel to function properly, there are several options that you will need to ensure are in the kernel proper -- that is, they should be enabled and not compiled as modules. You will need to enable the "Code maturity level options --> Prompt for development and/or incomplete code/drivers" option to see several of these selections. Under the "File systems" section, be sure to enable the "Device File System" (note that you don't need to enable the "/dev/pts file system support" option). You'll also need to enable the "Virtual Memory Filesystem". Be sure to enable "ReiserFS" if you have any ReiserFS partitions; the same goes for "Ext3". If you're using XFS, enable the "SGI XFS filesystem support" option. It's always a good idea to leave ext2 enabled whether you are using it or not. Also, most people using IDE hard drives will want to enable the "USE DMA by default" option; otherwise, your IDE drives may perform very poorly. Of course, remember to enable "IDE disk" support as well -- otherwise your kernel won't be able to see your IDE disks.

Note: For those who prefer it, it is now possible to install Gentoo Linux with a 2.2 kernel. Such stability will come at a price: you will lose many of the nifty features that are new to the 2.4 series kernels (such as XFS and tmpfs filesystems, iptables, and more), although the 2.2 kernel sources can be patched with Reiserfs and devfs support. Gentoo linux bootscripts require either tmpfs or ramdisk support in the kernel, so 2.2 kernel users need to make sure that ramdisk support is compiled in (ie, not a module). It is vital that a gentoo=notmpfs flag be added to the kernel line in /boot/grub/menu.lst for the 2.2 kernel so that a ramdisk is mounted for the bootscripts instead of tmpfs. If you choose not to use devfs, then gentoo=notmpfs,nodevfs should be used instead.

Your new custom kernel (and modules) are now installed.

10.Installing Aditional Packages

Remeber the 4 files that you downloaded above? Now it's time to put them to use.

First off, make two directories:

Make Portage Directories

# mkdir /usr/portage/distfiles
# mkdir /usr/portage/packages/All
   

Then mount your floppy drive:

Mount Floppy

# mount /dev/fd0 /mnt/floppy -t vfat
   

Copy all files from the floppy drive to /usr/portage/distfiles

Copy Files

# cp /mnt/floppy/*.* /usr/portage/distfiles/
   

Finally, merge the packages you chose onto your system:

Merge Packages

# emerge -k YourSystemLogger
# emerge -k YourCron
# emerge -k ppp
# emerge -k wvdial
   

You now have a System Kernel Logging Daemon, Cron, PPP Daemon, and WVDial installed.

11.Setting Up Your Internet

Now it's time to get your Internet Connection working. We need to setup your computer to dial-out:

Configure WVdial

# wvdialconf /etc/wvdial.conf
# nano -w /etc/wvdial.conf
   

Edit this, and input your ISP's phone number, your Username, and your Password. Be sure to remove the semicolons AND the extra space in front of the three lines you just edited. Lastly, add a new line at the bottom: New PPPD

Now lets see if you can connect, and if so, test your connection with a ping command:

Run WVdial

# wvdial
Switch to a new terminal with Alt and the F2 key
# ping yourISPdnsnumber -c 3
   

If your connection is Ok, you should see some messages indicating that 3 packets were sent and recieved.

12.Configuring /etc/fstab

Your Gentoo Linux system is almost ready for use. All we need to do now is configure a few important system files and install the GRUB boot loader. The first file we need to configure is /etc/fstab. Remember that you should use the notail option for your boot partition if you chose to create a ReiserFS filesystem on it. Remember to specify ext2, ext3 or reiserfs filesystem types as appropriate.

Use something like the /etc/fstab listed below, but of course be sure to replace "BOOT", "ROOT" and "SWAP" with the actual block devices you are using (such as hda1, etc.)

Edit /etc/fstab

   
# /etc/fstab: static file system information.
#
# noatime turns of 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/BOOT           /boot       ext2	 noauto,noatime	 1 2
/dev/ROOT           /           ext3	 noatime         0 1
/dev/SWAP           none        swap	 sw              0 0
/dev/cdroms/cdrom0  /mnt/cdrom  iso9660	 noauto,ro       0 0
proc                /proc       proc	 defaults        0 0
   

13.Set the root password

Before you forget, set the root password by typing:

Set root password

# passwd
   

14.Configuring /etc/hostname and /etc/hosts

Edit the file /etc/hostname so that it contains your fully-qualified domain name on a single line, i.e. mymachine.mydomain.com.

The file /etc/hosts contains a list of ip addresses and their associated hostnames. It's used by the system to resolve the IP addresses of any hostnames that may not be in your nameservers. Here's a template for this file:

Edit /etc/hosts

127.0.0.1      localhost
# the next line contains your IP for your local LAN, and your associated machine name
192.168.1.1    mymachine.mydomain.com	mymachine
   

15.Configure basic settings (including the international keymap setting)

Modify /etc/rc.conf

# nano -w /etc/rc.conf
   

Follow the directions in the file to configure the basic settings. All users will want to make sure that CLOCK is set to his/her liking. International keyboard users will want to set the KEYMAP variable (browse /usr/share/keymaps to see the various possibilities).

16.Configure GRUB

The most critical part of understanding GRUB is getting comfortable with how GRUB refers to hard drives and partitions. Your Linux partition /dev/hda1 is called (hd0,0) under GRUB. Notice the parenthesis around the hd0,0 - they are required. Hard drives count from zero rather than "a", and partitions start at zero rather than one. So, /dev/hdb3 gets translated to (hd1,2), and /dev/hdd7 gets translated to (hd3,6). After you've gotten the feel for that, convert your boot and root partition names to the GRUB format and write them down. Now, it's time to install GRUB.

The easiest way to install grub is to simply type grub at your chrooted shell prompt:

Run "grub"

# grub
   

You'll be presented with the grub> grub command-line prompt. Now, you need to type in the right commands to install the GRUB boot record onto your hard drive. In my example configuration, I want to install the GRUB boot record on my hard drive's MBR (master boot record), so that the first thing I see when I turn on the computer is the GRUB prompt. In my case, the commands I want to type are:

Configure "grub"

grub> root (hd0,0)
grub> setup (hd0)
grub> quit
   

Here's how the two commands work. The first root ( ) command tells GRUB the location of your boot partition (in our example, /dev/hda1 or (hd0,0) in GRUB terminology. Then, the second setup ( ) command tells GRUB where to install the boot record - it will be configure to look for its special files at the root ( ) location that you specified. In my case, I want the boot record on the MBR of the hard drive, so I simply specify /dev/hda (also known as (hd0)). If I were using another boot loader and wanted to set up GRUB as a secondary boot-loader, I could install GRUB to the boot record of a particular partition. In that case, I'd specify a particular partition rather than the entire disk. Once the GRUB boot record has been successfully installed, you can type quit to quit GRUB. Gentoo Linux is installed, but we need to create the /boot/grub/menu.lst file so that we get a nice GRUB boot menu when the system reboots. Here's how to do it.

Now, create the menu.lst file (nano -w /boot/grub/menu.lst), and add the following to it:

Modify menu.lst

default 0
timeout 30
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title=My example Gentoo Linux
root (hd0,0) 
kernel /boot/bzImage root=/dev/hda3 

# Below needed only for people who dual-boot
title=Windows NT Workstation
root (hd0,5) 
chainloader +1
   

Note: The menu.lst file should end in "lst" as in "list", not "1st" as in "first". Also, (hd0,0) should be written without any spaces inside the parentheses.

After saving this file, Gentoo Linux installation is complete. Selecting the first option will tell GRUB to boot Gentoo Linux without a fuss. The second part of the menu.lst file is optional, and shows you how to use GRUB to boot a bootable Windows partition.

Note: Above, (hd0,0) should point to your "boot" partition (/dev/hda1 in our example config) and /dev/hda3 should point to your root filesystem. (hd0,5) contains the NT boot loader.

Also, if you need to pass any options to the kernel, simply add them to the end of the kernel command. We're already passing one option (root=/dev/hda3), but you can pass others as well. In particular, you can turn off devfs by default (not recommended unless you know what you're doing) by adding the gentoo=nodevfs option to the kernel command.

Note: Unlike in earlier versions of Gentoo Linux, you no longer have to add devfs=mount to the end of the kernel line to enable devfs. In rc6 devfs is enabled by default.

17.Installation complete!

Now, Gentoo Linux is installed. The only remaining step is to exit the chrooted shell, safely unmount your partitions and reboot the system:

Unmount Partitions

# exit 
// This exits the chrooted shell; you can also type ^D
# cd / 
# umount /mnt/gentoo/boot
# umount /mnt/gentoo/proc
# umount /mnt/gentoo
# reboot
   

Note: After rebooting, it is a good idea to run the update-modules command to create the /etc/modules.conf file. Instead of modifying this file directly, you should generally make changes to the files in /etc/modules.d.

If you have any questions or would like to get involved with Gentoo Linux development, consider joining our gentoo-user and gentoo-dev mailing lists (there's a "click to subscribe" link on our main page). Enjoy and welcome to Gentoo Linux!



This Documentation was developed by: Todd Tucker ; a.k.a on IRC: Phobes