This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Linux

Tips for new Gentoo users

By Aleksey 'LXj' Alekseyev on November 22, 2006 (8:00:00 AM)

Share    Print    Comments   

Gentoo is one of the most difficult distributions to learn, though veteran Gentoo users might point out that its friendly community and extensive documentation can help new users. Here are some tips that might make Gentoo easier for anyone who wants to give it a try.

First, be prepared to read a lot of documentation, especially in the early stages of using the distribution. You won't even be able to install Gentoo without carefully examining the Gentoo Handbook.

Gentoo has a graphical installer, but I do not recommend it for inexperienced users. Installing Gentoo in the "traditional" way will force you to read the Handbook, and therefore you will not miss important points. Also Gentoo's installer is sometimes not as good at setting up needed drivers as other distributions'. Expecting Gentoo's graphical installer to work in ways similar to that of any other distribution's may lead to misunderstanding and frustration.

The Handbook contains basic information about Gentoo. Further topics (such as configuration of X and ALSA) are described on the Gentoo Documentation Resources page. Another important source of information is the Gentoo wiki.

If you have questions that aren't covered in those places, you can find answers on the Gentoo Forums or in the distro's IRC channels.

Portage basics

One fundamental element that distinguishes Gentoo from other distributions is its package management system, called Portage, which is primarily oriented to installing software from source. This allows a great deal of control and customization -- while in binary distributions users have several packages for the same software with different dependencies and options (which actually gives users limited control compared to the options available when building the package from source), with Portage you set so-called USE flags to select optional features for the whole system or selected packages.

For example, if you need to enable KDE support and disable GNOME dependencies globally, you'd add kde -gnome to your USE variable in /etc/make.conf. You can read more about USE flags in the Gentoo Handbook .

You use Portage by invoking the emerge command. To install package moo, for instance, you simply type emerge moo. Portage checks dependencies of the given package, downloads all the necessary source archives, compiles the package, and installs it. All the information it needs is stored in its database, which consists of ebuilds, which are bash scripts written in a specific way. Ebuilds are stored in /usr/portage.

Managing Portage settings

The first rule of Gentoo is that you have to keep your attention closely on the USE flags. Why is X.org installed when you emerge Midnight Commander? Because you have the X USE flag enabled. Why does your KDE not have KPDF? Because you do not have the pdf USE flag enabled (do not ask me why it contains KGhostScript, though).

Always install a new packages with emerge --ask --verbose (or emerge -av) to see which flags will be used before compilation starts. Install the gentoolkit package (emerge gentookit) -- among other useful things, it contains the euse utility, which is intended to simplify management of USE flags. Run euse -i flag to view a flag's description and see whether it is enabled. See euse's man page for more details (do not worry, it is short).

If you need to change a set of USE flags for some package, do not install it as USE="some flags" emerge moo. This will work, but the next time you update it, the package will be recompiled with the old set of flags. Changing USE flags is what the file /etc/portage/package.use is for. Just invoke echo "category/moo some flags" >> /etc/portage/package.use before installing.

The same applies to ACCEPT_KEYWORDS -- use /etc/portage/package.keywords. In Portage 2.1 you can use package.use and package.keywords directories instead of files to simplify management.

When should you use overlays?

Sometimes you need to install a package that is not in Portage. For instance, you may wish to install a (version of a) package that is deleted from Portage. You can fetch its ebuild from Portage's CVS repository. Sometimes you want to try update a new package and find an ebuild in Bugzilla. There may be a case when you decide to edit an ebuild from the official Portage tree.

In any case, you should place your ebuilds in a custom local overlay. An overlay is a custom set of ebuilds which you want to inject to a Portage database. Do not store custom ebuilds in the primary portage tree (/usr/portage), because they will be deleted the next time you sync. Create a directory for your overlay and create a directory structure similar to /usr/portage in it. Place your ebuild there accordingly. Add PORTDIR_OVERLAY="/path/to/local/overlay" to your /etc/make.conf file.

The usual place for overlays is /usr/local/overlays, so the overlay for your own ebuilds should be /usr/local/overlays/local. What else can /usr/local/overlays contain?

In many cases, when you seek packages not included in official Portage tree, you find not just ebuilds, but also overlays you can synchronize with. For example, one of the popular overlays is xgl-coffee, which contains all you need to use Xgl. You can install it to /usr/local/overlays/xgl-coffee to separate it from other overlays and update it via SVN.

You can find more information on managing overlays in the Gentoo Wiki. You will also find there a list of third-party overlays and information on how to synchronize with them.

How often should you update?

You should not sync your Portage tree more than once a day. Even that is usually more than enough. You can keep track of your favorite packages by visiting the packages.gentoo.org or gentoo-portage.com sites (or subscribing to the corresponding RSS feeds), and resync and update only when new versions of packages you use often make their way to Portage.

Keep your world clean

Whenever you emerge some-package , the name of the package is added to the /var/lib/portage/world file. When you wish to upgrade all your packages you are usually invoking something like emerge --update --deep world, and that is when this list is used. You should keep this list of packages as short as possible; only the packages you use directly should be there. If some package is installed as a dependency of another package, it should probably not be in your world file.

For example, if you install some package that uses the wxWidgets library, this library is installed as a dependency, and is not added to your world. If you uninstall all the packages using wxWidgets, this library will not be updated when you run emerge --update (...) world, and it will be uninstalled if you run emerge --depclean. The only reason you might add wxWidgets to your world is if you were a programmer developing your own applications using this library.

There is a script that can assist you in removal of unnecessary packages from the world list. To install a package without adding it to world, use the --oneshot (-1) option. It is also a good idea to use this option when you want to install some package temporarily.

Uninstalling packages

emerge --uninstall will not check whether you are trying to remove a package that is needed by another one. Sometimes even emerge --depclean can remove packages you actually need. That's why you should be very careful when uninstalling software.

Sometimes you remove an optional dependency of some package. In this situation the package may stop working until you re-emerge it. The revdep-rebuild utility from the gentoolkit package is used to locate and re-emerge such packages.

Portage logs

Whatever you do with emerge is reflected in /var/log/emerge.log. For example, if you want to know which package is being compiled at the moment, run tail /var/log/emerge.log (I use a simple Python script to convert timestamps into a readable format). A utility called genlop (emerge genlop) can retrieve some useful information from this log. For example, running genlop -c will tell you which package is currently being compiled, and will try to predict how much time the compilation will take.

Cleaning temporary files

When an emerge session is stopped with an error, it leaves a directory that contains the temporary files it created while compiling the last package in /var/tmp/portage. If you fix the problem immediately and successfully re-emerge that package, these files will be deleted. In other cases you can empty /var/tmp/portage manually.

After several updates you may end up with many files in /usr/portage/distfiles. Use the eclean utility from the gentoolkit package to delete source files you do not need anymore. This utility can also delete binary packages you have created (invoke it as eclean-dist and eclean-pkg accordingly). See the man page for possible options.

Gentoo gives you great powers to customize your system. I hope this article will help you turn those powers to your side. While Gentoo requires you to put some effort into learning its ins and outs, it gives you the satisfaction of controlling every aspect of your system. You will like that feeling.

Share    Print    Comments   

Comments

on Tips for new Gentoo users

Note: Comments are owned by the poster. We are not responsible for their content.

Found a good hint for installing gentoo

Posted by: Anonymous Coward on November 22, 2006 05:23 PM
<a href="http://bash.org/?464385" title="bash.org">http://bash.org/?464385</a bash.org>

#

world cleaning script in Portage

Posted by: Anonymous Coward on November 22, 2006 08:20 PM
You mention a utility to help clean your world file, dep. That utility is now in Portage. emerge app-portage/udept

#

Heh

Posted by: Anonymous Coward on November 22, 2006 10:55 PM
Whats the point of running Gentoo?
You waste tons of tons of hours on compiling stuff from source to gain 1% performance?

#

Re:Heh

Posted by: Anonymous Coward on November 23, 2006 12:04 AM
I know my syetem in and out.
I am a software developer and enjoy learning how systems work.
Gentoo was a logical progression that started years ago with Debian and as my understanding of linux grew so did my curiosity.
Gentoo provides an deep and complete understanding of linux when used as a tool.

#

Re:Heh

Posted by: Anonymous Coward on November 23, 2006 12:28 AM
No, the performance gain from optimizations is not very significant as you mentioned. But a lot of OSS applications tend to have settings only definable at compile time. For example, an application might have both KDE and GNOME support. Under a binary distribution you will probably get it compiled with both and therefore pull both KDE and GNOME libraries as dependedcies. Under Gentoo you can specify which desktop you want to support.

#

Re:Heh

Posted by: Anonymous Coward on November 23, 2006 12:30 AM
Jup it takes a while but it's very stable. And if there is an error you will be able to fix it.

#

Re:Heh

Posted by: Anonymous Coward on November 23, 2006 01:40 AM
> You waste tons of tons of hours on compiling
> stuff from source to gain 1% performance?

Here we have something called "night" were compiling can take place without annoying the user.<nobr> <wbr></nobr>;-)

And performance is not what I like with Gentoo, but the fact that it just works, without any configuration tool getting in my way. Another benefit is that it never gets old because there are no versions. (Ok, the install CDs have versions and there are profiles, which can easily be switched.) Simply sync once a week, do those little updates and you have a actual system for the next XX years.

#

Re:Heh

Posted by: Anonymous Coward on November 24, 2006 02:06 AM
>you have a actual system for the next XX years

and a system that will survive hardware changes. I installed gentoo in August 2003 and I'm still using the same installation, even if I changed almost everything, including the root hard disk (twice). Last month I upgraded my cpu from an athlon xp to an athlon64, changing motherboard and video card as well, but "wtmp begins Fri Aug 1 22:35:22 2003" as always.

#

Re:Heh

Posted by: Anonymous Coward on November 27, 2006 05:29 AM
I agree. Gentoo isn't for everybody (or most?). I started using linux 9 years ago at school. I was downloading Redhat 3 or 4 from a dialup. Configuring and compiling the kernel and packages was the norm.

But now as a professional, waiting for minutes or hours for something to compile before you can do actual work is just unacceptable. If you just want to get work done, stay away from Gentoo.

#

Re:Heh

Posted by: Anonymous Coward on December 01, 2006 07:43 AM
What it all boils down to is, Gentoo is the most fun.
People who complain about long compile times, configuration, etc. only use their computers for 'work'. That kind of person should just use a Mac.

#

Re:Heh

Posted by: Anonymous Coward on January 04, 2007 02:04 PM
HI

Simply because its linux!!

cheers

#

Re:Heh

Posted by: Administrator on November 23, 2006 01:25 AM
For me, the point of running any Linux distro is "learning" how system works from a kind of different view OR "solving" some particular problem/task.

According to your second question/statement, gaining performance of 1% is sometimes very important, and i am sure that you do understand what I am talking about, but that percentage is much higher, trust me, and give it a chance.

#

Gentoo Install

Posted by: Anonymous Coward on November 23, 2006 03:01 AM
To make your Gentoo Install much easyer:
<a href="http://gentoo-install.com/" title="gentoo-install.com">http://gentoo-install.com/</a gentoo-install.com>
All the info you need without the fluff.

#

Installing Gentoo 2005 and 2006.

Posted by: Anonymous Coward on November 23, 2006 07:49 AM
HOWTO: Installing Gentoo 2005 and 2006.

Then click here:

<a href="http://m.domaindlx.com/LinuxHelp/" title="domaindlx.com">http://m.domaindlx.com/LinuxHelp/</a domaindlx.com>

<a href="http://linux.coconia.net/" title="coconia.net">http://linux.coconia.net/</a coconia.net> (this site has been forced closed by whoever runs www.100webspace.com. It seems that they did not like pictures of GW Bush praying at the Wailing Wall in Jerusalem, with a Jewish Skullcap on, and others of Bush celebrating Chanukah, and others with him cavorting with dozens of rabbis. It might not have been the photos of Bush in Jewish garb, that were offensive, but similar photos of V. Putin, John Howard and others).

There are also HOWTOs on:

1) cloning your windows XP/2000 installations using Linux (back-ups).
2) installing windows XP/2000 on a spare partition with Linux.
3) accessing and writing to Windows XP (formatted with the NTFS) from Linux.
4) compile the worlds best DVD/Movie/Video/MP3 Player and Encoder (MPlayer and MEncoder).
5) remix those 14 Debian installation CDs as 2 DVDs.
6) the entire book "Linux Device Drivers 3" in HTML format.
7) 3D acceleration for ATI cards (simple procedure, works for SuSE and Mandriva and Debian).

#

Re:Installing Gentoo 2005 and 2006.

Posted by: Anonymous Coward on November 23, 2006 07:39 PM
The above site is simply an ad trap with five pop-ups. Four of which are thankfully blocked by Firefox.

#

You are full of,....

Posted by: Anonymous Coward on November 24, 2006 10:53 AM
"five pop-ups?!?!?"

You are full of sh*t. I get ZERO, pop-ups with the site and FireFox.

#

Re:You are full of,....

Posted by: Anonymous Coward on November 24, 2006 03:51 PM
And you are obviously the author of the site. Not to mention a bold-faced liar.

#

I want to see the photos (of the Jew G.W. Bush).

Posted by: Anonymous Coward on November 24, 2006 10:38 AM
I want to see the photos (of the Jew G.W. Bush).

#

difficult? that means I'm a guru?!?

Posted by: Anonymous Coward on November 23, 2006 04:50 PM
I've been running gentoo since almost 3 years and I've never thought at me as a guru!
Indeed in the company I work every time I have configuration/server/whatever problem I ask the sysadmin
But I've installed gentoo on my own and I do manage it.
If you write on linux.com and you think that's is difficult, then I defenitely have to write a new chapter in the British Encyclopedia!!

#

My tip for new Gentoo users...

Posted by: Anonymous Coward on November 25, 2006 11:48 PM
Download and install <a href="http://www.ubuntu.com/" title="ubuntu.com">this</a ubuntu.com>. Don't waste your life away by compiling packages from their source.

#

lolwut

Posted by: Anonymous [ip: 68.213.181.253] on March 07, 2008 08:39 PM
Nice job. I bet you don't realize that all that 'compiling' was what the predecessors of Linux had to do back in the olden days? Great way to piss all over that with an Ubuntu link. Gentoo is closer to BSD in nature, which makes it interesting. Also, cheers to whoever mentioned Sabayon Linux. It's what Ubuntu tried to be to Debian, but failed.

#

A quick way to get started with Gentoo

Posted by: Anonymous Coward on November 27, 2006 03:27 AM
Give <a href="http://www.sabayonlinux.org/" title="sabayonlinux.org">Sabayon Linux</a sabayonlinux.org> a try. Its based on Gentoo but has a more friendly installer on the live cd. The live DVD has almost every package you can want too. Still not for the Linux novice, but a nice way to get a more-than-basic Gentoo desktop installed quickly (some familiar with Gentoo call it a "Stage 4" install). All the tips from the article still apply, as once you are up and running, its just like any other Gentoo install.

#

updates

Posted by: Administrator on November 22, 2006 10:25 PM
nice article!

talking new users, it would imho be good to mention the fact that updates that you receive via "emerge -ua world" are general updates of all packages and not just security updates. to find security problems look at the Gentoo Linux Security Advisories (eg.: @ <a href="http://www.gentoo-portage.com/GLSA" title="gentoo-portage.com">http://www.gentoo-portage.com/GLSA</a gentoo-portage.com>) and consider installing "emerge -a app-portage/gentoolkit" to use glsa-check. syncing and updating daily is overkill for the normal user.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya