Skip to main content

SMOKE="gentoo"

posted onApril 6, 2004
by hitbsecnews

By: mel (mel -at- hackinthebox.org)

Introduction

The other day I installed Fedora Core 2 Test 1 on my system to give it a
try. I've been using RedHat for years now, starting with version 5.3 or so.
Of course, just like any music freak, the first thing I did was run xmms, and
to my horror, I can't play MP3s with it. Now, why RedHat disabled this is
obvious. But the thing is, users will get around this by re-installing xmms
through compilation, or use an alternative application. I was dejected
nevertheless, because it means that I have to go through RedHat RPM
dependencies nightmares.

Enter Gentoo. Gentoo has an excellent portage system (comparable to FreeBSD
and Debian) and installing any, I mean any software, either free or
commercial is a breeze by using its emerge tool. In my case, installing
xmms was as easy as emerge xmms, and it comes with various support built
in such as ogg vorbis. If you need xine, just do an emerge xine, if you
need vmware, just do a emerge vmware-workstation. Another good example
is installing mod_php on apache2 with MySQL, PostgreSQL, gd, libjpeg, libpng,
and freetype support.

All I have to do is


# USE="apache2 gd mysql postgres jpeg png gd -java" emerge -pv mod_php

And guess what? I've got myself MySQL, PostgreSQL, Apache2 and PHP installed!

And if I don't need apache2 anymore, all I do is just:


# emerge unmerge apache2

Gentoo makes softare maintenance much easier.

How it began

It began by me being sick and tired of doing things the hard way. Redhat
never make my life easy, and neither do RPM. Redhat is riddled with
too much Redhat-ism, the RedHat network, and its commercial aspect. Despite
being one of the most popular Linux distros around, when it comes to
software updates and maintenance, RedHat just don't do it for me.
Gentoo on the other hand, is the easiest Linux distro anyone can use.
emerge is one of the handiest tools around. With emerge, you can easily
managed the applications that are installed on your box.

The installation

The installation process is long and tedious. Users can choose from
stage1, stage2 and stage3 installs.
In stage1, everything is done from scratch, which means that you have to
bootstrap your system. This process involves building the GNU C library,
GNU Compiler Collection (gcc) and other key system software.
With stage2 however, you already have a botstrapped system. But you still need
to build the base system.
stage3 is the fastest alternative where you have a base system installed.
Regardless of which stage you chose, the installation is very involved.
You have to keep track of what you are doing, and following the
instruction carefully is a must.
I myself tried the installation about four times before I finally
get Gentoo up and running

Optimized system

Unlike RedHat's RPM, Gentoo will get the latest stable version of a software
and configure and compile it based on your system. This means that all
software are optimized for your system.
There are pros and cons. The pro is that your system is completely optimized.
I found that Gnome on Gentoo runs at about 10% faster than Fedora. Similarly,
Openoffice.org also runs faster on Gentoo.

The con is, you have to bear with the compile time. During the initial stage
of my Gentoo installation, xfree took about 7 hours to compile,
Gnome took 6 hours, while Openoffice.org took 9 hours. On top of that,
your system will be full of tarballs which takes up disk space. You will
also need to have a big hard disk, especially if you want to compile
Openoffice.org - this alone takes up to 4 Gb of space.

Source-based system as opposed to binary distributio

The heart of the Gentoo philosophy is the source-based distribution as opposed
to binary based distribution. This encourages unified development and
integration. Thus, the Portage is the core of Gentoo. Binary distribution
however (think RedHat's RPM) are prone to inconsistencies, difficult to
manage and not to mention that the binaries are optimized for Intel-based
processors.
Gentoo is also not rushing in its distribution of the latest software.
For example, the final ebuild for Gnome-2.6 was released yesterday, 3 days
after the official release of Gnome. Gentoo developers will test the software
first before releasing final release builds.

Clean and easy to use init

Gentoo's startup scripts are very easy to use. For example, after installing
Snort, all I do is just run


# rc-update add snort default

This will start snort at the default runlevel. If I chose to disable Snort,
I just run

# rc-update del snort

Gentoo also have a separate directory to place file where you can pass
extra options to services that are started in the runlevel. The directory
is /etc/conf.d/. An example is the apache2 configuration. To run HTTPS,
all you need to do is edit /etc/conf.d/apache2 and edit the APACHE2_OPTS
variable.

Gentoo's init is also capable of taking care any dependencies. For example
to figure out what other services that postfix depends on, you can type

# /etc/init.d/posfix ineed

And to figure what services requires postfix, you can type

# /etc/init.d/posfix needsme

Easy software maintenance via emerge and portage

The heart of Gentoo is its portage system. Gentoo's portage is similar
to the BSD ports. It allows users to easily install application.
One of the most commonly used feature of portage is the USE keyword. The
USE settings allows the user to disable or enable various features when
installing packages. For example, while building mod_php, I specify
USE="mysql apache2 gd" to build apache2, mysql and gd support into PHP.

Portage also has a feature called CONFIG_PROTECT where you can specify
file (for example apache's configuration file, php.ini, etc) to be
protected and not overwritten when upgrading packages.

Large user community

The Gentoo forum (http://forums.gentoo.org) is one of the best technical
forums that I've ever encountered. It is very well maintained and moderated,
and you can get answers to almost anything Gentoo related from the
forums. The forums itself, has its own sense of humor as well.

There's also the mailing lists where you can get answers to your Gentoo
woes.

Care for the users

Gentoo's emerge and portage system do not install software blindly when you
tell them so. For example, last night I was upgrading Gaim (from 0.75 to
0.76) and before compiling and after compiling, emerge beeped (yes beeped)
giving me some warnings regarding Gaim, and what to do in case it crashed.

Nice isn't it?

Another feature of Gentoo is software masking. The idea is, if there exists
the release build of a new software, you need to unmask it before
emerge will agree to install. This ensure that users will install only the
stable software.

Besides this, Gentoo protects the boot partition. It was not mounted.
In the case where your computer crashes (no Linux does not crash unless
you experience a power trip where you don't have UPS), Gentoo will
automatically check the filesystem, unlike RedHat where users can choose
to skip the checking process.

Some caveats and advices for the beginner

  1. The installation time is very very long. On my 1.7 GHz Athlon XP 2100
    (we at HITB are staunch AMD supporters) desktop, here are rough estimates
    of compilation time:

    xfree - 7 hours
    Gnome - 7 hours
    Openoffice - 9 hours
    Firebird - 2 hours
    Thunderbird - 3 hours

    All in all, the installation from stage2 took me one whole weekend.

  2. Source codes and compilation take disk space. If you allocate 1 GB for
    root partition (/) like my case, make sure you edit /etc/make.conf and
    set PORTAGE_TMPDIR to a bigger partition.

    Also, if you plan to compile openoffice.org, be sure that the partition
    where PORTAGE_TMPDIR resides have at least 4GB of free space!

  3. USE settings, what are they? One of the new things that a user must know
    about his or her new Gentoo system is the USE settings. I myself find
    this hard to digest at first, but you can read about USE flags at Gentoo's
    site. Also, the too ufed can be used to edit USE flags.

    # emerge ufed

    4. There are other portage tools available. I found the following tools very
    useful.

    gentoolkit - contains tools such as equery which can give more information
    regarding packages (not installed by default)

    esearch - a faster alternative to emerge search (not installed by default)

    ufed - USE flag editor (not installed by default)

    mirrorselect - run this once in a while to find the mirrors closest to you

  4. There is no need for excessive CFLAGS. On my system, my CFLAGS is set to:
    CFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer"

    Anything beyond 02 does not offer much in terms of speed improvements.

  5. If you are new to Linux and never compiled a kernel before, use the
    genkernel tool. genkernel is not installed by default, so you have to
    emerge it during installation. I myself used genkernel because my two
    attempts at kernel compilation failed. Once you are familiar, then you
    can compile it manually at a later time.
  6. If you encounter any problems that you can't solve during install time -
    no worries. Just head over to http://forums.gentoo.org. This, in my
    humble opinion, is one of the best run technical forums out there.
    I found ALL solutions to my problems there!
  7. Failure in one of the installation steps does not mean that you need
    to start from scratch everytime. After you created your partition but
    somehow other things screw up during install, you can always use the
    Gentoo LiveCD to mount your partitions and continue.
  8. Lots of downloading. Broadband Internet connection is almost a must
    when installing.

Conclusion

Gentoo is well known for its tedious and long install process. Then there
is the documentation which some say difficult to follow. Regardless of
the tedious and long install, I found that it is worth it in the end.
Now I have my fast, optimized, and easy to maintain desktop system.

If you are a long time Linux user, try Gentoo. Even if you are Debian
user and very fanatical about it (Gentoo users are fanatical too), try
Gentoo. If you are a newbie, there's no reason to fear Gentoo. Trust me,
you'll learn a lot about your system during the installation process,
and you'll benefit from portage and emerge.

There's so much to gain from Gentoo and I believe Gentoo is the
way Linux should be, not riddled with broken RPMs and poor software
maintenance as demonstrated by RedHat.

I wish I would have known Gentoo earlier.

NOTE: At the time of writing this, I am updating Gnome to Gnome 2.6. On
Gentoo, this is done very easily if you are familiar with Gentoo's portage
and emerge. One will assume that all it takes is a emerge gnome, but not
quite since the Gentoo people haven't released an official 2.6 ebuilds.
Instead, follow the following steps:

  1. Edit /usr/portage/profiles/portage.mask
  2. Copy all lines between "The big gnome 2.6 mask" and "End of gnome 2.6 mask"
    to /etc/portage/package.unmask
  3. On the shell, type
    # ACCEPT_KEYWORDS="~x86" emerge -pv "=gnome-2.6_rc5"
  4. Resolve any blockers, if any by unmerge-ing them
  5. Update Gnome by typing the command (minus the -pv) on step 3

About 4 or 5 hours later, my Gnome desktop is updated!

Resources

1. http://www.gentoo.org
2. http://forums.gentoo.org
3. http://gentoo-portage.com

4. http://www.breakmygentoo.net

5. http://reviewed.homelinux.org/gentoo

1.) Reducing "Human Factor" Mistakes - Dancho Danchev
2.) Virtual File System - /proc - Danny “Dr.T”
3.) Hiding Files - [in]visible
4.) Better Living Through Mod Security - L33tdawg
5.) Guide to ARP Spoofing - Barfbag
6.) SMOKE="gentoo" - mel
7.) Nessus - Doing more with Less - christian

Source

Tags

Articles

You May Also Like

Recent News

Friday, November 29th

Tuesday, November 19th

Friday, November 8th

Friday, November 1st

Tuesday, July 9th

Wednesday, July 3rd

Friday, June 28th

Thursday, June 27th

Thursday, June 13th

Wednesday, June 12th

Tuesday, June 11th

Simplenews subscription

Stay informed - subscribe to our newsletter.
The subscriber's email address.
Keeping Knowledge Free for Over a Decade

Copyright © 2018 Hack In The Box. All rights reserved.

36th Floor, Menara Maxis, Kuala Lumpur City Centre 50088 Kuala Lumpur Malaysia
Tel: +603-2615-7299 Fax: +603-2615-0088