hello friends! new(ish)!

Gentoo

From InstallGentoo Wiki v2
Jump to navigation Jump to search
Gentoo logo

Gentoo Linux is a source-based GNU/Linux distribution. It has a stigma for being a difficult distribution to use, and is often recommended as a solution to any problem on /g/. After all, if the person asking the question could install Gentoo, they could probably figure out whatever problem they're having in the first place. If you are considering installing Gentoo, the best resource available to you is the Gentoo Handbook.

Differences between Gentoo and other Distros

Gentoo is different than most other Linux distributions, all the way down to how it is installed.

Installation Method

Most other distros include some form of graphical installer. Gentoo is installed by manually partitioning a device, extracting a stage3 tarball, extracting a portage snapshot, compiling a kernel, installing a bootloader, and then configuring various files that are needed to get it up and running. In those regards, it is somewhat similar to installing Debian with debootstrap, Fedora with febootstrap, or an Arch Linux install.

Because of this highly manual approach to installing the system, always keep in mind that installing Gentoo will probably be LITERALLY THE LENGTHIEST SOFTWARE INSTALLATION IN YOUR ENTIRE LIFE. IN FACT, THIS IS WHY WE TROLL UNSUSPECTING NOOBS INTO INSTALLING GENTOO. YOU HAVE BEEN WARNED. So take your time when installing Gentoo, expect the installation to be a wild ride of problems, achievements and milestones, and don't try to rush it. If you're a NEET with literally nothing else to do you might be able to rush a Gentoo installation in at least 24 hours; if you're a busy person with a day job and friends, it might take you over an entire week to set everything up. On a 2014-semi-modern quad core CPU with 8 GB of RAM, setting up the minimum system (the stage-3 tarball + Portage snapshot) will take you about an hour, compiling the kernel an hour and a half (assuming you're cheating with genkernel instead of undertaking a manual compilation and fixing an endless series of kernel panics), finishing your basic installation another hour, installing the graphical interface at least 2 hours (because the GUI is an optional component in Gentoo), and installing Google Chrome or Firefox at least 4 hours each while the entire software compiles from source code. And that's assuming you're the luckiest person in the world and don't run into a single problem, pitfall or having to mess with a poorly documented system component -- if this happens, add at least another 4 hours. Oh, and if you're planning on using a LUKS volume, add another 24 hours while your system fills a 750 GB disk with pseudorandom data using four concurrent jobs to exploit your four CPU cores.

Package Manager

Gentoo's package manager, portage, is more similar to what you will find in BSD than in other Linux distributions. Portage tracks installation scripts, called ebuilds, for almost every package you can imagine by default. These ebuilds contain all the information necessary to automatically download a project's source, compile, and install it. If a package is not available for default, you can add other "repositories" as overlays on top of the default Gentoo overlay.

USE Flags

One of the most prominent features of Gentoo is the ability to custom tailor the features of software via USE flags. USE flags are a handy way of automatically specifying options to a piece of software's configuration script during compile time. For example, it is trivial to blacklist something like PulseAudio by simply including -pulseaudio into your global USE flags. USE flags can be specified globally in /etc/portage/make.conf or on a per-package basis through /etc/portage/package.use

CFLAGS

Typical of building from source, you are able to specify CFLAGS that add additional optimizations to the compiled software, the most common ones being "-O2 -march=native" to specify average-level optimization tailored for whatever CPU your computer has.

Overlays

Additional repositories of ebuilds are known as overlays. It is common practice to have a local overlay for any custom ebuilds you have created or acquired. Overlays are typically managed with the layman utility.

License Enforcement

Portage allows you to specify which licenses you agree with, to prevent any software with other licenses from being automatically pulled in at any point. For example, you can restrict installed software to only that which is FSF approved by including ACCEPT_LICENSE="-* @FREE" into /etc/portage/make.conf

Release Schedule

Gentoo is a rolling-release distribution that allows you to mix channels on a per-package basis. For example, you can maintain a system on the stable channel and selectively install unstable releases, or even compile the latest development releases from Git/SVN/etc. Because of this, Gentoo can be either extremely stable or on the very bleeding edge, depending on how you configure it.

Init System

Gentoo uses OpenRC for its init system. It also gives you the option of using systemd if you so choose.

Related Distributions

Gentoo variants

Like most distros, Gentoo has a few variants that are based off of it.

Funtoo Linux

Funtoo.png

A fork of Gentoo by Gentoo's founder Daniel Robbins. It aim's to correct some issues he sees with Gentoo that he wasn't able to rectify because of internal dispute. It also aims to be slightly easier than Gentoo, and offers more optional preconfiguration by default because of that. To that end, Funtoo ships with ebuilds that support the binary USE flag, allowing users to skip the step of customizing their own kernel if they so desire.

  • Advantages
    • Includes some ebuilds that Gentoo doesn't by default.
    • Initial setup may be slightly easier than Gentoo.
    • Uses Git for portage syncing instead of rsync.
    • Common Gentoo scripts and programs patched with Funtoo specific features (genkernel, portage, rc-update, etc).
  • Disadvantages
    • Funtoo uses an older version of udev than Gentoo, which may cause some compatibility issues with certain software like systemd if you choose to use it. Funtoo now uses eudev by default.
    • Funtoo's ebuilds do not always contain the same features as Gentoo's. For example, some are missing ABI flags. E.g. As of 2014-01-29 Funtoo does not contain tcp-wrappers 7.6.22-r1, which added such support while Gentoo does Funtoo now has up-to-date tcp-wrappers. Having many packages missing that support makes a multilib system with gx86-multilib very difficult.

Sabayon

Sabayon.png

Sabayon is a Gentoo-based distro designed to deliver the best out of the box user experience. It offers an installer with a GUI and provides various DE options. Ships with Entropy and Portage as package managers.

Other

Exherbo

Exherbo.png

Exherbo was created by a former Gentoo developer, incorporating many ideas and concepts from Gentoo.














Instructions For Installing Gentoo

It is currently February 2015 and I made these instructions for installing Gentoo in September 2014. I have no idea how well they will still work. If somebody could test these out that would be great.

I learned to install Gentoo from this great tutorial whose instructions stopped working in June or July 2014. It might be a good idea to watch this video just to get an idea of things, even if you don't follow his instructions: https://www.youtube.com/watch?v=E_vhQg5wDSY This tutorial has several more steps than what I use.

Something that might that might really speed up the process and probably wouldn't hurt to try, which I've never tried, is putting --buildpkg when emerging things, like "emerge --buildpkg firefox", and to see about doing this just control-f for "prebuilt" in the handbook. I have never tried it and Firefox really does take 17 hours to compile for me.

If you type in something wrong during the course of this and you want your computer to stop a process, do control-c. You might have to do it a few times. Just keep doing it until it stops the process.

passwd

parted -a optimal /dev/sda

mklabel gpt

unit mib

mkpart primary 1 3 (since this is only 2 megabytes i add way more to this because my hard drive has way more space than i need. i do 5 gigabytes or something which is probably really unnecessary)

name 1 grub

set 1 bios_grub on

mkpart primary 3 131 (i also make stuff like this 20 gigabytes or whatever)

name 2 boot

mkpart primary 131 643

name 3 swap

mkpart primary 643 -1

name 4 rootfs

print

quit

mkfs.ext2 /dev/sda2

mkfs.ext4 /dev/sda4

mkswap /dev/sda3

swapon /dev/sda3

mount /dev/sda4 /mnt/gentoo

mkdir /mnt/gentoo/boot

mount /dev/sda2 /mnt/gentoo/boot

date

date MonthDayHourMinuteYear

for example august 17 2014 at 12:19 AM

date 081700192014

cd /mnt/gentoo

links http://www.gentoo.org/main/en/mirrors.xml

Go to the server Argonne National Laboratory (http) or whatever

I think go to releases. Get stage3-<InsertDateHere>-bz2 I think.

q to exit

tar xvpjf stage3(at this point hit the tab button and the rest will fill out)

This will take like 10 or 30 minutes or something.

cp -L /etc/resolv.conf /mnt/gentoo/etc/

mount -t proc proc /mnt/gentoo/proc

mount --rbind /sys /mnt/gentoo/sys

mount --rbind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash

source /etc/profile

export PS1="(chroot) $PS1"

emerge-webrsync

emerge --sync

eselect profile list

I just go with the desktop profile and emerge XFCE but you might want to go with kde. Maybe ask /g/ about this. I guess if you don't care then go with kde because it probably runs smoother but I've never used it.

eselect profile set (whatever)

ls /usr/share/zoneinfo

echo "EST" (or whatever) > /etc/timezone

emerge --config sys-libs/timezone-data

emerge gentoo-sources

emerge genkernel

nano -w /etc/fstab

simply change, where it says /dev/BOOT (I think), BOOT to sda2. that's all. exit by pressing control-x (i think) and save it.

genkernel all (this literally takes like an hour and 40 minutes on my dual core 2.66 ghz computer)

nano -w /etc/fstab

change /dev/ROOT to /dev/sda4 and ALSO change ext2 to ext4 because that's what you did earlier with "mkfs.ext4 /dev/sda4". Also i think change /dev/SWAP to /dev/sda3. exit and save it with control x.

cd /etc/init.d

before this next part do ifconfig. for me and i think maybe a lot of people (although my dell laptop might be kind of odd so maybe not), what is normally eth0 for the ethernet cord is enp0s25 or some other random variation of that. you should be able to tell what your ethernet cord is.

ln -s net.lo net.eth0 (for me it would be ln -s net.lo net.enp0s25 so do whatever it is for you)

rc-update add net.eth0 default (again, replace net.eth0 with net.whatever it is for you)

passwd (yes, you need to set another password)

emerge syslog-ng

rc-update add syslog-ng default

emerge dhcpcd

emerge sys-boot/grub

grub2-install /dev/sda

grub2-mkconfig -o /boot/grub/grub.cfg

exit

umount -l /mnt/gentoo/dev

umount -l /mnt/gentoo/sys

umount -l /mnt/gentoo/proc

umount -l /mnt/gentoo/boot

umount -l /mnt/gentoo

reboot

log in as root. i think it will say "localhost" as your name.

i think you should almost always or always log in as a user instead of logging in as root. you should now create a user.

this user will be named jimmy

useradd -m -G users,wheel,audio,cdrom,usb,video,portage -s /bin/bash jimmy

passwd jimmy (here is where you set the password for jimmy)

log in as jimmy whenever you want to use gentoo and when you need to do something as root, simply put in "su" (which stands for super user i think) and then put in the root password and i think you can stay super user for as long as you like. also i think maybe you need to be the user and not the root to start your desktop environment. if you have trouble getting something to work in Gentoo, try it both as user and super user and then if neither of those work then maybe root but after using Gentoo long enough you will probably be able to tell whether it matters.

ok so now you technically have gentoo installed and if you want you can do something like links http://www.wikipedia.org and you can see that you can browse websites with text only.

Now you need to install 3 things to have a working desktop (don't do it before reading these instructions): X or Xorg, a desktop environment (KDE, Gnome or XFCE which i think might be the fastest but also the sparest) and Firefox.

first i'm just going to tell how to install XFCE, you might want KDE or Gnome after couple weeks or months of using Gentoo. it worked well enough for me.

And before you install XFCE I guess you need to install Xorg.

I think maybe it's pretty important to do this before you install Xorg: set your USE flags to "-gnome -kde -minimal -qt4 dbus jpeg lock session startup-notification thunar udev X"

To do that, do this:

nano -w /etc/portage/make.conf

and I think there's a line that says USE=bindist or something close. Well add on to that all of that stuff, with the quotation marks. Do control-x to exit and save.

I think whenever you change your USE flags you then have to do this: env-update

I guess at this point you might want to consider using --buildpkg to just download things instead of compiling it on your computer. I guess the point of Gentoo is compiling it yourself but I doubt someone will try to spy on you with Gentoo.

Then I guess you just do: emerge --ask xorg-server (you don't need to do --ask when you emerge everything)

After 5 hours or whatever has passed and it looks like Xorg is done compiling, do startx and see what happens.

I guess next you should emerge XFCE, apparently by doing "emerge --ask xfce4-meta".

My first time I didn't have a lot of trouble with emerging Xorg and XFCE but Gentoo might have changed. Just Google stuff if you have any problems.

It took 35 hours for me to originally emerge X, XFCE and Firefox. To start all of this, after you have installed it, you simply put in "startx" as the user.

So to repeat, to install stuff with Gentoo you simply do "emerge <insertprogram>" like "emerge firefox" or "emerge gedit".

One thing you should occasionally update Gentoo with is "emerge --sync". Google for other stuff to update with.

The thing is once you have a basic desktop with Firefox and a terminal, when you emerge anything you can still use Firefox or whatever while you wait for it to emerge. Firefox, at 17 hours, took by far the longest to compile out of anything I ever emerged.

I am typing up this guide as somebody who used Gentoo with XFCE for like 7 weeks and really liked it but I am probably in the bottom 20% of Gentoo users as far as knowledge of Gentoo goes.