Gentoo: Heart of the Beast

Wow, I see a great welcome to my small contributions and it motivates me much more to be able to continue sharing with this beautiful community. I know I have promised a guide of less than 20 steps, but you will have to eat a little craving yet… I just can't start a Gentoo tutorial without stopping to talk about its heart and the very essence of all its power Portage, your package manager. Also, as a loyal Gentoo user, I think it's better entender before repeat, and with this I just want to say that before starting a simple guide how to copy a script (repeat), it is better to know what we do so that later write the script. As the well-known saying:

"Give a man a fish and you will have quenched his hunger for a day, teach him to fish and you will have saved him for life."

Without further ado, let's get started:

What is portage?

Portage, is the Gentoo Linux package manager. Their equivalents in other distributions are apt (Debian and derivatives), yum (Red Hat, SUSE, and derivatives) pac-man (Arch and derivatives)... It is inspired by Ports from FreeBSD, that's because the founder of Gentoo used a FreeBSD season and hence the inspiration and similarity in many ways. It was written in bash at the beginning and emerge (the name of the program that takes care of command line installations) throughout its history it has had a broad bash base and more currently Python to perform its functions.

Why is it important to know this?

Well, like all Linux users, the package manager is your main tool to keep your system functional and operating, it allows you to install, update, remove, and many other things. Portage it is subdivided into various commands that specialize in doing one thing, and doing it well (a popular way of working on UNIX).

The heart of Portage:

Unlike other package managers (at least the ones I've already mentioned before), Portage it bases all its power on a configuration file. This file is inside the path /etc/portage/make.conf . At the moment it is very difficult to explain the intricate system that exists in Gentoo that allows to deliver all the power of the distribution to this file without breaking anything elsewhere, but let's continue that I'll leave that for another post 😉

A look at the heart:

Own. Christopher Diaz Riveros

As you can see, it is not something out of this world, actually, I have other files that are much more specific, but what is here is more than enough to have your Gentoo operational and functional. Let's start reviewing the lines that follow:

CFLAGS / CXXFLAGS:

The first step on our adventure into the heart of Gentoo is the C Flags. These flags allow you to compile C programs (the most basic that a system needs to work) with different types of advantages. As you can see in my configuration, -march = broadweel allows me to use the generation of my processor when compiling my programs. -O2 and -pipe come by default, and if I stop to explain each one it will take me maybe a whole book.

However, here are a few types of -march explained on the Gentoo wiki.

https://wiki.gentoo.org/wiki/Safe_CFLAGS

CHOST:

The CHOST is in charge of showing the default location and type of the compiler, this variable is used in teams that have different types of compilers, such as Arduino fans. For a basic configuration it is not necessary to go into details.

Author's note: Thanks for your input njord, and for sharing your knowledge with the rest of the community 🙂

This system variable does not indicate as such the location of the compiler, rather it indicates to the compiler the architecture of the processor, and optionally the hardware platform, operating system and C library for which the packages will be compiled and although this variable is define globally within make.conf (like everything else that appeared there) nothing prevents packages from being compiled for other architectures.

USE:

The heart of programs, the USE flags of make.conf are universal. By this I mean may be made by each program that has a USE of XAt the moment of being compiled, it will have the X activated. This option is quite useful for those USE flags that you are going to use in many (if not all) of your programs. As you can see, gnome systemd they make my system compile support for these types of programs into whatever software has it as a possibility.

MAKEOPTS:

This is one of the best advantages of fast processors. MAKEOPTS as the name implies, they are options that are added to the statement make that is run when compiling each program. in this case the -j9 it allows me to compile 9 programs at the same time, 1 for each thread on my i7 kernel. A more conservative number is -j5, but even here, the compilation time is reduced quite a bit for each installation.

CPU_FLAGS_X86:

Oh oh… now they must be thinking… what are those numbers? and where or how do I know what to put here? The answer is the very essence of Gentoo 🙂 leverage the community 😉 who have already created a program that works for you. To show this, you just need to install the following program and run it:

Own. Christopher Diaz Riveros

As you can see, it shows me the FLAGS that my processor has and I can copy them to my make.conf file using redirects or writing with nano, vim, or any other text editor 🙂 (You will see how automated everything is in Gentoo 😉)

PORTDIR:

Simply the directory where the root of the ebuilds begins. These are the Bash scripts that allow portage to install programs, but we'll leave that for another post 😉

DISTED:

As Gentoo installs everything from its source, this directory will store all the source code that we are downloading, if you wish you can delete its content from time to time, but there are many other interesting uses for these programs, but that also for another post 😉

VIDEO_CARDS:

Well, as the name implies, the brand of your video card, this prevents you from having to install drivers when installing things like X or Wayland.

LANGUAGE:

A quite comfortable space to be able to add all the languages ​​that you want your system to support, in my case I want to have Spanish from Peru, but more can be added to be able to change if necessary.

INPUT_DEVICES:

The format or driver with which your peripherals work, since I use GNOME, libinput takes care of my touchpad. Another well-known option that is being replaced is synaptics.

TONGUES:

L10N:

Those who know about programming will know why there is nothing in the previous one, but, look at how it works which in many programming languages ​​😉.

These variables allow knowing the language of the installed programs, in my case both English and Spanish are fine.

RUBY_TARGETS:

The TARGETS they show some other rather peculiar Gentoo Linux functionality. It is possible to have different versions coexisting within the same system. This means that I could have Ruby 21, 22, 23 and 24 at the same time and without conflicts, the same as Python, Apache, Tomcat, MariaDB, among many others. This function is called SLOT in our community and it is the subject of a full post, so we will leave it for another opportunity 😉

GENTOO_MIRRORS:

The places where you are going to copy your ebuilds collection, serves in a special way to be able to have access points when synchronizing. I have these two backups, since I download my ebuild list directly from Github, and it is only necessary to do git pull to download (obviously, Gentoo does it for me anyway when I write emerge --sync)

MUCH MORE:

These are not all options make.conf, there are many more, and probably some will allow greater advantages or configurations, but with those it is more than enough to have a functional system 🙂

/ etc / portage:

I present a little of what exists inside this folder, just so that you can get an idea of ​​what remains to be known and what we will see in these days and posts 🙂

Own. Christopher Diaz Riveros

A little more:

Since I can't stop commenting a bit more, I'll go ahead a bit and show you a special part of this folder, the file make.profile. Gentoo profiles allow you to generate specialized settings for each type of user, so it is not necessary for you to write or know all the USEs, or many other things, you can simply choose a profile and start on that one. This is the current list of profiles we have on Gentoo today.

Own. Christopher Diaz Riveros

As you can see, my profile is selected with amd64, a desktop, with GNOME and using systemd. By selecting this profile I make sure that all USE flags and other settings are the minimum required to have my system running, and based on that I make the adjustments. (Surely one or the other believed that he would have to think everything from scratch ... that's a lie here 😉)

As we can see, there are many profiles, and each one with its own benefits.

To end:

Well, another post that is out of my hands for your eyes 🙂 I hope you are already quite impatient with the desire to try Gentoo 😀 so I can feel a greater emotion when creating the installation guide. Greetings to all,


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Eduardo Vieira said

    Very good post series. I'm curious about Gentoo. I currently use Arch with BtrFS and Snapshots as the main operating system. The only thing that stops me is that my current PC is not very powerful (core2duo) and it will take forever to compile all the packages I have. When I buy my next PC I will definitely do some testing with Gentoo.

    Regards!

    1.    chrisadr said

      Hello Eduardo 🙂 thank you very much for your comments, they motivate me a lot, now the next chapter of the series is coming out, and a step closer to the Gentoo installation guide 🙂 I prefer to outline a couple of things before starting that post that will surely help many to install their systems. Cheers!

    2.    paul said

      I was compiling gentoo not many years ago on a p2 at 300mhz with 64 ram. it is not a joke. in a week you have everything ready 😀

  2.   static said

    The truth is that it motivates me to install Gentoo and

    1.    ChrisADR said

      Soon, soon 😉

  3.   njord said

    Piece of post! like the previous ones, except that in this one I will dare to leave you a clarification:

    CHOST -> This system variable does not indicate as such the location of the compiler, rather it indicates to the compiler the architecture of the processor, and optionally the hardware platform, operating system and C library for which the packages will be compiled and although this variable is defined globally within make.conf (like everything else that appeared there) nothing prevents packages from being compiled for other architectures.

    And although you do not ask me, an addition: I think that at this point it would be very good to make it completely clear that the main advantage of using Gentoo (and derivatives) over other distributions, is the possibility of customizing everything, not just your hardware, but also your tastes and philosophies, such as the possibility of installing a 100% functional system without depending on the Poettering bodoques [SystemD, pulseaudio and NetworkManager] (I hope a world war will not be waged here>. <) , replacing them with OpenRC (System init developed by the Gentoo community itself, a real gem if you allow me to express it) (or if you want something more transparent and fast it also supports runit), alsa and wpa_supplpicant, respectively; and to which I say Hallelujah !!! = P

    Regards!

    1.    ChrisADR said

      Wow, thank you very much for the contribution 🙂 as in all places, always learning new things 😀 and yes, I did not specify it in this one, but I should have mentioned that like everything in make.conf, it can specialize much more in separate files or other parts of the system .
      Thanks for the clarification and I am happy to tell you that it is 100% true, the gem of Gentoo is the ability to choose your system, with everything you like and nothing else.
      There are already a few posts about to go out, hopefully the editors will review them 🙂

      1.    ChrisADR said

        I wonder if the editors could provide me with the necessary permissions to add your information at the top 🙂 if they see this, it would be very helpful to deliver quality information 😉 greetings

      2.    lizard said

        I have written you through the gmail chat to your account, read it !!

  4.   forsaken64 said

    Really looking forward to the next post, really looking forward to trying gentoo, hopefully it won't take long, greetings and keep it up.

    1.    ChrisADR said

      I'm very happy that your curiosity is piquing you 😀 that means we are on the right track \ o / greetings and thanks for sharing 🙂

  5.   Mart said

    These posts will definitely serve as a guide, but also to encourage you to install Gentoo.
    I will have as a reference and guide these posts for the future. Because I think I would be more satisfied if I installed Gentoo on a PC with a newer processor. And my current PC is a bit late. While I will continue with Arch Linux.

    1.    ChrisADR said

      Claro Mart 🙂 that's the idea, be comfortable with your computer. I also have a partition with Arch 🙂 and if Gentoo didn't exist I would probably use Arch daily, along with my Kali linux 🙂 More posts will be coming soon and I'm already halfway through the guide 😉

    2.    jolt2bolt said

      Well, for the base system the compilation is not so long and for light desktops (like xfce or mate or lxde) or minimalist window managers (like i3, openbox, fluxbox, awesome, etc.) it is relatively short. Now robust and complete desktop environments (like gnome, kde or cinamon) will take time. Still, Curiously, what takes the most time to compile are web browsers (such as firefox or chrome, but there are less heavy browsers such as qutebrowser or palemoon that could probably take less time) and office automation. That's why gentoo offers binaries for those programs in case you need something functional to solve while the compilation does its thing.

      If you have a dual-core computer, I think it will be enough to compile the system in about 2 or 3 hours (and I mean a few hours if you choose a robust desktop like kde or gnome) but for compiling the browser and office automation I recommend doing it in the night, leaving the pc on doing its thing or use the binaries if you want

  6.   maxlinux2000 said

    now it's the turn to bother gentoo 🙂

    apt-build world

    works on any "debian based" distribution such as ubuntu, mint…. and compiles all the optimized packages for your cpu.

    regards
    MaX

    1.    ChrisADR said

      Hahaha not bothersome at all, it is being able to choose I am delighted if they do it in Debian, but I do not know that world, I come to share what excites me about my distribution 🙂 and how good that the venerable Debian also has its dose of choice 🙂 greetings

    2.    Aurelio said

      He did not know. It sounds really interesting, but tell me what happens with the updates? does apt-build handle all of them, with all their respective dependencies, like Gentoo or do we have to do apt-build manually to all of them? And does apt-build US support Is it like Gentoo?

      Greetings.

      1.    ChrisADR said

        Well, once installed, the updates are with a single command that resolves all the dependencies "emerge –ask –update –deep –newuse @world" or its short version "emerge -avuDN @world" so that it updates all the dependencies at the same time as switch to the most current version of the programs

      2.    maxlinux2000 said

        I don't know if it means debian or gentoo, but for debian it's the classic:

        apt-build update

        apt-build upgrade

        and with this it lowers the list of packages to update, then it downloads the sources, compiles and installs it and everything automatically.

        But of course, there is no better distribution. They're all good. It would be like asking what is the best language.

    3.    Free Quixote said

      Good for that one! 😉

  7.   Aurelio said

    The article is very good, my friend, but I recommend that you avoid gringo expressions that make you grind your teeth, like that horrible "wow" that seems like pure self-conscious third world xD. Let's use our beautiful language, which is very rich and much more perfect and well articulated than the primitive language of the gringos xD. When the hell have we Hispanics barked like a dog ("wow = wow")? xD.
    The article, very interesting. I had a less old and capable computer that would make me want to experiment in the Gentoo world. But with my poor tartan, no more installing the base system would take me several days xD.

    Greetings.

    1.    ChrisADR said

      : / really seems a bit out of place to me. If you are from Spain, then perhaps it is more understandable to me, but here in Latin America English is quite common, and even more so ... as you can imagine when you see the Gentoo developer map (people with whom I deal with all the day) there is no one in South America or Spain ... so much of the day I am speaking in English and some expressions stick ...
      Well, in terms of my way of writing, I would appreciate not putting qualifiers about it, and even more so comparing things 🙂 each language has its advantages and disadvantages, and as Linux everyone is free to choose 🙂
      As for the machine, you will never know until you try it 😉 the compilation process is quite fast for most packages, maybe the heaviest ones like firefox or thunderbird will take a long time, but Gentoo also solves that problem by delivering binary versions (normal style) so compile time is cut down on those heavy programs 🙂 Regards

  8.   fernan said

    Hello:
    More like Larry's heart.
    Greetings.