14. Gentoo installation

I have a bad feeling about this

Congratulations, you’re almost a proper sysadmin.

14.1. Preliminaries

If and only if the description below fits you to the teeth, you’re worthy to continue.

  • You’re a terminal god. You edit files with echo and cat. Tab completion slows you down.
  • The unix file tree scheme hangs over your bed.
  • To pluck fruits you dig a hole.
  • On parties, people want you to fix their mobile.
  • You’ve already partitioned the desk in front of you.
  • You wear sockets in your sandals.
  • The only thing you mount is image-based.
  • You have a pet python named Monty.
  • You surf the internet with wget.
  • Your day-night cycle is rot12 encrypted
  • You read man pages on the toilet.
  • Your machines always halt.
  • The file system of your choice is ZFS. You recommend it to all your friends.
  • You don’t need tobacco to enjoy your pipe.
  • You keep a pet penguin.
  • You think embiggen is a perfectly cromulent word.
  • Your keys are signed (by bruce schneier).

and most importantly:

  • You understand all of the these jokes.

14.2. The quest

Gentoo is a Linux distribution. Unlike Debian or Ubuntu it is created for expert users and tries not to hide details. That’s why it is a demanding but great learning opportunity. Your task seems simple: to successfully install and start Gentoo linux. It’s up to you what you want to install exactly but I’m content with the base system, as far as the Gentoo documentation goes.

14.3. Your inventory

Before you start, there’s some things you don’t know yet about programming. No, you don’t have to learn a programming language. But since Linux heavily builds upon programs written in C/C++ these languages have some influence.

Normally, the computer cannot execute program code the way humans write it. An intermediate step is required which translates the source code (what the developer writes) into machine code (which the computer can execute). This step is called compilation. The compiled code cannot be read by a human anymore [1]. In this step, the program can heavily be optimized. You can decide which components and features that are taken into the program and you can specify on which platform and in what environment the program will eventually run.

In Debian, the software is delivered in binary form. Meaning that someone else did the compilation for you with best intentions. In Gentoo, you compile everything yourself. And I mean everything. This goes so far that you can compile and hence optimize the compiler itself and then recompile the whole system with the optimized compiler. Yes, that’s confusing. But not to worry, the compilation is in large parts taken care of by the Gentoo’s package management system (portage).

The program which does the compilation is gcc (Gnu C Compiler). You can install it on Debian as well but probably will only do so if you install programs from sources (you can also do so on Debian) or write programs yourself. When you read about CFLAGS and CXXFLAGS, that’s options to gcc. Just pick the defaults if you don’t understand exactly what they do. You’ve learnt about libraries already, so these also exist on Gentoo. You might come accross the term multilib, that’s a system where you have libraries for the 32 bit CPU as well as a 64 bit CPU. Also the term glibc might appear once in a while. That’s the library which provides the most basic functionality. Like reading and writing files or printing text to the screen. Compiling it will take quite some time.

Also, some tips about kernel compilation: Try to create one yourself instead of genkernel. It’s harder but you’ll learn a lot about it. The major problem with the kernel is that you’ll need to have all the device drivers in it, otherwise your system won’t start. So you need to find out which devices your computer contains exactly. It’s usually not required to know the exact chipset or alike. The manufacturer or other vague information often suffices. But you need to know what types of hardware (on what type of bus is your hard disk attached?) you have. The following tools will help you:

lshw Shows a list of your hardware. It’s a good starting point to see what’s there and by which manufacturer. lsmod Shows you what modules have been started by the live system. If you’ve included these ones, your system will probably run or the error is not with the device drivers. lspci Lists devices on the PCI bus. That’s usually network adapters, graphics cards and ata/ide drivers. Use the -v or -k options to see what kernel modules

There will be much more knowledge required than was explained in this tutorial. So the best advice I can give you is: Use the internet. There are many tutorials, howtos, mailing lists and forums answering all the questions you might have. Use this resource and on the way you’ll learn how to pose questions and enter searches - which will help you so much later on.

14.4. Getting started

You need three parts

  1. The gentoo live system.
  2. The gentoo installation documentation.
  3. A virtual machine.

You’ll install Gentoo in a virtual machine - that’s probably the easiest way to experiment. Download the live system. Create a new virtual machine with some disk space (10G should be sufficient) and use the live system as boot medium. Open the the Gentoo installation manual in the browser.

Then start the virtual machine.

Good luck and for the sake of us all: Go bravely with Anhur.

14.5. While your compiling

Here’s a couple of good books:

[1]well, you can try and in theory it’s possible but extremely difficult for any program larger than a couple of lines of source code).