If John Wayne had been a Linux user, he would have used Gentoo. Gentoo users are pioneers, people who like to live close to the metal, and don't mind hurting themselves on sharp objects...
-- Joe Barr, NewsForge.com, Oct. 2004.
I've long used Linux in a dual-boot environment on my primary laptops using Red Hat 5-9, RH WS 3-3.5, Suse 7.2-9.1, and Fedora Core 1-2. Each distribution has its own pros/cons but in the end Linux distributions are:
1) Distributions include 200% more garbage than even a power user needs,
2) Distributions put application "stuff" in their own, odd places (although Gentoo is guilty too...),
3) are not entirely Laptop friendly,
4) substantially "dumbed-down" Linux,
5) and use binaries that do not take advantage of the true power of Linux. My Gentoo system is likely 10-20% faster than my last FC2 install.
Having given my background and reasons for choosing Gentoo, I will warn you that Gentoo is not for the weak or timid. Performing the steps below requires substantial understanding of hard drives and partitioning, Linux kernel compilation, and low level device configuration. If you have a system you're not afraid to screw up and fdisk, push ahead and take Gentoo for a test run.
Gentoo is a distribution centered on Portage - it's software distibution system. With Gentoo, you start with nothing (a blank partition), and gradually build, optimize, and add in what you need/want in your system. In the end, no two Gentoos are the same and you get a highly customized OS for your system. The Gentoo install is similar to a consulting "parking lot" approach. Everything you could want is out in the parking lot. You decide what comes back in the door and ends up in your system.
If you need to contact me, please feel free to email me at email@michaeldolan.com or call me at (440) 552-5322. I'm also often on the official Gentoo IRC server (irc.freenode.net #gentoo) with many other people who can help in any situation. Another great resource is this Dell 8200 Gentoo site although it's slightly dated (http://linux.siprell.com/index.htm).
This install guide is for setting up Gentoo 2004.2 (The numbering scheme is based on a bi-annual release number). This guide follows exactly what I had to go through to get a Dell 8200 Inspiron Laptop up and working. My laptop's specs are as follows:
Processor: Intel Pentium 4M @ 1.7Ghz
Monitor: Dell 15" UltraSharp UXGA (1600x1200)
Memory: 512MB PC2100 DDR
Video: nVidia 64MB GeForce 440 Go
Hard Drive: 40GB UATA @ 5400 RPM
24x10x24 CDRW/DVDROM Combo Drive
Dell Truemobile 1150 Mini-PCI Internal 802.11b Wireless Card (Broadcom)
10/100 3Com Ethernet (built-in)
56k v9.0 Gold Card global modem
Crystal CS 4205 AC97 Sound
Windows XP Professional SP2 Installed
Rest is standard (i.e. 2USB, Firewire, 2 PCMCIA, VGA/TV Out, Parallel, etc)
The Gentoo LiveCD can be obtained from a mirror in the "releases/x86/2004.3/livecd" directory. If you have questions, consult this section of the Gentoo Handbook. Once you have burned the ISO, boot off the CD.
I use my laptop with a dual boot environment. I have to keep Windows for a variety of reasons (i.e. Flash, Visual Studio). In order to setup a dual boot environment, Windows XP must be installed prior to Gentoo. What I end up doing is setting up 2 OS partitions (XP, Linux) a swap partition, and then a partition I'll call Data (FAT32) which can be accessed from XP/Linux. The Data partition is great for keeping documents, email, and pictures that you may want to use interchangeably with Linux or Windows. The final partition table would look something like this:
| Device | Boot | Start | End | Id | System |
| /dev/hda1 | * | 1 | 765 | 7 | HPFS/NTFS |
| /dev/hda2 | 766 | 2422 | f | W95 Ext'd (LBA) | |
| /dev/hda3 | 2423 | 2548 | 83 | Linux (Swap) | |
| /dev/hda4 | 2549 | 4864 | 83 | Linux (ReiserFS) | |
| /dev/hda5 | 766 | 2422 | b | W95 FAT32 |
To create this partition structure I deviated from the Gentoo documentation and use cfdisk instead of fdisk. I find it much easier and more precise. I deleted the 2 Fedora Core 2 partitions that I had (one for FC2, one for swap) and recreated 2 new partitions for Gentoo.
# cfdisk
Next I formatted my target Gentoo partition as reiserFS, set the swap partition and made the swap partition active.
# mkreiserfs /dev/hda4
# mkswap /dev/hda3
# swapon /dev/hda3
Now that there is a fresh partition and an active swap partition, you need to mount the target partition (i.e. /dev/hda4).
# mount /dev/hda4 /mnt/gentoo
The Gentoo Handbook now suggests checking your date and time. You can change the date easily in this format MMDDhhmmYYYY. So, for instance:
# date
Mon Jan 1 00:05:00 EST 1999
# date 112301272004
Tue Nov 23 01:27:34 EST 2004
Now untar your stage tarball from the cdrom into your target Gentoo partition (mounted already above). Here is the point where you also choose what stage you will use. Gentoo comes in 3 stages. A stage 1 gives you the bare minimum and it's up to you to build everything from the most basic point. Stage 2 / 3 represent levels that are "pre-built" for you. For more info on choosing a stage, consult the Gentoo Handbook. The stages don't change - the ones on the CD are the same as the ones on the Internet. I chose the hard route and went with stage 1. I think it will give you the best experience and helps you understand better the beauty of Gentoo.
# cd /mnt/gentoo
# tar -xvjpf /mnt/cdrom/stages/stage1-<subarch>-2004.3.tar.bz2
While those who wimp out for a stage3 tarball will skip to setting up Portage, brave stage 1 people will want to customize their Gentoo make.conf file. You can customize a lot of the gcc compile options from this file, set your primary Gentoo mirrrors, and customize how Gentoo's emerge system synchs. There are so many other options to configure but I will walk though a few I mentioned.
For whatever reason Gentoo developers prefer nano over vi so I'll go with that. Now the Gentoo Handbook seems to suggest you should just create your own make.conf from scratch. I found that a bit tedious and just modified the example make.conf to suit my needs. You can download my make.conf here.
# cd /mnt/gentoo/etc
# cp make.conf.example make.conf
# nano -w make.conf
In the make.conf file, I changed a few settings. First, I changed my gcc settings: CHOST to "i686" and "-march=pentium4m". I didn't use the mcpu=pentium4 and chose to only support myself. I don't have time for development anyway. If you are using a Centrino Pentium-M, then you should set it to -march=pentium-m (new feature with gcc-3.4.x. Another item of note is to change the USE Flags. You can look at my make.conf for suggestions. If you don't know what a USE flag is, it's an option gcc uses at compile time. If the code you're compiling has an option to support acpi for instance and the gcc USE flag is set for acpi, then the code will get compiled with acpi support. Very simple.
I also modified the Gentoo mirrors. I found the University of Florida's mirror to be extremely fast from my house. Take a look at the make.conf for suggestions. You can also have Gentoo find the best mirror for you by doing the following:
# mirrorselect -a -s4 -o | grep 'GENTOO_MIRRORS=' >> /mnt/gentoo/etc/make.conf
Now it's time to set your DNS servers for your new environment, mount the proc filesystem and chroot. If you using DHCP, the only purpose is to have a file there. Bash is the default Gentoo shell and I find it to be just fine.
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
# mount -t proc none /mnt/gentoo/proc
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
Now you will want to perform your first emerge sync. Emerge stores a local copy of all emerge builds out there, their versions, deps, etc. The emerge sync updates your local copy with the latest and greatest from the mirrors. You shouldn't need to do this too often but every couple weeks it's probably a good idea.
# emerge --sync
Now it's time to bootstrap your system. Bootstrapping is fairly simple.
# cd /usr/portage
# scripts/bootstrap.sh
# emerge system
Now set your new system's timezone
ln -sf /usr/share/zoneinfo/EST5EDT /etc/localtime
If you need to contact me, please feel free to email me at email@michaeldolan.com or call me at (440) 552-5322. I'm also often on the official Gentoo IRC server (irc.freenode.net #gentoo) with many other people who can help in any situation.
Now it's time to start on configuring your customized kernel. Gentoo provides vanilla (pre-configured) kernels for you based on your architecture, but that's no fun and I'd recommend getting your hands dirty compiling your own kernel.
The first step is to get your kernel. You can easily accomplish this using emerge (you will learn to love emerge). I'm always looking for the latest and greatest so I chose the 2.6 devel source tree instead of the 2.4.x tree.
# emerge gentoo-dev-sources
Now let's enter the kernel source directory. We'll setup a link along the way.
# ls -l /usr/src/linux
# rm /usr/src/linux
# cd /usr/src
# ln -s linux-2.6 linux
# cd linux
Now it's time to configure the kernel using menuconfig. Settings are stored in a .config file in the /usr/src/linux location. Know your hardware! You can download my .config file here. If you look at my .config you should see what's good to have for a Dell 8200. It's probably very similar to most laptops. If you have an nVidia card, I will suggest you include support for /proc/pci even though it's "obsolete".
# make menuconfig
Once you're finished configuring the kernel (it should take you a while if you're new to this) you can make the kernel and install the modules while you're at it.
# make && make modules_install
Now it's time to copy your new kernel over into the boot directory. I copy my System.map and .config files as well just in case.
# cp arch/i386/boot/bzImage /boot/kernel-2.6.9-gentoo-r1
# cp System.map /boot/System.map-2.6.9-gentoo-r1
# cp .config /boot/config-2.6.9-gentoo-r1
I'm not sure how they do it, but somehow Gentoo has an ebuild for nVidia's binary drivers. My Dell 8200 has a nVidia GeForce 440 Go 64MB in it so I want to now install the nVidia drivers. For more info, see the Gentoo nVidia Handbook. I'll warn you that if you use the nvidia-kernel-6629-r1, you'll get a failed to initialize error on the nvidia driver. If you check dmesg, you'll see "nvidia: Unknown symbol _smp_processor_id". What you need to do is go into /usr/portage/media-video/nvidia-kernel, open the nvidia-...-6629-r1.ebuild file and comment out this line:
# Fix calling of smp_processor_id() when preempt is enabled
epatch ${FILESDIR}/${PV}/nv-disable-preempt-on-smp_processor_id-2.patch
Final:
# Fix calling of smp_processor_id() when preempt is enabled
# epatch ${FILESDIR}/${PV}/nv-disable-preempt-on-smp_processor_id-2.patch
Now emerge nvidia-kernel and you should be ok.
# emerge nvidia-kernel
I next configured what modules I wanted to autoload on boot. I added these:
nvidia
ip_gre # for vpn
cpuid
msr
audio
intel_mch_agp
# nano /etc/modules.autoload.d/kernel-2.6
# modules-update
Now you'll want to configure the system. The Gentoo Handbook does a great job describing this so I'll be brief.
This is a tricky part if you've never worked with fstab. I would highly recommend taking a look at my fstab file for help. The idea is to tell your system where to find partitions and how it should mount them. Just open the fstab file and add your parameters accordingly.
# nano /etc/fstab
Update your hostname and domain info
# echo gentoo-box > /etc/hostname
# echo Workgroup > /etc/nisdomainname
rc-update add domainname default
Now you need to add your ethernet cards to the net file. I have both wireless and cat eth cards that both will be set to dhcp.
# nano -w /etc/conf.d/net
iface_eth0="dhcp"
iface_eth1="dhcp"
To get networking to start on boot:
# rc-update add net.eth0 default
# cd /etc/init.d
# ln -s net.eth0 net.eth1
# rc-update add net.eth1 default
# nano -w etc/hosts
You can check out my hosts file if you're not sure what to put in.
To enable wireless, you have to download the wireless card drivers. The Dell 1150 Truemobile cards are really just Broadcom cards. Broadcom doesn't believe in Linux on desktops/laptops so they don't support Linux. Some crafty people have written great drivers though and have included them in the pcmcia-cs project. My USE flags in /etc/make.conf require X support but since we haven't gotten that far, I'm taking it out of the requirements. Once it installs, add pcmcia to the default runlevel.
# USE="-X" emerge pcmcia-cs
# rc-update add pcmcia default
Change the root password now.
# passwd
some_password
Set the keymap so you can type. I didn't have to change mine.
# nano -w /etc/rc.conf
Log files will save you in a jam. I chose to install metalog.
# emerge metalog
# rc-update add metalog default
I chose fcron as my scheduler because it will queue actions when my laptop is off.
# emerge fcron
rc-update add fcron default
# crontab /etc/crontab
I use (s)locate all the time. Highly recommended install.
# emerge slocate
If you chose resiserfs, you'll want to install reiserfsprogs.
# emerge reiserfsprogs
# emerge dhcpcd
I use grub for bootloading. Installing it is easy, configuring may not be. If you're just installing Gentoo and not dual booting, the Gentoo Handbook has easy instructions. NOTE: grub will not read a reiserfs boot volume. Grub can get tricky if you don't know what you're doing. Pay special attention to driver numbering because it's not the same as hda1,hda2,etc. The grub configuration is stored in boot/grub/grub.conf. Check out my grub.conf if you want an example. Cross your fingers and restart your system once you have finished your grub editing.
# emerge grub
# nano -w /boot/grub/grub.conf
edit as appropriate for your system
Now restart the system.
# exit
# cd
# umount /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo
# reboot
I actually made a typo on my first attempt. If you have an error, grub gives you the option to use it's console. Just enter grub and enter your changes like below.
# grub
-->root (hd0,0)
-->setup (hd0)
-->quit
Your Gentoo system will never be "finished", but you're getting close. Once you've restarted and verified grub is working, login as root and setup some base packages. Here you'll witness firsthand the power of emerge.
# useradd mdolan -m -G users,wheel,audio,tty -s /bin/bash
# passwd mdolan
enter new password
# emerge --sync
# etc-update
# emerge lynx
Now I installed a few utilities that you'll find useful. Udev is the new, preferrerd method for handling devices. I did not setup my system with dual dev support.
# emerge udev
# emerge sysfsutils
# emerge hotplug
# emerge xorg-x11
# env-update
# source /etc/profile
Now edit your /etc/X11/xorg.conf and set the right modules to load along with the video, mouse and monitor settings. Look at my xorg.conf if you want the proper settings for a Dell 8200 laptop with a 15" UXGA screen. My mouse section, however, is setup for both a USB mouse and the Alps (Synaptics) Touchpad drivers. My xorg.conf will not work until you install the synaptics driver as described in the next chapter.
# nano -w /etc/X11/xorg.conf
edit as appropriate
# env-update
# source /etc/profile
Now test your X11 configuration using startx.
# startx
If there was ever a need for a distcc cluster, it's now. KDE will take a long time. Once it installs, you will need to associate kde with the startx command. I also setup kdm as well.
# emerge kde
# echo "exec startkde" > ~/.xinitrc
# startx
Now setup KDM
# ls /etc/X11/Sessions (get KDE version)
# nano -w /etc/rc.conf
(Edit the following two variables)
XSESSION="kde-3.x.x" (the KDE version you saw above)
DISPLAYMANAGER="kdm"
# rc-update add xdm default
# emerge corefonts
# emerge bind-utils nmap
# emerge mozilla-firefox
Speed up Firefox (2-3x faster with broadband)
1.Type "about:config" into the address bar and hit return. Scroll down and look for the following entries:
network.http.pipelining
network.http.proxy.pipelining
network.http.pipelining.maxrequests
Normally the browser will make one request to a web page at a time. When you enable pipelining it will make several at once, which really speeds up page loading.
2. Alter the entries as follows:
Set "network.http.pipelining" to "true"
Set "network.http.proxy.pipelining" to "true"
Set "network.http.pipelining.maxrequests" to some number like 30. This means it will make 30 requests at once.
3. Lastly right-click anywhere and select New-> Integer. Name it "nglayout.initialpaint.delay" and set its value to "0". This value is the amount of time the browser waits before it acts on information it recieves.
# emerge superkaramba
Once you install the the synaptics drivers, you have to edit your xorg.conf file to use them. See my xorg.conf if you need help.
# emerge synaptics
now cd into synaptics source directory
# gunzip alps.patch
cp alps.patch /usr/src/linux
# cd /usr/src/linux
# patch -p1 -b < alps.patch
# make && make modules_install
# cp arch/i386/boot/bzImage /boot/kernel-2.6.9-gentoo-r1
# nano /etc/X11/xorg.conf (add appropriate synaptics section)
I use prefer to use ntp to manage my system's time.
# emerge ntp
# rc-update add ntpd default
# emerge add ntp-client default
OpenOffice is still not working with the latest gcc so I had to install the binary package. I didn't really feel like switching to an older version and back-compiling.
# emerge openoffice-bin
As with any OS, you'll find a few tricks and opportunities for performance gains.
DHCP by default is set to timeout after like 3 minutes. This can be a real pain if you're booting up looking to connect via wireless and have to wait for eth0 for 3 mins at boot. To change the timeout in Gentoo, edit /etc/conf.d/net. The following shows setting it to 10s but I actually dropped it down to 3 on my system.
# nano /etc/conf.d/net
...
//uncomment the following line
dhcpcd_eth0="-t 10"
This is what I did to get power management working on my Dell 8200.
# emerge acpid acpitool
# rc-update add acpid boot
Evolution is my email app of choice until Thunderbird matures. Emails in Linux are typically stored in mbox format. Evolution uses this format for importing the best. The contacts are easiest to import from a .ldif format. The easiesmayt way to get your emails converted to mbox is to boot into Windows and install/use Mozilla Mail. Mozilla Mail can then import your Outlook emails. Once you've imported them into Mozilla, the files are actually in mbox format. Your Mozilla Mail store directory will be the directory the Evolution-compatible mbox files are in. Now boot into Linux and open Evolution. In Evolution, go to File-> Import, choose single file, then mbox format and browse to your Mozilla Mail store directory. Choose the non-.mst file for your Inbox / Sent Mail / Etc... mail stores. The files will be imported.
Converting contacts can be done directly from Outlook in 2 ways. 1) Just Export your contacts in vcard format (Outlook XP/2003 only I believe) or 2) Export to csv file. If you do #1, just boot into Linux and import the exported .vcf file into Evolution directly. If you have to export to .csv, open a terminal and go to your exported contacts file. Download this perl script to the same folder (Right click on the Link and Click "Save Link As..." and save as csv2vcard.pl) and then type the following in a terminal.
# perl csv2vcard.pl exportedfile.csv
Now just open Evolution and import your .vcf file.
Emerge makes setting up LAMP so simple it pales to the compilations I used to do with Apache 1.2. First, make sure you compile PHP with session support. You can use USE flags to do this. Then I had to edit a few apache config files. One weird thing with Gentoo is how they splitup Apache's config files. It threw me off when I noticed a number of settings missing from apache2.conf. Gentoo supposedly should work with PHP by editing /etc/conf.d/apache2 and just adding APACHE2_OPTS="-D SSL -D PHP5" then do a "# /etc/init.d/apache2 restart" but that wouldn't work for me. What did work is as follows:
# USE="session" emerge mysql apache php mod_php
# nano /etc/apache2/conf/apache2.conf
// Add php module
LoadModule php5_module modules/libphp5.so
// Save and exit
# nano /etc/apache2/conf/commonapache2.conf
// Insert MIME AddType for PHP
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php .phps
// Restart Apache
# /usr/bin/apache2ctl restart
// Get Apache to start at boot
# rc-update add apache2 default
You can download my config files as examples:
/etc/apache2/conf/apache2.conf
/etc/apache2/conf/commonapache2.conf
/etc/conf.d/apache2
/etc/init.d/apache2
The articles I found with Google all over on this one. I wanted to connect my Canon Digital Rebel and SD-110 using the USB transfer cable. I decided the easiest way would be to use gphoto2 (connect utility) and gtkam (GUI). If you've followed everything from above, you'll see that my kernel was compiled with hotplug/udev and USB/SCSI support built in. THE ONLY steps I had to perform are below:
# emerge gphoto2 gtkam
# /usr/lib/libgphoto2/print-usb-usermap > /etc/hotplug/usb/usbcam.usermap
# gphoto2 detect
You never know when you'll need to access a file on your Linux partition. In Windows, use a program called VisualRfTools. I honestly cannot remember where I got the program from, but you can download it from my site here.
You will need two packages to print PDF files on the fly.
# emerge pdflib cups-pdf
Gentoo likes to keep healthy up-to-date portage and config files. Updates to Portage come out generally with new releases. With Gentoo you never "upgrade" - you just update. There's no difference between installing at 2004.2 and updating as new portage/packages become available versus downloading 2004.3, wiping everything out, and re-installing. Compared to other distros, you'll find these Extremely convenient. Plus it save on the hassle of reconfiguring settings.
Typically you will see a notice when you emerge or emerge --sync that says something to the effect of "An update of Portage is availabe". That requres an "emerge portage". You may also see a notice for a new profile in which case you just need to change the symlink to the Portage tree for a new profile. This Gentoo document can help if you have more questions.Portage also manages a number of files in /etc. Sometimes when you emerge packages you'll see a notice such as "13 config files in /etc need updating". Then it references a help location which is of little help. Portage has a config file management system and you can update all your /etc config files by simply typing "etc-update". BEWARE: many /etc files that you have custom modified may be overwritten! Be careful! You can preview the modifications by typing in the config file number from the list it will prevent. Make backups of important /etc files in you're unsure.
#emerge --sync
# emerge portage
# etc-update
Portage takes up a TON of space very quickly on a drive. After setting up my system with all my user apps I noticed I had used up 16GB on my 18GB reiserfs partition! The culprit is likely /var/tmp/portage where all the downloaded sources and compiliation files are located. I deleted everything in this directory and my disk usage dropped to 3.8GB! The only downside is if you update an application, portage may have to re-download the source of its dependent apps - not a big loss in my mind. If you delete the directory, portage will re-create it the next time you emerge. If you "trash" the directory, make sure you empty your root user's trash container.
There's a known issue with the jre and mozilla not finding the plugin. In order to get this to work you need to install the jre and firefox, then create a symlink in your firefox plugins director. To make things harder, Gentoo calls its JRE package blackdown-jre.
# emerge blackdown-jre firefox
# ln -s /opt/blackdown-jre-1.4.2/plugin/i386/mozilla/libjavaplugin_oji.so /usr/lib/MozillaFirefox/plugins/libjavaplugin_oji.so
Udev is a clear winner. I would suggest setting up your system for pure udev and not bother with the hybrid route.
Get Mono so you can develop .Net apps on Linux - yes it's possible. VB.Net is beta and I've had a few issues myself, but C# is working extremely well. Installing mono and getting started is easy. Installing mod_mono let's you run ASP.Net apps under Apache! Monodevelop is an IDE that gives you basic functionality - nothing near VS.Net but functional. Yes, you can use VS.Net on Mono (Mono just meaning Mono arch -> runs on any OS) apps on Windows, but you need to add the mono Dlls (cringe) into VS.Net. See the mono website for details at http://www.go-mono.org
# emerge mono monodocs mod_mono monodevelop
Slooowwwness can creep up if you have disk I/O problems. I've seen crazy things cause this including nVidia drivers. The result should be something over 21 Mb/s. If you're in the 8-16 range, you likely have an I/O problem. Check your disk I/O by typing the following as root:
# hdparm -t
When you need to change screen resolutions, you could edit your xorg.conf and go that route. Or you can use a great, fast utility called xrandr. Just type the following as root and you'll see a number of options to change your resolution to.
# /usr/X11R6/bin/xrandr
Here are a couple images you can use. The first is a screenshot of my "Gentoo themed" desktop and the second is the transparent Gentoo logo for the desktop wallpaper. The third is my current desktop featuring the awesome alpha blending capabilities of KDE.
"