Gentoo Linux

 

(Relatively) Easy to Use Gentoo Install Guide

(token disclaimer: use at your own risk, I am not responsible for anything that goes wrong, you know the rest)

Important Notes
How fast can you do a Gentoo install?
Well, I tested this out. Here are a couple of scenarios:
1 - using stage 1 install and emerging emu10k1 and kde not from the cd, but everything else was done using GRP = about 10 -12 hours.
2 - using everything possible GRP (from cd) and skipping emu10k1 and using a stage 3, including full kde from cd2 = just under 2 hours.

These instructions are based on the live cd's. You can download them for any architecture you have. I use an Athlon XP 2600+ so obviously I used the Live Athlon cd's. Check out the list of mirrors from where you can get them. Make a note of which one(s) are fastest for you - this will come in handy later when choosing your mirrors to use during the installation. Cpu speeds affects the speed of installation so where I make notes on how long certain things take, please keep in mind that I am using an AMD Athlon XP 2600. The notes I made on time are relative to exactly what I installed and the method I specified on the guide. Since I used stage1 and skipped some of the GRP and also emerged emu10k1 and the nvidia package, it took quite a bit longer than option 2 above. The choice is yours.

*GRP works fine for some things, and not for others, I will make notes on this as I go along.

This guide is based on (loosely) the Gentoo Linux Install Guide
Please read it and get to know it before using mine. There are some differences due to me using specific live cd set and also there were some errors in their documentation that I have noticed that I have corrected here.

  • I am beginning at step 6 of that guide. I will number my steps corresponding their guide so that you can reference both and see the differences/parallels.

  • I am writing this as clearly as possible and may make updates from time to time. Although this is the "Easy to Use Linux Guide", the more linux background experience for this install on the part of the user, the better.

  • If you look at all of these steps at once, it can look rather complicated and intimidating perhaps. Just do one step at a time and make sure things are done right. There are a lot of steps that are very easy that you will pass by very quickly, while others you may need to spend some time on to make sure things are correct. If you are unsure of something, email me and I will respond as soon as I get the message. You can also ask questions on any forum of your choice including the Gentoo forum.

  • The use of "k" and "K" is very important in commands in this document. The lower case "k" when issued will attempt to use the internet to retrieve packages, while the upper case or capital "K" will look for the info on the cd. If "K" doesn't work, it is best to try "k". Also when you want something more up to date, you might want to use "k" since it will get the latest build from an ftp.
  • actual commands are in red

  • I have also put in extra spaces in the commands where there are spaces just to show where spaces do exist. This is done for display purposes only since different browsers display pages differently. There are no commands in this document where more than one space is necessary to separate arguments so please do not add more than one.

    so, let's begin


    Step 6. - Partitioning

    Think about what you want first. view the "how to partition page" on the homepage of this guide if you want a review or need to learn more Decide on which method you would like to use to create your partitions. You can use the Gentoo live cd to do so if you like. In this case, since I was resizing my hda with Partition Magic 8 anyway, I decided to use it out of convenience and since I know how to use it fairly well. I usually recommend using native linux partitioning tools to do this, but I figured this was easier given I was already using it and I knew I would review them within Gentoo so I could fix anything if necessary. Create the partitions. As I said, used your preferred method. If you decided to use fdisk on Gentoo cd. See the Gentoo install guide for details. I chose to use what I recommend on my partitoning page. Since I only had 3 primary partitions left (one was used for windass), I decided to go with the following:

    /swap

    /home

    I designated them all as primary and ext3 for my /home and / and of course linux swap for /swap.

    After you have them created to your satisfaction, make sure that after you boot using the Gentoo live cd, you check your partitions by doing the following:

    fdisk

    then type 'p' to list your partitions. If everything looks good, type 'q' to quit. If not, then go back and re-do your partitions till you get what you want.

    7.2: Mounting Created Partitions

    So for your swap partition, use the command 'swap on' to initialize it:

    swapon /dev/hda2

    (this show that my swap partition is on /dev/hda2)

    then mount your other partitions:

    mount /dev/hda3 /mnt/gentoo

    (this mount the gentoo root partition on my /dev/hda3 partition)

    I created an extra one as well: /home - so I need to mount that also. If you created a separate /boot partition, you will need to do the same. So, for my /home partition which is on /dev/hda4, I did this:

    mkdir /mnt/gentoo/home

    (this creates a /home directory on my root partition, alternatively, you would use /boot if you created a separate boot partition or something else. you need to create the directory, otherwise it will say mount point does not exist)

    mount /dev/hda4 /mnt/gentoo/home

    (that mounts my /home partition on /dev/hda4 which was created for /home, it would work the same for /boot as well)

    Ok. Now you have created your partitions, verified them and then mounted them. This means that basically you are using your new install. You are not operating from the cd anymore. You can still access the cd which is under /mnt/cdrom just as you would if you were using a complete linux install.

    Choosing what stage you want to use.

    You have three choices here: stage 1, stage 2 or stage 3.

    To make it simple, the lower the number you pick, the longer it will take but the more customization you will be able to make. Since I was going all out, I decided to use stage 1. I discovered that it didn't take all that much longer. However, if you are using the live cd's you might as well do a stage 3 install since the optimization would be the same. I just wanted to do a stage 1 to have that experience. It is up to you to decide.

    GRP works fine for this and I used it and it made things a lot faster. Basically GRP takes the info from the cd and if you choose to emerge it, it needs to be downloaded first and then unpacked and then installed.

    So, if you type:

    ls /mnt/cdrom/stages

    it will list the choice of stages 1, 2 or 3. It is up to you which one to use. Since I chose 1, I issued this command:

    8.2 Extracting the stage

    Use the following command to extract the stage of your choice.

    cd /mnt/gentoo tar -xvjpf /mnt/cdrom/stages/stage1(press tab to autocomplete)

    takes about 5 minutes (substitute the stage # of which ever one you want to use where I used stage1)

    8.3 Using the Portage Snapshot

    This means that the "emerge sync"step later can be skipped. If you do not copy this portage snapshot, you must do emerge sync later!

    Extracting the snapshot using the GRP method is done using this command:

    tar -xvjf /mnt/cdrom/snapshots/portage(tab to autocomplete).tar.bz2 -C /mnt/gentoo/usr

    takes about 10 minutes

    8.4 Copying GRP Files

    I found the command given in the original instructions did not work here so I had to alter them to this:

    cp -R /mnt/cdrom/distfiles/ /mnt/gentoo/usr/portage/distfiles cp -a /mnt/cdrom/packages/ /mnt/gentoo/usr/portage/packages

    takes about 5 minutes

  • The key is to use the " / " after distfiles and packages on the first part of each line. You can check to make sure they copied by doing this:

    cd /mnt/gentoo/usr/portage/distfiles
    ls

    You should see about 15-20 or so files listed including the nvidia files and others. If you don't see them, check the commands you used again.

    cd /mnt/gentoo/usr/portage/packages
    ls

    You should see one directory here called "All". If you see it, then the files copied properly.

    8.5 - Selecting Mirrors

    I found this to be a very important step. When are using a mirror to connect to the internet, it is important to get a good one that connects at a high speed. Unfortunately with mirrorselect, there is no way to verify speed (that I know of). So, if you have another computer around that is connected to the internet it is a good idea to go to the Gentoo Download Mirror List and look through some and get a good idea of which ones you can connect to at a decent speed. I found that adelie in Canada was very good for me so I picked that in my list. *When you pick your mirrors, they don't go in the order in which you choose them, they go in the order in which they appear on the menu. So for, since I picked other mirrors that were ahead of adelie, it meant that it would connect to those first, thus slowing down my connection. So, once you have selected your mirrors, you can actually change their order to your liking. All of the mirros you select are stored in the /etc/make.conf file. If you open it, and scroll to the bottom, you can re-organize your mirrors. I made sure adelie was the first one on the list for me. You can pick as many as you like, but anything more than 3 is usually considered unnecessary.

    First run the interactive mirrorselect function (if you have a choice, you might as well use it, right!)

    mirrorselect -i -o /mnt/gentoo/etc/make.conf

    pick your mirrors and they will be written to the make.conf file, then...

    Here's how you can access that file:

    nano -w /etc/make.conf

    make your changes, press control O to overwrite the file, then control X to exit and you are done!

    8.6 Entering the chroot (making commands from within your system instead of from the cd)

    This is straight forward, just do exactly as the Gentoo Install guide says in the blue section where the commands are as such:

    mount -t proc proc /mnt/gentoo/proc
    cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
    chroot /mnt/gentoo /bin/bash
    env-update
    source /etc/profile

    9. Getting the Current Portage Tree Using Sync

    If you skipped step 8.3, you must do this step! *If you already did step 8.3, this step is NOT necessary!

    So, enter this command:

    emerge sync

    from what I recall this was about an hour, maybe two - my internet was acting up so it is hard to say exactly

    10. Setting Optimizations

    You are installing Gentoo, you might as well check to make sure you are optimizing as much as you can. As far as I know, some of the most important parts of this should be done, since you are using the live cd that corresponds to your computer. So, for me, I am using the Athlon Live cd. So when I checked my /etc/make.conf file like this:

    nano -w /etc/make.conf

    it already showed that my CFLAGS were for an athlon machine. So I had no need to make a change there. Yours should be the same for your live cd. If you are unsure, do more research (look at the links provided on the gentoo guide) or leave it as default.

    11. Starting from Stage 1 (if you chose stage 2 skip ahead to step 12, if you chose stage 3 skip ahead to step 13).

    Since I decided to use stage 1, I will begin here.

    Basically all you need to do here is bootstrap your system. It is a very important step that takes little time to issue the command, but a fair bit of time to complete. A good mirror selection as we discussed earlier will help speed up this step as a lot of files need to be downloaded from the internet. So, issue this command:

    cd /usr/portage
    scripts/bootstrap.sh

    this will begin the bootstrap process, go do something enjoyable. This takes about 2 hours so I suggest using a different computer and/or listening to some Mudvayne.

    If at anytime, your internet stops working, like mine did (bloody router!), then just press control c to cancel the command and then reissue it. It will only get what is left over, it doesn't start the process all over again (phew!).

    12. Starting from stage 2 or continuing from stage 1

    (if you are using stage 3, then skip to step 13)

    Installing the system. Simply put, but again takes some time.

    Here is the command:

    emerge -p system

    (lists the files to be installed)

    emerge system

    takes around 2 hours (go occupy yourself with something again)

    13 . Starting from stage 3 - steps 11 and 12 were not needed if you used a stage 3. There is nothing to do here if you used stage 3 so just go to the next step. 14. Setting your time zone .

    This is well documented in the Gentoo guide, but just to add, make sure you go right into the directory of your country to find your time zone. For example, mine was /usr/share/zoneinfo/Canada/Eastern (if I recall correctly)

    So my command was (assuming the directory I listed above was correct):

    ln -sf /usr/share/zoneinfo/Canada/Eastern /etc/localtime 15. Modifying fstab for your machine.

    Not much I can really say here that the Gentoo doc doesn't, just make sure you put in the right filesystems and partitions. 16. Install the Kernel and System Logger

    I used manual kernel configuration here, so I don't even know if genkernel works or not. If you want to try it, go ahead, but again, in the effort of optimization, I wanted to do my own. If you choose to do your own like I did, you still need to emerge the kernel sources.

    16.1 Emerging the Kernel Sources

    emerge -K sys-kernel/gentoo-sources

    takes about 15 mins (your version of kernel sources may differ, see the gentoo install guide for more choices)

    16.2, 16.3 skipped 16.4 Emerging and Enabling Hotplug

    It wasn't (and still isn't) clear to me whether this needed to be done even though I was making my own kernel so I installed it anyway to be on the safe side:

    emerge -K hotplug rc-update add hotplug default

    16.5 Configuring the Linux Kernel

    I would recommend this step to anyone for two major reasons:

  • 1 - it will optimize your system and
  • 2 - it teaches you a lot about hardware and how the kernel works.

    I do NOT recommend using genkernel - lots of people have reported having some kind of problem with it, besides compiling your own is more fun!

    cd /usr/src/linux make menuconfig

    this should bring up a nice menu screen. You are responsible for looking through each section to make sure that you have all the devices you need in it. If you make a minor mistake or change your hardware, you can correct/add to it later by redoing your menuconfig and then recopying your kernel again.

    *make sure you read the rest of 16.5 and 16.6 on the gentoo install guide to make sure you get the options in your kernel that you need.

    I emerged emu10k1 and it took FOREVER! It was probably about 3 hours on my Amd 2600+ box! It took nearly 6 hours on a P2-400! I also emerged the nvidia kernel and that took about 30 mins as far as I recall.

    16.7 Compiling and Installing the Kernel

    *You need to issues these two commands EVERY time you make a change to your menuconfig.

    make dep make clean bzImage modules modules_install cp /usr/src/linux/arch/i386/boot/bzImage /boot

    takes about 5 minutes for the kernel to compile and copying the bzImage is instantaneous.

  • see 16.7 on the gentoo install guide for a list of things you may want to add as well.

    16.8 is self explanatory

    16.9 is actually labelled .9 on the gentoo install guide, I chose not to do it anyway, so it doesn't matter what they called it.

    16.10 self-explanatory, I picked vcron

    17.1/ 17.2 Make sure you install these features if you use them. I don't use ppoe and I used ext3 so I was able to skip both. 18. Easy, just follow the guide.

    *Steps 19 - 23 are pretty much there, I don't have anything to change or suggest. If you follow those instructions you should be alright. 24. Creating a Bootdisk

    This is highly recommended even if you have other plans with which to boot. It is a good idea to create a bootdisk just in case things don't go exactly as planned. Follow the instructions using these commands from the install guide:

    *Keep in mind that the bootdisks will only work with kernels smaller than 1.4mb.

    For Grub (my preference):

    cd /usr/share/grub/i386-pc/cat stage1 stage2 /dev/fd0

    For Lilo:

    dd if=/boot/your_kernel of=/dev/fd0

    *substitute the name of your kernel where is says your_kernel (ie- /boot/bzImage if you created your own) 25. Using GRP

    25.1 In my experience, using GRP to emerge xfree worked. So you have two options. 1- you can emerge xfree which will be optimized and updated for your system since it is downloaded from the net which is the bonus, the downside is that is takes a lot longer. You could also choose to use the cd to copy the xfree files. This is much faster, but obviously has some drawbacks. So, you can do either of the following:

    emerge xfree

    (uses the internet, takes longer and is more optimized)

    OR

    USE="bindlist" emerge -K xfree

    takes about 5-10 minutes, maybe even less when using grp to emerge xfree

    *After that is done, you cannot add any more packages from the cd without rebooting. So, if you are rebooting here, make sure you know how to configure your bootloader and such. Process to the "Installation Complete!" (step 26) section of the gentoo install guide and follow those instructions.

    25.2. Loading Binary Packages from cd 2

    For this to work, you need to insert the cd2 into your drive and mount it. To do this, I had to create a /mnt/cdrom directory first. Then I mounted the cd and then copied the necessary files over. Here are the commands in order...

    mkdir /mnt/cdrom mount /dev/cdroms/cdrom0 /mnt/cdrom cp -a /mnt/cdrom/packages/All/* /usr/portage/packages/All/

    takes about 5-10 minutes you can then test to see if grp will take the packages from that directory and not from the interent:

    USE="bindlist" emerge -K kde --pretend

    It should list a bunch of files that it will install WITHOUT showing itself connecting to the internet in any way. If that is true, you are good to go. Useful packages like mozilla, w32codecs, xpdf, zip, kdebase and others are at your disposal already optimized for your system, consistent with the rest of the files you used from cd1.

    *Instead of using the entire kde package, I chose to use the following packages:

    kdebase kdeadmin kdeutils kdegames kdemultimedia (mostly for the mixer - kmix)

    Here is the complete list to choose from with kde (taken from the Gentoo Desktop Config Guide):

    kdebase Base KDE packages and necessities kdeaddons Miscellaneous older/obsoleted KDE tools kdeadmin Administrative KDE tools kdeedu Educational KDE tools kdegames KDE games kdegraphics KDE graphical art tools kdemultimedia Multimedia players/framework for KDE kdenetwork Network-related tools for KDE kdepim KDE PIM tools, calendars, desktop notes etc. kdetoys Amusement tools for the KDE desktop kdeutils Graphical system utilities

    If you followed these steps, you should have a successful live cd install for text mode. For graphical configuration see below.

    Getting X to Work

    *I am skipping the steps for nvidia and extra configuration, so if you need extra features, see the Gentoo Desktop Configuration guide link below.

    This was surprisingly easy to do if it is done correctly. You must first make sure you have completed the steps on the install guide as I have summarized above. The next thing to do is to run xf86config. You will need some information to be at hand for this.

    You will need:

    Your exact monitor horizontal sync and vertical refresh rates. Your exact video card ram amount and make and model. Your mouse type.

    Once you have that info ready you can type (after logging in as root):

    /usr/X11R6/bin/xf86config

    This will begin the X configuration program.

    For the keyboard I picked #3 and did not enable any extra features. If you are using a standard PS/2 mouse, you should be ok just pressing enter to make /dev/mouse the default location for your mouse. For your video card, look at the list provided and choose your card from the list (hopefuly it is there). To make things easy do NOT enter any names for your video card or monitor, just press enter when prompted. You will also need to specify the resolutions for your monitor at 3 different bit rates (8,16 and 24). I use a 17" so I chose 1024x768, 800x600 and 640x480 for each of the three. You will need to do this for each one separately. When you are asked whether to enable a virtual screen, it may be safer to say no unless you know the specifics.

    Once this is done, you need to run these commands:

    rc-update add xfs default

    and now the moment of truth (if you do the following step and either can't see anything or get twm (ugly window manager), you can press ctrl-alt-bkspc to get back to text mode) so go ahead and type:

    startx

    (make a note also whether your scroll works on your mouse as well, it can easily fixed later)

    If that works as planned, you are ready to continue to the next step. You can copy your XF86Config file now that you know it is working:

    cp /usr/X11/XF86Config /usr/X11/XF86Config.working

    Now you can make sure you have the right configuration for your mouse to scroll:

    nano -w /etc/X11/XF86Config

    you will want to look at this section:

    Section "InputDevice"

    # Identifier and driver

    Identifier "Mouse1" Driver "mouse" Option "Protocol" "IMPS/2" Option "Device" "/dev/input/mice" Option "ZAxisMapping" "4 5"

    It doesn't have to be the exact same as this, but you will need to make sure the blue lines are there otherwise your scroll is likely not to work.

    Now, on to your window manager. I use kde, so I will give it as an example, if you use gnome, then refer to the link below for the Desktop Configuration Guide on step 4.

    To get kde up and running you need to have either copied it from CD2 using the GRP method I outlined earlier or emerged it from a server. Assuming this is done, you can now edit some files and get it going quickly:

    nano -w /etc/make.conf

    and make sure that the USE line says this:

    USE="qt kde -gnome -gtk"

    then if you have not already emerged kde, do so now and then when it is finished (or if you already did it), enter this command:

    env-update source /etc/profile

    Once that is done, you can type:

    kdm

    and your kdm login manager should appear. You can log in as your user and go from there.

    For more info on getting X (gui, or graphical mode working) see the Gentoo Desktop Configuration Guide.

    Some Useful Things to Know


    To autoload a module (driver) at boot, you need to edit this file:

    nano -w /etc/modules.autoload/kernel.2.4- will open it

    and add in your module. My ethernet card is the via-rhine and uses the module of the same name (as given in menuconfig) so I need to add it. Just make sure there is NO # in front of it.

    If you are using dhcp to connect to the net thru a router, you need to uncomment (take out the #) the line that says:

    #iface_eth0="dhcp"

    so it says:

    iface_eth0="dhcp"

    In the /etc/conf.d/net file which can be opened using nano:

    nano -w /etc/conf.d/net

    To restart your network type this:

    /etc/init.d/net.e

    When you decide to use "emerge" to get your packages, try adding the --pretend argument to see just how many packages are required. For example, with kde, try doing this:

    emerge kde --pretend

    that way it will list all of the packages needed to fulfill kde. This is a nice link into my next tip...

    Try emerging more generic of individual packages. For example, instead of getting kde, which includes a ton of stuff I never use (naotun, xcdroast etc.), check out kdebase instead. This will still you give you the same desktop environment minus all the extra things you may not want anyway. Once this is done (takes far less time than just 'kde'), you can always add things later.

    Being Picky About Emerge

    Here's a tip for emerging parts of certain packages like kde or one that I was eager to investigate - mozilla. If you just type "emerge mozilla", you end up getting everything with it including the irc chat package, mozilla mail and composer and many more. If you are like me and only want certain ones you can do this:

    emerge -pv mozilla

    this will list the packages that will be installed and then you can use the USE argument to prevent certain ones from emerging with it. Here is the output I got from the previous command:

    net-www/mozilla-1.4-r3 +java +crypt -ipv6 -gtk2 +ssl -ldap -gnome -debug -mozsvg -mozcalendar -mozaccess -mozp3p -mozxmlterm -moznoirc -moznomail -moznocompose -moznoxft

    Now it is a matter of interpreting the arguments. Currently it shows what it will install with emerging mozilla. In my case, I didn't need mozilla mail, irc or the debug features. This also helps cut down on compiling time and provides a little bit better operation due to not as many packages being including - makes for a 'lighter' version of mozilla as I like to call it. I ended up using the following emerge command:

    emerge moznomail moznoirc mozilla

    and I ended up getting exactly what I wanted. Basically you just need to change the + or - sign to the opposite as what is listed if you want something different.

    NOTE - This will only work at the time you are emerging. If you enter "emerge mozilla" at a later time, it will emerge everything listed above. There is more information available on this on the portage user guide.

    Back To Guides