Gentoo Linux

by Sean Bossinger

Most LJ readers are familiar with the various commercial distributions of Linux available for desktop and server systems. When one thinks of these commercial versions of Linux, one naturally might gravitate toward such names as Red Hat, SuSE or Mandrake. Some may even go so far as to think of UnitedLinux or, dare I go there, SCO Linux. Then, of course, there are your non-commercial community-supported distributions, including Debian and Slackware. When I mentioned to a friend that I was going to install Debian on a system so I could learn more about Linux, he suggested I try the Gentoo distribution.

What Is Gentoo?

According to Gentoo's architects and developers, Gentoo Linux is a ”special flavor of Linux that can be automatically optimized and customized for just about any application or need“. Depending on how deeply customized you want your system to be, this customization can be as simple as selecting only the applications and services you want on the system. On the other end of the spectrum, you could go as complex as instructing the compiler directives to utilize instruction sets that render executable code compiled specifically for your processor. The ease with which this customization occurs is part of what gives Gentoo its strength. Modify one file (/etc/make.conf) with the processor directives you wish to use, and let Gentoo's Portage system build executable files optimized for your exact needs.

Another, probably more important, hallmark of Gentoo's flexibility is you build the system according to your exact needs. You determine, at the package level, what it is you require your system to do. For example, if you were building a desktop system on which you had no desire to run a Web or mail server, you could install only those packages that you want on your system. If you want GNOME, you install GNOME. If you want KDE, you install KDE. If you want the plain Free86 windowing system with twm, you install the plain Free86 windowing system with twm. What makes Gentoo perhaps the best distribution with which to do this sort of customized system building is the underlying package management system that is this distribution's foundation: Portage.

According to Gentoo's home page, Portage "is the heart of Gentoo Linux, and performs many key functions". Portage acts as the software distribution system; it also acts as an integrated package-building and installation system, as well as a system updater. In these ways, it is similar to Red Hat's RPM and Debian's apt-get functions, but it is more powerful than either. This power manifests itself in the use of the Portage tree, which is a set of scripts downloaded to the machine that control the dependency needs and compilation options of various source-based software packages (over 4,000 at last count).

My Experience Installing

Installing Gentoo Linux is a more manual affair than is installing the commercial distributions; however, there is talk in the Gentoo forums of building a graphical installation that will automate many of the tasks. Presently, in order to install the Gentoo distribution, you make your decision about how much customization you wish to introduce to your system, and then you download the appropriate ISO image from the Gentoo Web site or purchase CDs from the Gentoo store.

You can choose to optimize your system fully based on compiler directives and built-in dependencies, which includes setting the optimizations and then building the compilers used to compile the rest of the software. Alternatively, you can choose to use pre-built software from the Gentoo group. The advantage to optimizing the compiled code with your own settings is the code generally runs faster on your system if you optimize it for your processor's specific instruction set. The disadvantage of this option is the time spent on the compilation process, which can be quite extensive, even given the advances in modern chip architecture. For my installation, I chose to go with the Stage 1 tarball installation. This means I was building my system from the ground up, compiling the compilers that would be used to compile the rest of the software that would be installed on my machine.

Essentially, the installation is as straightforward and as similar in fashion as almost every other operating system installation out there. The only difference is the manual nature of the individual steps, which are well documented by the Gentoo staff on the Web site. I started out by downloading the Live CD ISO image that I wanted to use and then burned it to CD. Using the Live CD, I booted my destination machine into a self-contained Gentoo environment included on the CD image. I enabled DMA on my hard drive and allowed the network to be configured by DHCP. Following this, I used fdisk to partition my drive. I created my filesystems and formatted them; I chose ext3 for my boot partition and used ReiserFS for my root and home partitions. After disk setup, the fun really starts.

The next step was to extract the Stage 1 Tarball I chose to start with. Afterward, I wanted to make certain I was using the latest Portage tree, so I performed an emerge sync. Then, to make sure I was compiling my software with the appropriate compiler directives, I used nano to edit a single file, /etc/make.conf. After ensuring I had all the customizations I wanted in the configuration file, I started the bootstrap process, whereby Gentoo's scripts recompiled the GCC compiler. Following this step, I moved on to Stage 2, which essentially comprises more compilation of basic system components. This occurs automatically with the use of the Portage system and the command emerge system.

After the several hours that the compilation took, I had to modify the /etc/fstab manually to indicate where my partitions were. I also had to download the source for my kernel and compile it. After this, I downloaded and compiled a system logger, a cron dæmon, set my root password and configured a boot loader. I then cleaned up by unmounting the various file systems I had mounted for the installation process, ejected the CD and restarted my machine. At this point, my machine was a clean shell, awaiting my command to install software using the Portage system. When all was said and done, it took me approximately 24 hours from start to finish to have a fully functional, fully customized desktop system.

Good Points, Bad Points

The first item I should address is what I would think is a perceived "bad point" about a 24-hour system setup time. Although some may consider this compile time to be excessive, this is not 24 working hours. All together, I spent about three hours in front of the machine, and most of this was spent watching Portage do its thing.

The second thing I want to address about the time is my case is an extreme that, if you choose to use the Gentoo system, you don't have to go to. Only if you want to bootstrap your system and compile everything from the ground up are you required to go through these steps. You can, and many people choose to, install from the Stage 2 or Stage 3 tarballs, which have many packages precompiled using standard directives. In using the compiler directives that I chose for my processor, I have noticed a speed improvement by what I would estimate to be about 10% to 15%. My main reason for choosing the Stage 1 tarball was to become intimately familiar with building the Gentoo system from the ground up. Additionally, the Gentoo group does provide ISO images with software precompiled using compiler directives for specific branches of processor families (for example, Athlon/Duron, Pentium 4, Athlon-XP). These offer the optimization without the hassle of the wait of compiling.

A huge plus that has kept me with the Gentoo system is the ease with which I can add packages to, remove packages from and update packages installed on my system. Essentially, all of these are accomplished using the emerge command. For example, to install OpenOffice on my machine, I dropped into a shell and typed emerge openoffice. After a two-hour optimized compilation period, OpenOffice was available to me and my users (my wife). When a security patch was offered for OpenSSL, in order to update it and my entire system, I merely typed emerge -u world. All the packages I had installed on my system that had updates available then were updated.

Another huge plus that I have found has little to do with the Gentoo distribution itself but the support community and the Gentoo Web site. Gentoo's documentation is surprisingly commercial-grade, even more so than some documentation for the commercial distributions. The Gentoo group's reliance on XML and CSS for its Web site gives it a uniform look, feel and implementation. It's clean, robust and functionally usable.

As far as support is concerned, any question that I have asked has been answered within minutes of posting it to the mailing list. Generally speaking, the users I have encountered have been warm to newcomers, and they appear to be interested in cultivating a large base of users for this product. It's rare in the technical community to find seasoned users who are as adept at answering the questions of newcomers such as myself as they are at helping other seasoned users solve technical problems.

Last, but not least, an operating system with no application support is not a good thing. With Gentoo, there are no worries. The Gentoo community has produced more than 4,000 applications in the Portage/ebuild format (from completely free software such as Ximian's Evolution to proprietary software such as VMware), and the library keeps on growing. And if you can't find an ebuild for a particular product, you always can download the source and install it as you would on any of the other Linux distributions.

Gentoo Linux offers an option for the user who wants an easily and highly customizable system that also can be kept up to date with ease. If this is you, I highly recommend looking at this metadistribution.

Sean Bossinger manages the University Technology Services Support Center at Florida International University. In his copious free time, he enjoys playing in the park with his wife, Tracy, and two rambunctious sons, Donovan and Logan.

Load Disqus comments