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.
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).
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.
Practical books for the most technical people on the planet. Newly available books include:
- Agile Product Development by Ted Schmidt
- Improve Business Processes with an Enterprise Job Scheduler by Mike Diehl
- Finding Your Way: Mapping Your Network to Improve Manageability by Bill Childers
- DIY Commerce Site by Reven Lerner
Plus many more.
- Handheld Emulation: Achievement Unlocked!
- Unikernels, Docker, and Why You Should Care
- Building a Multisourced Infrastructure Using OpenVPN
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Happy GPL Birthday VLC!
- Server Hardening
- diff -u: What's New in Kernel Development
- Giving Silos Their Due
- New Products
- Controversy at the Linux Foundation