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.

15 of 351 comments (clear)

  1. My Experience by XBL · · Score: 3, Interesting

    I think Gentoo is great. It's FreeBSD, clean and fast. It would definitely take some work to get it up to a point where all of your desktop toys work, but I don't care about that stuff much.

    My only problem with the installation was that it didn't like the partitions I made with Partition Magic. It installed fine, but afterword when I tried to setup Grub, the /boot partition somehow disappeared! fsck chucked out some serious errors, and I had to start over again... and that was not fun.

    It was rather annoying, the babysitting. You just have to sit there an type in a lame command or two now and then. Why can't the installer do that for me?

    In summary, use Gentoo because it's not-bloated, fast, easier than Debian (in my opinion), and Portage is great.

    1. Re:My Experience by athakur999 · · Score: 3, Interesting

      I've been using Gentoo for a few months now, and like others I've found it a great distro. It definately forces you to learn alot about your system, but does so in a nice way.

      My biggest nit pick is that I wish Portage had a better way of tracking changes between package versions. Sometimes the only difference between two versions is a few lines of a Gentoo-supplied script or config file. When you upgrade the package it forces you you to recompile the whole thing, even though the changes didn't do anything that would have affected compilation.

      Anyway, speaking of Portage, doesn't anyone know what the equivalent of the old-school "emerge --world update" is (to make it look up EVERY installed package)? During a world update the new Portage will only update packages that appear in your "favorites" file. If it does, only then will it update dependencies not in your "favorites" file.

      --
      "People that quote themselves in their signatures bother me" - athakur999
  2. rock by President+Chimp+Toe · · Score: 5, Interesting

    Rock Linux sounds pretty similar. Anyone know how they compare?

  3. Real Linux by Anonymous Coward · · Score: 1, Interesting

    I would suggest that anyone wanting real control over a linux box use the LFS (linux from scratch) distrobution. You can find it here LSF.ORG .

    This is truly the way to make a customized system. The Problem with the BSD ports system is that It tells you what is the best version to run. If you do it this way you will have a complete understanding of your system.

    In Short: If you really want a geeked out version of linux. Do it from scratch with LFS.

  4. It's true, you know! by MilesBehind · · Score: 4, Interesting

    Gentoo is a nice distro with tons of potential. The debate whether it is neccessary to compile glibc and everything in the system from scratch aside, the freedom that it allows is incredible. It reminds me a lot of slackware in its openness. There's no shoving stuff down your throat, just one swank port system.

    Not to start a distro war, but I always thought linux distros fall into 2 categories; on one side the colorful, happy-newbie distros with many good features and nice interfaces, but ultimately dreadful underbelly that you get exposed to when things go wrong. On the other hand are distros like slack and debian; will install on anything initially, run fine, and if something goes wrong, they're as transparent as can be and tweakable as hell.

    Problem with slack is that the community is slowly dwindling. Security updates get less frequent, packages are updated and maintained at a slower pace, ultimately making most of the stuff installed non-distro specific and thereby more complex and harder to update.

    Gentoo is as open and simple as slack, just as tweakable and in active development. If the community doesn't get discouraged with some early troubles with the portage system and documentation proliferates, there is a very bright future for the distro.

    1. Re:It's true, you know! by |_uke · · Score: 3, Interesting

      KDE is one place gentoo really shines...

      they have it setup to allow installation of both kde 2 and kde 3

      when kde 3 was released... I typed:

      emerge kde

      and it went and installed kde 3.0 and all the main kde 3.0 packages. The few kde 2.0 apps that I still have continue to work... although they still work off the kde 2.0 libs. But once those are updated by their authors to use kde 3, its pretty simple to install the new package and uninstall the old. (and depending on how you have portage configured... it can do the uninstalling of the old package automatically when you upgrade.)

      --
      Luke
  5. compiler by brer_rabbit · · Score: 5, Interesting

    it'd be nice if one of these compile-it-yourself distributions worked with Intel's Linux C++ compiler (icc). Though Intel's compiler still doesn't support compiling the kernel and some other stuff, lots of software compiles just fine with icc. You can consistently obtain 10-20% improvements over gcc 2.9x in cpu intensive applications using icc (I haven't compared versus gcc 3.0 yet).

    The icc license should be ok for home users to compile programs for their own use with it. I think you only have to buy the license if you plan on distributing binaries.

  6. Installation Process Still Too Complicated by TheCrunch · · Score: 2, Interesting

    I'm a windows user. I use windows at work and run it on my computers at home. I've always wanted to install Linux on one of my machines (There is only so much drooling over nice KDE screenshots that I can take.)

    I'm fortunate enough to have "Linux friend" who helps me.. but more often than not they type and I watch. I've made attempts at installing Slackware, Gentoo and Debian. The most recent attempt (successful) involved my friend spending quite a bit of time battling away at the console to download the latest Debian bits. So I now have a working KDE system that I can play around with to learn the ropes. And this is what I wanted.

    But the biggest problem I faced when trying to learn Linux is the installation process. It's discouraged me no end. In my defense, I'm not stupid, I'm actually a software engineer, although yes.. purely windows (and no, not VB).

    My point (getting there) is that you can say what you will about windows but it beats Linux hands down on the installation. Until the Linux installation process becomes as simple as booting from a CD and clicking "Next" a few hundred times, it will not have the user base it deserves.

    I know there's plenty of documentation, help, support, walkthroughs etc.. etc.. but it's just not enough. I haven't found a distribution with a one-off graphical installer (and neither has my friend). There's always a bunch of commands you're going to have to learn and instructions to follow. For many (including myself), this is too daunting, and I don't want to spend a great deal of time reading up on something beforehand.

    I'm not trying to troll here I just think that until we see more distributions with simpler-than-simple installers, Linux will very much remain "underground".

    So if there's no distribution that does this already, can a Linux code-monkey write an app for windows that downloads and burns the desired Linux, then having booted from the CD, walks you through from start to finish, clicking on "Next" and "OK" etc..?

    --
    My life is one big siesta in which I'm dreaming I wished my life was one big siesta.
    1. Re:Installation Process Still Too Complicated by alga · · Score: 2, Interesting

      Your problem is that you tried three distros targeted at a competent experienced Linux user. If you tried Mandrake, SuSE or Red Hat, I assure you your impression of the install process would be absolutely different.

      "Linux is hard to install" was a popular attack on Linux a couple of years ago, so most commercial distro vendors pushed on this issue and developped simple graphical installers. Most commercial distros are definitely not more dificult to install than Windows, and most are better documented with online help.

      The inherent complexity of installing Linux is that you have to repartition a hard disk, which is unnecesarry in most cases with Windows, but this is a non-issue if you're using the whole hard drive for Linux.

      When you get comfortable with the user-friendlier variants of Linux, you'll appreciate the power you are given by Gentoo, Debian, or *BSD's.

  7. I'm a new gentoo user by Thomas+A.+Anderson · · Score: 2, Interesting
    I installed gentoo on one of my boxes a couple of days ago - here is my impression:

    Speed, speed, speed 0 just like the author stated

    the docs are excellent - I spent a half day figureing out how to st up the nvidia drivers and x, just becasue I didn't read the docs. I finally read the desktop guide, and it had everything I needed.

    Maturity - I've also installed sorcerer (the latest release) and while I like it I think gentoio is more mature. No glitches during the install - sorcerer has some kde hangups. No slight to sorcerer, I just think gentoo has had more time to work out the bugs

    --
    Personally its not God I dislike, its his fan club I cant stand (bash.org)
  8. Re:That "RPM dependency hell." by Jeppe+Salvesen · · Score: 2, Interesting

    Dependencies on a system sucks, sucks, sucks. Tried compiling perl 5.6.1 on a RedHat box? Chaos management replaces system administration!

    Once you have one piece of non-rpm software, it just gets worse. Officially, you have an older version. You may even have a good reason why you custom-compiled in the first place. Anyhow, dependencies start complaining once you start upgrading packages that depend on what you custom-built.

    The way to go is to integrate package management into

    ./configure
    make
    make test
    make install

    That would be really, really nice and basically make all distros work together again!

    --

    Stop the brainwash

  9. Re:That "RPM dependency hell." by gblues · · Score: 3, Interesting
    RPM, and any other tool that uses some form of database for dependency checking, is incredibly broken. The entire package management falls down as soon as a single major package (like, say, perl) is installed from source.

    It does not strike me as reasonable that I should have to wait for an RPM maintainer to create an RPM of the newest release. Nor does it strike me as reasonable to expect me to know how or want to build my own RPM. I would much rather be able to install my own utilities from source and not have to give up ever using the package tool ever again because the database doesn't know that the "missing" dependencies actually exist!

    A more sensible scheme could be put together using nothing more than bash, grep, tar, and ld. The algorithm would look similar to the following:

    For each executable file in the package we are installing:
    1. run ld $file |grep "0x00000000"
    2. if output = "", continue;
    3. display a "missing dependency" message.
    For dependency on other executables, use the which command. Just about any package requirement can be located automatically without the use of a database. Hell, you can grep through /proc if you want to check things like CPU speed, architecture, available RAM, etc.

    Until package management utilities check for actual presence rather than a registered presence, they will continue to have the problems you have described.

    Nathan

  10. ccache to the rescue by raulmazda · · Score: 2, Interesting

    My biggest nit pick is that I wish Portage had a better way of tracking changes between package versions. Sometimes the only difference between two versions is a few lines of a Gentoo-supplied script or config file. When you upgrade the package it forces you you to recompile the whole thing, even though the changes didn't do anything that would have affected compilation.

    I don't know if there's a good Gentoo specific answer to your question, but you could speed up the n+1th c/c++ compile if you used ccache to compile your software. See ccache.samba.org.

    ccache and its predecessor, compilercache, save me large quantities of time compiling things for work and play.

  11. Re:Yeah, right. by Steve+Hamlin · · Score: 4, Interesting

    This distribution SOUNDS nice, but plain sucks in practice.

    No, this distribution IS nice, but it plain sucks for YOU in practice.

    That in itself is the main gripe. Bandwidth is the biggest problem.

    Keep in mind, this is YOUR gripe. Bandwidth is only a problem if you are intending on downloading a lot of data,

    - like this distribution is designed to do from the ground on up.

    Face it, this distribution is for high bandwidth connections, not for us modem users.

    So?? How is that a bad thing? Don't use it. Not every distribution was designed for home modem users. I have lots of bandwidth, and am happy that I can compile the entire OS from scratch, using up-to-date sources. Are you going to demand that Debian remove the net install option, too?

    You wouldn't be surprised that a PPC distribution doesn't work well on your x86. Dont't be surprised when this bandwidth-required distro doesn't work well on your bandwidth-lacking machine.

    I think Daniel (& co.) has done an absolutely awesome job on Gentoo Linux, and deserves compliments, not people criticizing him for designing HIS distribution exactly the way he wants.

    </end rant>
  12. Re:That "RPM dependency hell." by David+Greene · · Score: 2, Interesting
    Lets see, has to be untouched for 3 weeks to go from testing to unstable right?

    I assume you mean unstable->testing. It takes nowhere near three weeks for a package to be considered for migration into testing. From the Debian/testing FAQ:

    • What determines when a package moves into testing?
    A (particular version of a) package will move into testing when it satisfies all of the following criteria:
    1. It must have been in unstable for 10, 5 or 2 days, depending on the urgency of the upload;
    2. It must be compiled on (at least) every architecture which the corresponding version in testing was compiled on;
    3. It must have fewer release-critical bugs than, or the same number as, the version currently in testing;
    4. All of its dependencies must either be satisfiable by packages already in testing, or be satisfiable by the group of packages which are going to be installed at the same time;
    5. The operation of installing the package into testing must not break any packages currently in testing. (See below for more information)
    A package which satisfies the first four of the above is said to be a Valid Candidate.

    At most a package stays in unstable for 10 days. Less if it's a critical update. If packages it depends on are not in testing, then yes, it will hang around in unstable until those packages migrate. That is proper and safe behavior. That along with points 3, 4 and 5 above is what makes testing nearly rock-solid. The only way bugs get into testing is if developers using unstable don't detect a serious bug before the 10 days are up. That's very, very rare for commonly used packages and bugs in uncommon packages rarely hose the system. If it does happen, critical updates can short-circuit the 10-day waiting period.

    Lets take Mozilla for example. 0.9.7 gets released, goes into testing... patches get added, things get fixed, more bugs, and all of a sudden, 0.9.8 gets released, starting the whole thing over... meanwhile unstable is still sitting on moz 0.9.2 or so.... just one example.

    Again, testing<->unstable in the quote above. You're correct that this can sometimes be a problem. If a package remains broken for a long time, a new release can mess things up if the package maintainer isn't on the ball. Of course, one would hope the maintainer would fix the original package and then port the new release into the fixed package. But sometimes it's not always so easy.

    I believe this is why XFree86 4.2 is being held off for now -- Branden wants to make sure that 4.1 is solid.

    --