Gentoo: A Linux Distribution Where You Compile Your Own Optimized Software

gentoo logo   Gentoo: A Linux Distribution Where You Compile Your Own Optimized SoftwareThe sheer number of different ways in which Linux can be run is astounding, as there are plenty of choices to go around. While there are plenty of distributions which rely on either the .deb or .rpm package formats, there’s also a handful which use their own formats, if any at all. One of those distributions is very unique compared to most others as the distribution’s developers don’t compile software into binary packages for easy installation.

Instead, this Linux distribution doesn’t care about how easy it is to install software, but rather have it work as well as possible on your system through machine-specific optimizations.

About Gentoo

gentoo desktop   Gentoo: A Linux Distribution Where You Compile Your Own Optimized Software

Gentoo is a Linux distribution which is a completely original project and which has a very different approach to the structure of the distribution compared to most others. The idea of Gentoo is for all installed software to be self-compiled – that is, you download the source code to the software and compile it yourself on your own system so that the compiler can create the software for your exact system.

For most other distributions, software is already compiled on the developers’ servers and packaged so that the operating system can easily extract the package and move the binary files into the correct places. Those binary files are generally compiled for all systems using a specified architecture, but as they are not compiled on your system, they’re theoretically not as optimized as they could be.

Emerge

gentoo porthole   Gentoo: A Linux Distribution Where You Compile Your Own Optimized Software

Although you’ll need to download all the source code that you need and compile it yourself, you won’t have to stay stuck with finding the source code yourself, compiling it the correct way, and keeping it up to date. Instead, Gentoo has an application called Emerge (to which an application called Porthole is the GUI) which works a lot like apt on Debian-based systems like Ubuntu or yum on Fedora.

It can check different “repositories” for new or updated software, and list it in Porthole. Emerge, however, uses a ports system where each entry in the system is simply an .ebuild file which lists the commands that Emerge needs to run in order to download the source code and compile the software correctly. Whenever Emerge checks the ports system and finds that a newer version exists, it’ll update its software list and act accordingly.

Advantages & Disadvantages

There are a handful of advantages and disadvantages to this approach of installing hardware, so Gentoo is really only useful in certain conditions or if you’re a Linux pro who wants to give it a go. The advantage to this method of installing software is that it is all compiled on your system, so the compiler can account for all possible optimizations and make the software run as fast as possible.

It also makes the installation of software a lot more flexible if you know what you’re doing, which anyone less than a Linux pro probably won’t. Such flexibility and optimization leads to the possibility of some pretty cool projects, like the Misa Digital Guitar which runs on Gentoo Linux. Therefore, if you really need the last possible ounce of performance, Gentoo may be the way to go.

However, for more common users, there are several disadvantages which may not make Gentoo worth our time as a daily driver. For example, Gentoo is definitely not easy and is highly discouraged for a Linux beginner. Compilation also takes a good amount of time, even with a powerhouse CPU doing all the work. There’s a reason why most people compile the software on their own powerful servers and then simply package it up.

To remedy that situation, the Gentoo developers have made available a few pre-compiled binaries for software which is known to take forever to compile, such as Firefox or the KDE desktop environment. However, these kind of defeat the purpose of the distribution, so if you’re going to do that for almost all of your software, you might as well be using a (relatively speaking) traditional distribution.

Again, Gentoo can be a great choice for you if the advantages outweigh the disadvantages for whatever you’re doing.

Conclusion

While I don’t see myself using Gentoo as a main operating system in the near future (or ever for that matter), it’s still a fantastic distribution which adds plenty of value and ideas to the Linux community. For those of you who plan on using or testing Gentoo out, I hope that you’ll be successful at whatever you’re trying to do. It’s always best to use the right tools for the job, and Gentoo can definitely fill that position.

What do you think about Gentoo’s approach? Which distribution’s approach do you like the most, or what do you think could be changed about Gentoo’s? Let us know in the comments!

The comments were closed because the article is more than 180 days old.

If you have any questions related to what's mentioned in the article or need help with any computer issue, ask it on MakeUseOf Answers—We and our community will be more than happy to help.

34 Comments -

Florin Ardelian

The really big advantage of Gentoo is that it can be compiled on your toaster or hair dryer. If your CPU supports some known instruction set, Gentoo can be compiled on it. This means that all its packages are available, unlike Debian’s which are pre-compiled for specific platforms (86/arm/etc).

I’ve installed it from *scratch* working from their online documentation and, while it took a couple of hours for me as a newbie, it was unbelievably simple (I only found 2 errors in the docs).

All of the other apps installed without any issues, but I didn’t manage to get Gnome nor KDE working. There were a few compilation errors and I couldn’t figure out in time how to work around them so I gave up.

tl;dr Gentoo is a great idea and it (almost) works out of the box on (almost) any platform!

Danny Stieben

I’ve always raised an eyebrow whenever I’ve had to manually compile code. And especially install Gentoo from scratch. Like you said, it’s a great idea but it takes a lot of work.

Ben Klaas

I ran a Gentoo box as my main server for a few years. It was so not worth it. I’m glad it’s around, because it’s a novel approach and for the truly hardcore it’s a way of understanding how varying package and build parameters can change performance, but man…so not worth it. It’s the truly niche user that wants to be presented with 1000 options and compiling software from source just to get e.g. vim installed.

If you’re a Linux user thirsting for your box to run quicker, but not really interested in spending so much brain cycles on what Gentoo does, consider an LXDE or Openbox desktop, and distros like LXDE Mint, Lubuntu, or Crunchbang.

Danny Stieben

Arch is another option if they are at least somewhat interested, but don’t have all the time needed for Gentoo.

Daniel

I was a Gentoo user for several years, and I mean a desktop daily user, not a server runner. I was very happy with it, and the main advantage of having ran Gentoo was that I learned A LOT. It was an incredible time in which I learned all the nuts and bolts of a Linux system. And I repeat, I used it for my humble, daily matters, along with some (many) geeky tricks.
So, why I changed to Debian, which is my distro of choice now? Well… it takes a lot of time to maintain a Gentoo system, I found that Debian fills all my daily and geeky needs without the hassle.
But for anyone who wants to learn how a Linux system really works, I highly recommend it.

Danny Stieben

Thanks for sharing, Daniel!

Jon

I’d just like to interject for a moment.

What you’re referring to as Linux, is in fact, GNU/Linux, or as I’ve recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.

Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called “Linux”, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.

There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine’s resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called “Linux” distributions are really distributions of GNU/Linux.

Daniel

Yes, Jon, we are all aware of the difference between “Linux” and “GNU/Linux”, but for the sake of simplicity, we all call it “Linux”. It may be noted that, although more fair, “GNU/Linux” is kind of a weird spelling formula, so, the popularized, although less fair, “Linux” is easier for the informal talking and more appealing for the massive spreading of our GNU/Linux passion.

Márcio Guerra

This is a nice information. Thank you! I’m a Linux user, apparently I’m a GNU/Linux Peppermint user, right?

Cheers.

Márcio Guerra

Varun Priolkar

not again..

Doc

“There are a handful of advantages and disadvantages to this approach of installing hardware” software Oops…although technically, if you’re downloading drivers, it’s hardware as well.

Danny Stieben

Definitely oops! Must’ve been distracted there for a moment. :P

Chris Hoffman

This used to be awfully popular for the Linux geeks on the desktop back in the day, but I haven’t heard about it in a long time.

Fun fact: Apparently Chrome OS is based on Gentoo!

Apopas

Back, before X86_64 dominates the desktop, the distributions was compiled for i386 and very few for i586. With Gentoo you could have a dedicated i686 or even specific athlon system that gave a huge boost in performance.
With X86_64 the boost you get from specific CPU flags does not come with a huge impact in performance and thus Gentoo lost a lot of its followers

Mike

Excellent Distro.

For newbies who want to learn about the philosophy behind it I would recommend trying Calculate Linux and/or Sabayon first …

Danny Stieben

Great tips, Mike!

Mart Küng

I tried to install it on my netbook, but never got the graphical system working. I’m sure it was actually doable, but I just gave up as it took too much time. Tought i have been thinking about giving it another try on virtualbox.

Danny Stieben

I’d definitely recommend trying anything in VirtualBox first. Saves a lot of time, especially if you need that machine for something.

Jeff Horelick

So there are some inaccuracies in this article. First off, Gentoo is NOT GUI centric. We do have the standard linux Desktop Environments (KDE, XFCE, LXDE, GNOME (2 AND 3)) available, many Window Managers (OpenBox, Awesome, i3, you get the idea) and a GUI package manager, but the GUI package manager is not the recommended way to install software, it’s mostly only there if you’re REALLY hanging on to a GUI.

The BIG advantage to Gentoo is the ability to have a system EXACTLY the way you want it without having to modify package files. For example, on Debian/Ubuntu, Java will pull in half of Xorg, on Gentoo, you just set the -X USE flag and nothing will ever try to install the Xorg components (or you can set it on a per-package basis). For another example, on Archlinux, if you want your Vim compiled with Python, Lua and Ruby scripting support, you have to install Gvim which pulls in a bunch of GTK and Xorg components which you probably do not want on a server. On Gentoo, you can just set the python, ruby or lua USE flags on the non-GUI vim package. On the flipside though, if you never plan on using (say) bluray or dvb (TV Tuner) stuff on your system, but you want mplayer, you can set those USE flags to -bluray and -dvb and not pull in a bunch of extra dependencies to cruft up your system and make mplayer slower that you’ll never use.

Another BIG, BIG feature in Gentoo that was not mentioned is the fact that we have many versions of packages in our repos. If a new version breaks something for you, it is TRIVIALLY easy to go back to the old version (just: emerge =package-oldversion) rather than having to search for an old deb or RPM randomly on the internet and install it by hand and hope everything works.

Now the popular thing, there is a performance gain in Gentoo versus other distros, but it’s only about 10-15% in most cases and in my opinion, if you’re using Gentoo for performance reasons, you’re using it for the wrong reasons.

Also, the compile times are not a HUGE issue. I just got a new laptop with a dual-core 2.4GhZ Core i5 CPU and to get it from the base install to full GNOME only took MAYBE 2 hours. There ARE packages that can take a while (Like Firefox takes about 20 minutes on a Core 2 Quad and LibreOffice is a pretty long compile), but Gentoo offers precompiled binary packages for all those.

The other reasons for using Gentoo are that it is EXTREMELY stable (second to only CentOS/RHEL in my experience) and EXTREMELY secure (Gentoo has a full hardening project).

The biggest hurdle to get over with Gentoo is the install and specifically is compiling the kernel. That can be a huge pain, however you’ll have a more efficient system when you do so and you can use a tool like genkernel to make it a lot easier. If the install or the compiling REALLY bothers you, there is always Sabayon Linux and Calculate Linux, both of which are Gentoo-based and have a binary installer to a Desktop, but you lose some of the advantages of Gentoo that way.

All in all, I think Gentoo is pretty much the perfect distro if you’re willing to get your hands dirty and you want true control of your system.

Fitzcarraldo

I am a Gentoo user and agree with everything you wrote apart from the compile times, to which I would add a caveat.

I also have a reasonably powerful machine (Core i7 CPU Q 720 1.60GHz) and, yes, compile times are not a huge issue on most occasions when I upgrade (‘roll’) the installation (emerge -uvDN world). Actually, even though LibreOffice, Firefox and Thunderbird are available as binary packages as well as source packages in the Portage repositories, my machine is powerful enough so I even merge those three from source rather than merge the binaries (on this machine LibreOffice takes just over 2 hours to install).

However KDE upgrades are still a pain due to the number of packages: three hundred or so KDE packages can take 24 hours or so to install. OK, I don’t have to be sitting at the machine watching this, and usually leave the upgrade running unattended overnight. But, almost invariably, one package fails to build and some investigation is needed, so the whole process can take a long time if I’m unlucky. For example, I kicked off emerge -uvDN world in order to upgrade from KDE 4.9.4 to 4.9.5 (plus upgrade some other packages) on Thursday night, and kdelibs wouldn’t build. The process was finally completed 36 hours later, taking into account the delays while I investigated problems, etc.). So compile times can still be a big issue with Gentoo at times. Personally, I am prepared to put up with it as I like Gentoo a lot and the end result is normally worth it for me, but compile times can still be a pain sometimes.

gregool

I use Gentoo for years now and i could’nt agree more with you Jeff.
If you’re interested in learning things about Linux then Gentoo is really the distro to choose, but yes compile time can get on the way sometimes.
About performances i’m not even sure that there is a gain nowadays, there used to be a slight difference, up to 15% as you said, but today? i’m not that sure, plus the performances could even be worse than in any other distro if you use the wrong compilation options or USE flags.
And to conclude i think that Gentoo still has the best How to’s.

Danny Stieben

Thanks for all the info! I’m sure that would answer some additional questions some readers may have.

Charles Hicks

I learned a lot about Linux using Gentoo as everything is done manually, but after a while, I just didn’t want to spend all the time it took to maintain. Xubuntu, now.

W. Anderson

Danny completely forgot to mention two “Gentoo based” binary distributions for which one can use emerge. One is Sabayon Linux and the other is Calculate Linux. Both are excellent distributions for personal use and/or business, especially not having to compile source.

Danny Stieben

Thanks for mentioning them, but I didn’t forget because this was a Gentoo review. ;)

Ron OHara

I am a long time Gentoo user – and in a past life, built a business selling server appliance hardware generated using it … so flexibility and tailoring is a BIG advantage. Another less obvious benefit is that Gentoo is a rolling distribution, which eliminates the dreaded upgrade cycle of most distributions …..
Currently I use Gentoo for my servers, and Linux Mint for my desktops ….. the compile time overhead is not an issue as far as I am concerned. It is the machine that is using time on that task – not me.

Danny Stieben

I’ve always liked the rolling release model. Not sure why so many other distributions have issues with it.

Chase Calonne

gentoo is a very good distro for learning about linux and how to use command line efficiently. It also lets you use your hardware with its maximum efficiency as well as you make the os as personal and customised for your use as possible.

Beirapadua Greaser

Well after reading all of the above comments, I am definitely not gonna try this one.
yup ,, im pretty sure, :D

Wolfgang Marcos

I have been using linux for years now and I have installed Arch Linux about a week ago (I was a faithful Ubuntero). It was quite a challenge! But now everything is working fine, when I get used to the Arch-hardcore-way I’ll think about getting a spin on Gentoo.

Danny Stieben

Good luck in your ventures!

Mike

For beginners which would want to try Arch I would recommend Archpup. Very small (around 80 MB), fast, lightweight (uses around 50 MB on idle), persistion option enabled (you can save changes when you reboot), frugal install, etc.

Wolfgang

I didn’t know about Archpup, gonna give it a spin, maybe I’ll use it from my USB drive to solve some issues that may arrive =]

Samyak Puri

Gentoo is a good choice for anybody wanting to learn about linux in detail. Also it is a good distro which gives full choice of which software to be installed to the end user. Also as all the sofware is compiled on the end system so it is usually more faster than other distros. Also there is a good irc channel which provides good help for beginners.