Thursday, 19 January 2006

My dalliance with Gentoo Linux

I am a self confessed Linux addict. Seriously, I just love to try out new Linux distributions and see how they fare against one another. Now this addiction of mine has got its own advantages. For example, it gives me a fair idea about the pros and cons of each distribution, its weaknesses and strengths. And this experience form a basis on which I decide which should be my dominant distribution at any given time. Not surprisingly, I have reserved a ext3 partition of 6 GB size, specifically for installing and trying out new Linux distributions on my machine.

For quite some time now, I had wanted to install and try out Gentoo. But the experiences of other people showed that I should perhaps start installing it when I have at least a few days to myself. So the weekend prior to last when I got a few days off, it was Gentoo's chance for getting installed on this partition I talked about earlier.

I dutifully downloaded the ISO image for Gentoo. Actually, Gentoo is all about choice and even for downloading it, the user is faced with choices. I found that, broadly speaking, I had a choice of downloading the Universal installation ISO which included all that was needed to get a workable Gentoo on your hard disk like the stage 3 files (I will come back to it later), the source code for extra applications as well as the Gentoo hand book which is a must read if you are to install Gentoo on your machine.

Alternatively, you could also download the minimal installation ISO image which will only configure your network for you and allow you to connect to the internet from where, you will have to download the additional files including the stage 3 tar balls. The second option is better if you have a broadband internet connection of 512 kpbs or more because then you get the latest versions of packages. But since I had less than the 512 Kpbs line, I chose to download the universal installation ISO image and burn it to the CD.

Next I booted my machine using the Gentoo Universal CD and Gentoo automatically detected all the hardware like sound, PCI slots, USB and so on and put me in the root shell.

From here it was a matter of opening the Gentoo Handbook in links (a web browser) on one of the terminals and carrying out the tasks listed in the book on the other terminal. I had around 5 terminals at my disposal and I could easily switch from one terminal to the other using the [Alt+Fn] Key combination.

A word about stages in Gentoo
There are three stages in Gentoo. They are as follows:
  1. Stage 1 : In this stage the system must be bootstrapped and the compilers and essential libraries need to be compiled first from the source.
  2. Stage 2 : In a stage 2 tar ball, the system has already been bootstrapped for you, but you still have to compile all the packages from source.
  3. Stage 3 : A stage 3 tar ball contains all the essential files like compilers and libraries in a binary format. When you are installing Gentoo on your machine, it is recommended to use the stage 3 tar ball unless you have a lot of time to kill on your hands. The advantage of using stage 3 is that the user is saved from the mundane tasks of starting from the very beginning.
Gentoo uses Portage to install software
Each Linux distribution out there has adopted one or the other form of automation for installing packages on an end user's system. If Red Hat has adopted Yum, Debian based distros swear by apt-get.

Gentoo also has developed its own way of automating the whole task. And that is using portage. Portage is a python based package management system similar to those found in FreeBSD which downloads the source of a software and compiles them on the end user's machine. So suppose, I want to install abiword on my machine running Gentoo, I can achieve it through just one command - that is :
# emerge abiword
The emerge script will download the source of the Abiword package along with the source of any other dependency packages to my machine, compile it using the parameters I have opted for and install it on my machine. It is as simple as that.

I will not go into the exact steps I took in installing Gentoo on my machine. The best and the right place for that would be the Official Gentoo Handbook which has done an excellent job of detailing in a simple manner, the steps to be taken in installing this fine distribution . Any way, if you intend to install Gentoo on your machine, you will compulsorily have to read the book at least once so there is no point in detailing the steps here.

Gentoo makes heavy use of environment variables. One environment variable you can be sure of dealing with is the USE variable. I found the use of this variable really unique and useful (no pun intended). Another environment variable I had to set was the CFLAGS variable which specified the architecture and processor make of my machine.

For example, there are a lot of GPLed libraries like gtk, gtk2, qt and so on. If I do not intend to install KDE applications or KDE desktop on my machine, I can easily disable the support for Qt library in my programs at the time of compilation. This I accomplish using the USE variable.
# USE="-qt gnome gtk gtk2" emerge abiword
... will download the source and compile abiword on my machine without any support for Qt but with support included for gnome, gtk and gtk2 libraries.

The environment variables are usually inserted one per line in the /etc/make.conf file. But as far as USE variable is concerned, you can also pass values at the time of emerging as shown in the above example.

Gentoo helps understand Linux better
One thing I found unique to Gentoo was the knowledge gained by the user in the process of installing it on the hard disk. And if you are an experienced Linux user / administrator, it will be a revision time well spent. Some of the things you will understand more are as follows:
  • Partitioning the hard disk using fdisk utility.
  • Creating file system of ones choice on the partition.
  • Turning on swap using the swapon command.
  • Mounting the partitions on to a mount point (/mnt/gentoo in my case)
  • chrooting to a directory or partition
  • Configuring the kernel parameters and compiling and installing the kernel the old fashioned way (If you are not opting for the stock genkernel that is).
Advantages of Gentoo
  • After all this trouble, what you get is a Linux distribution which is tailor made for your machine, blazing fast, with just the packages you need devoid of unnecessary baggage. In fact, if you can correlate other Linux distributions to a Honda motorcycle, ie rolled out from a factory assembly line, all looking and working alike, then Gentoo is a Harley Davidson of Linux distributions; no two installs identical to each other.
  • Another advantage for Gentoo is a very strong user community with prompt help support.
The down side of installing Gentoo
  • Unlike other distributions, it takes a lot of time for installing gentoo on the machine. In my case it took a larger part of 4 days to finish installing gentoo with X and the applications I needed. Coming back to our bike analogy, same way as a Harley Davidson bike is a fuel guzzler, Gentoo is a time guzzler.
  • To successfully install Gentoo on your machine, at some point of time, an internet connection is mandatory.
  • Finally, you should stock yourselves with a large dose of patience.
A suggestion to the developers of Gentoo
One thing which grabbed my attention was the inordinate time it took to download and install software on the machine. This is especially evident when there are dependency packages to be installed. For example, when I gave the command:
# emerge kde-base/kgoldrunner
It started downloading the first package, unpacking it in a directory and compiling and installing it. Then downloading the second package, unpacking,compiling and installing it and so on. In fact it was a download - compile - install - download - compile - install cycle.

The down side of following this cycle is your internet connection should be maintained at all times till the installation of all the packages are completed.

I feel it would be better if the emerge script is tuned to download all the package sources including the dependencies first at a single stretch and then, start the compile and install process. This way, once the download is complete, the internet connection is not important any more and even if the internet goes down, it will not hamper the installation in any way.

No comments:

Post a Comment