Slashdot Mirror


A Walk Through the Gentoo Linux Install Process

Anonymous American (Sherman Boyd) writes: "I was looking for a flexible, powerful distribution that makes it easy to build a 'custom' Linux box that meets my exacting specifications. I think I found it. Gentoo Linux has just released version 1.0 of their innovative meta-distribution and to celebrate I decided to throw it on my laptop and write this article based on my experiences." And good news for anyone interested in trying Gentoo: yesterday, Daniel Robbins announced the release of version 1.1a. Read on for AA's detailed look at putting Gentoo on his machine -- Gentoo has a different style than today's typical distributions, and it bears some explanation.

Gentoo solved many problems for me. Some distros install everything, whether you really need it or not. Not Gentoo; other than the base packages required for Linux to run, the only software installed on the system is the software you put there. Gentoo resolves dependencies automatically, eliminating RPM prerequisite hell. As an added bonus I got something I wasn't even expecting. Speed. Blinding, blazing, incredible speed.

The main advantage to the Gentoo distribution is Portage, a python-based ports system similar to BSD ports. For those of you unfamiliar with BSD ports, Portage is a package management tool that downloads and installs source instead of precompiled packages. When I need a program I download, install and compile it with one command:

emerge nmap

The above will download the nmap source code, compile and install it. Of course this method is slow, but it has its rewards. You can also opt to use prebuilt binaries if you are not extremely patient. It took me five hours to get the base Gentoo installed on my PIII with 128 megs of ram. It wasn't a big deal as I had other things to do, but I would like to see the installation process optimized so that it doesn't require any babysitting.

Gentoo is running two of my mission-critical servers right now, I consider it to be stable and mature. A warning, though: this is not a distribution for dummies. This is bare metal Linux, powerful and dangerous. If you do something without thinking you may fall into a bucket of pain.

Let's begin my story.

I download the iso from http://www.ibiblio.org/gentoo/releases/build /. There is a choice of install images here. My favorite way of installing Gentoo is to compile everything, a time consuming process. This method requires a slim 16-meg iso. You may want to grab an iso with pre-built binaries to speed things up, however. This fat iso weighs in at 103 meg. I download the big one with the prebuilt binaries even though I won't use them -- just in case.

I boot my laptop with my shiny new Gentoo CD. The Gentoo install uses isolinux by Peter Anvin. I like the fact that they don't obscure it, giving credit where it is due. It boots quickly and there is a PCI autodetection process, it shouldn't find much on my laptop. Interesting, it loads a SCSI module. Perhaps it has detected my IDE CD burner. Usually this will detect any PCI NIC cards that are installed, but it does not detect my PCMCIA device (of course). After the PCI detection I get a command prompt. I use nano (a small text editor) to open up install.txt, the excellent install doc. Usually these docs are sufficient but the latest ones can be found here:

http://www.gentoo.org/doc/build.html

Keeping the install doc open in this virtual terminal, I hit alt-f2 to open a new one. I begin by loading the pcmcia drivers and installing networking. This is all done at the command line ( insmod, ifconfig, route, dhcpcd, etc.). I use nano to add my DNS servers to /etc/resolv.conf. A word of caution; get in the habit of always using the -w switch with nano. If you do not use the -w switch nano's word wrap feature will jack up your config files. I ping a reliable site, networking is up!

Next I partition my system using fdisk. I choose a simple layout with a swap partition, a root partition and a small boot partition. The boot partition remains unmounted during use, a nice precaution. For filesystems you have a choice of ext2, ext3, ReiserFS and XFS. In my personal experience I've noticed that Reiser performance really rocks when combined with SCSI drives, but as this is an IDE system I think I'll go with XFS. Besides, the XFS tools seem to be a lot more mature than the offerings from Reiser. I format and mount the partitions from the command line creating a /mnt/gentoo directory. I then untar the root filesystem; here I have the choice of the small tarball that requires you to compile everything or a larger tarball that contains pre-built binaries. If you untar the big guy you are almost finished with your install at this point. Using chroot and some scripts you chroot the /mnt/gentoo directory. From this point on you are operating under your new gentoo system.

The first thing I do under my chrooted system is issue this command:

emerge rsync

This downloads the latest version of the portage tree. The portage tree is found under /usr/portage and contains the ebuild scripts used to compile/install programs. Currently there are over 1000 up to date emerge sripts. Next I edit /etc/make.conf, here I can choose compiler settings. I optimize everything for i686. Now it's time to build the GNU compiler and libraries. I run the bootstrap script and leave for lunch. On my PIII 500 the boostrap process takes 2 hours and 2 minutes.

The second emerge command I issue is:

emerge system

Now emerge downloads, compiles and installs my base system packages. I sit back, relax and take the time to fax my legislators a rant about the DMCA. One hour and 30 minutes later it is finished.

Now it is time to download and install the kernel. First I make a link updating my timezone, and then I issue another emerge command:

emerge linux-sources

This grabs the latest kernel, 2.4.19, and drops the source in /usr/src/linux. Ten minutes have elapsed. Now comes the fun, compiling your kernel. That's right, everyone who installs Gentoo compiles their own kernel as a matter of process. I like this. There are some distributions out there that actually say you should never compile your own kernel. Shame on them. I use make menuconfig and the standard commands to compile my kernel. Since Gentoo uses devfs I select /dev file system support and I am also careful to compile in support for XFS. I don't have the kernel mount devfs automatically at boot as the Gentoo startup scripts take care of this for me. Virtual Memory file system support is also enabled.

At this point in time I get to choose a logger. My choices are sysklogd, syslog-ng or metalog. I choose metalog, because it's got the coolest name. I download, compile and install it using a single command:

emerge metalog

XFS has some nice utilities, I better install those. I have some other essential programs to install, and I'm feeling a bit lazy so I chain them all in one big command.

emerge xfsprogs;emerge bitchx;emerge vim;emerge links

At this point I'm feeling pretty 7-Up. I edit my /etc/fstab file, my /etc/hostname file and /etc/hosts. The passwd command is run to set the root passwd. I add my NIC module to the file /etc/modules.autoload and edit /etc/conf.d/net. conf.d/net allows me to configure my IP address and settings, default gateway and alias. I take a look at /etc/init.d/net.eth0, even though I don't need to edit it. I can then add it to the startup script using this command:

rc-update add net.eth0 default

This adds the script to the default runlevel to be executed at startup. Startup scripts are another place Gentoo really shines. The startup scripts have a system of dependencies. For example net.eth0 can depend on pcmcia. The pcmcia drivers get loaded before net.eth0 - this is good.

Next I install grub. If you haven't used grub before, it's nice. You can boot to a kernel directly from the grub shell, without having to edit a config file. lilo is still available, for those of you who prefer it. Gentoo likes to let you make the decisions.

I exit my chrooted shell and unmount all directories. Reboot! Gentoo comes up and the install process is complete.

The Gentoo install process has taught me a lot about Linux, and I like the fact that the command line is embraced, instead of hidden behind gui or scripts. I also like the speed (which is debatable since all I can supply is anecdotal evidence). I wasn't too happy about waiting five hours for everything to compile, but I think it was worth it. I can tell you it compiles and greps noticeably faster than other distros I have run on the exact same machines. I really enjoy using portage, and the packages seem to stay up to date -- if not bleeding edge. This is not a conservative distribution like Debian, however I like the aggressive and intelligent direction gentoo is taking.

If you are considering trying out Gentoo I highly suggest #gentoo on irc.openprojects.net. Also subscribe to the mailing lists found at www.gentoo.org. The Gentoo community has helped me out of several jams in the past, I think they will treat you good too.

While writing this, I received help from a lot of people. However I would like to personally thank the people I ripped off word for word. Thanks notafurry of www.kuro5hin.org for your pointed help with the stilted second paragraph and thank you Ween from #gentoo on openprojects.net for your clean description of portage.

19 of 351 comments (clear)

  1. For you existing Gentoo'ers by Xafloc · · Score: 5, Informative

    I have created a site that will allow you to post your Compile Times for the different packages, relative to your hardware.

    It's in alpha stage right now, but I'll add features as we go a long. Any suggestions would be appreciated. You must signup first in order to post your compile times.

    Hopefully at some point, one willbe able to get a sense of how long it would take to install, say kde3.

    --
    -= Xafloc =-
    alinuxbox.com
    N
  2. Re:k5 by purplebear · · Score: 2, Informative

    Yeah. I was just thinking to myself, didn't K5 have this exact "feature" last week sometime?

    It seems /. is getting a little behind the times??

  3. Re:How about some user testing on distro websites? by Havokmon · · Score: 2, Informative
    Ah, yes, usability testing..What a crock that is.

    There are two types of "usable":

    One is "usable" because it's close to what the user is used to.
    The other is "usable" because it appeals to someon who has never used that interface before.

    Funny, the only people I hear talking about usability are those who complain they can't do something, because the 'new' interface doesn't emulate what they're already used to..

    I never liked how Microsoft's site worked, and people looked at me strange.
    Friends never liked how Novell's site worked, and I looked at them strange..

    Would you rather have a distro maintainer spending hours and hours on their website, or the distro?

    I guess the solution is just: "Get used to it."

    --
    "I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
  4. Minor nit by Mike+Connell · · Score: 5, Informative

    This is not a conservative distribution like Debian,

    There are 3 debians, at varying degrees of 'conservativyosity'

    Stable: Potato is dead stable and conservative. To put it another way: it's old, and you probably wouldn't want it on your desktop.

    Testing: Woody is very stable (IME more stable than RH FWIW), and quite up to date (g++ 3 etc)

    Unstable: Not sure of the name because I wouldn't use it. I don't know how stable it is, but I am thinking that it's quite up to date with the latest releases.

    Anyway, the point I'm trying to make in a rather longwinded mannar, is that debian will be as conservative as you want it to be. There is always a tradeoff between "up to date" and "no nasty surprises" debian is very honest about letting you choose.

    1. Re:Minor nit by AaronMB · · Score: 2, Informative

      > Unstable: Not sure of the name because I wouldn't use it. I don't know how stable it is, but I am thinking that it's quite up to date with the latest releases.

      Its Sid, and as to being unstable, i've found that it isn't. I've used unstable on my laptop for ~6 months now, and not once have I had any sort of issues with it. As always, YMMV, but it has been great for me.

  5. My Gentoo Install by Trolocsis · · Score: 4, Informative

    I have gentoo up and running on my laptop, and my desktop. I consider myself as an intermediate to semi-advanced linux buff, but I had never really knew the intricities of installing a distribution from complete source and what happens at the core of the installation (thanks to all those GUI installers). It was a great learning experience - at times I had some trouble, but #gentoo actually has the gentoo developers in there helping people with problems and trying to resolve them. Kudos to the Gentoo team.

    Upgrading to a new version of gentoo is easy, and straight forward with the Portage system. There is no need to reinstall, like some flavors of linux, just a simple emerge --update system and an emerge --update world.

    The distro is fast - in fact - much faster than my mandrake box I had on my desktop (before I migrated to gentoo). I have no benchmarks, but the bloat is gone, and the speed is there.

  6. Definitely dangerous by kefoo · · Score: 1, Informative

    This is bare metal Linux, powerful and dangerous. If you do something without thinking you may fall into a bucket of pain.

    I learned this lesson the hard way. I installed a new kernel manually, rather than letting Portage handle it. I must have missed something, because now a growing list of stuff won't compile and all my efforts to fix it have only exacerbated the problem, so I guess it's time to reinstall. Other than that little foul up (not the distro's fault), it's been smooth sailing. Just remember to update the config files when Portage tells you to.

  7. Re:2.4.19? by SagSaw · · Score: 2, Informative

    One of the 13 available kernels is a 2.4.19pre? patched with XFS and other goodies. If you don't want bleeding edge, various other kernels are availible, including 2.4.4 and a couple of 2.2's for those who want more stable proved kernels.

    --
    Come test your mettle in the world of Alter Aeon!
  8. Sounds like an automated LFS by ncc74656 · · Score: 3, Informative
    I've been using Linux From Scratch for a while now...when I replaced SuSE with LFS on my home server, I noticed a considerable increase in speed. Since Gentoo compiles everything from source (like LFS), it sounds like this'd be an easier way to get the benefits of LFS. Instead of having to babysit the machine while each package is built, you tell it what to build and let it go to town.

    I have a R*dh*t box at work (that was set up by a total incompetent, which makes things even worse) that's screaming for an upgrade...while I can get LFS going in not much time now, I think I'll end up giving Gentoo a shot when the time comes.

    --
    20 January 2017: the End of an Error.
  9. Tip for i686 users by Kaypro · · Score: 4, Informative

    If you have an i686 I recommend getting the i686 iso and simply jumping to the stage 3 install. Basically you'll save yourself a bunch o time since the base install is already compiled for your CPU. No sense in doing over again.

    You'll still have to install X and apps and the kernel, but at least the base will be taken care of.

    Switched to Gentoo 6 months ago from FreeBSD/Linux setup and haven't looked back since.
    Even put it on a new production server. Very nice.

    Have fun with what IMHO is the BEST distrib around!

  10. Re:LVM? by Anonymous Coward · · Score: 2, Informative

    quote from: http://www.gentoo.org/doc/build.html

    "15.Final steps: install additional packages

    You may need to install some additional packages in the Portage tree if you are using any optional features like XFS or LVM. If you're using XFS, you should emerge the xfsprogs ebuild:

    Code listing 27

    # emerge sys-apps/xfsprogs

    If you're using LVM, you should emerge the lvm-user ebuild:

    Code listing 28

    # emerge --usepkg sys-apps/lvm-user

    "

  11. Re:Yeah, right. by SagSaw · · Score: 3, Informative

    "(and I'm sure gentoo's program doesnt support resuming)"

    It can use wget, prozilla, or lukemftp out of the box, but you can use any downloader you want; just set FETCHCOMMAND appropriatly.

    "And what's really funny is that just yesterday, Slashdot posts article: "Time Warner to Charge Extra for Over-Quota Bandwidth". Yeah, these go together real well.... Reeeeal well."

    I doubt even the most compulsive upgrader will never approach the quota due to gentoo. The source packages that I've downloaded over the past three months take up 1.5G. At 500M per month, I doubt the quotas will be a problem. Modem use, however, is a problem.

    --
    Come test your mettle in the world of Alter Aeon!
  12. Re:What I would like to see by Ween · · Score: 2, Informative

    Gentoo is exactly what you are looking for. Not only can you recompile your whole system, but you can put the optimizations you want in a global make file.

    To recompile your entire system do:
    emerge glibc; emerge --update world --emptytree

    This will recompile glibc, then recompile every other piece of software on your entire system. Pretty slick eh.

    --


    Tis better to be silent and thought a fool, than to open your mouth and remove all doubt --Abraham Lincoln
  13. tip for installs by Raleel · · Score: 5, Informative

    Portage figures out dependendies quite nicely, so take advantage of it. Pick a couple high level apps that you know you will use, and work on those first. For instance, I frequently do

    emerge evolution galeon lynx nessus xmms

    and it gets x, gnome, and all the bells and whistles that I need to run on my system, based on the USE variable set in my make.conf. Do the above and you can leave it go while you go to work or sleep and be assured that things went nicely.

    I'll also mention that if you do

    emerge evolution; emerge galeon;

    It will have the advantage of compiling in series, and thus maybe catching some things that you don't have to redo later, but the disadvantage of failing multiple times on something that does not have a perfect build script, and you can't track down what caused it. I do it with

    emerge evolution galeon

    because you can see what died easier (the last thing on the screen.

    --
    -- Who is the bigger fool? The fool or the fool who follows him? --
  14. Re:2.4.19? by ShawnX · · Score: 2, Informative

    Careful gentoo's 2.4.19 is my patch: linux-2.4.19-pre2-ac4-xfs-shawn10a available at: http://xfs.sh0n.net contains: XFS Patches w/ Rmap + AC.

    The problem is, I broke quota hard and I should have -shawn11 out for gentoo tonight or so. AC Quota / XFS quota really take a beating ;) You can find me on IRC on openprojects.net in #Kernelnewbies, #gentoo and other channels I'm ShawnXFS ;)

    --
    Everyone wants a Tux in their life.
  15. I've had it for about two months now by global_diffusion · · Score: 2, Informative

    ... and I highly recommend it. It's slick, it's fast and it's easy to keep your system up to date. The install process seems complicated because it's all command line, but it's really quite easy and gives you a good feeling for your system.

  16. Re:if you type $emerge mozilla by Gainax · · Score: 2, Informative

    This isn't exactly what happens.
    Warning: ebuild spoiler follows

    1. ebuild to be processed is read/parsed
    2. Required filenames (i.e. basename file) parsed from download URLs
    3. mirror locations are checked (GENTOO_MIRROR iirc) in your /etc/make.conf & /etc/make.globals
    4. ebuild will try do download required source from mirrors in GENTOO_MIRROR
    5. If the above locations do not provide the file, then the original URL is attempted (we download source from upstream

    In conclusion, I'm sorry, but there will be no Gentoo Effect.

    Kain

  17. Re:That "RPM dependency hell." by autechre · · Score: 5, Informative

    Much of the dependency problems do stem from the way software is packaged. For many RPM-based distributions, they have 1 or 2 CDs worth of material where the packages are all designed to work well together, and then everything else is "contrib", and is not controlled as tightly (or at all). This is very bad.

    The reason that tools like apt-get work very well with Debian is that all 8,000 packages are actually forced to follow guidelines before they are accepted. They also _are_ tested before they get into "testing" from "unstable", and tested even more thoroughly before "stable" is released. There is a policy that actually exists, and it is adhered to strictly.

    In regards to your "multiple versions" suggestion, Debian does this quite frequently. If a package has a version with a Gnome GUI, but can be used without it, Debian will have a base package for that software, and another package you can install for the Gnome GUI. A similar thing is done with PHP and the various modules (PostgreSQL support, etc.).

    To comment on another poster's reply: apt never automatically installs anything for you. If the package you requested to install has unmet dependencies, it will prompt you with the names of the packages which need to be installed/removed, and not continue unless you confirm.

    --
    WMBC freeform/independent online radio.
  18. Re:That "RPM dependency hell." by Paul+Komarek · · Score: 3, Informative

    I wanted to put in a good word for Mandrake's rpm management tools. They have urpmi and friends which operate from the the command line, and a very nice gui wrapper for these (whose name I always forget 'cause you usually start it from an icon). Not only do these help manage dependencies, but they also track rpm archives for you.

    Thus, when you type "urpmi foo.rpm", you get something like "foo.rpm requires bar.rpm. Is this okay?" followed by "please insert cd 3" or else it automatically grabs it from the net (if you've configured it to do so). Really surprising, and very nice, was when uninstalling "foo.rpm", it asked if it was okay to remove "bar.rpm". I'm not sure if it always does that latter bit, because I saw it happen during an installation.

    -Paul Komarek