We are still actively working on the spam issue.

Gentoo

From InstallGentoo Wiki
Revision as of 01:07, 27 August 2015 by Dankmemerton (talk | contribs) (Instructions For Installing Gentoo)
Jump to: navigation, 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

I learned to install Gentoo from this great tutorial whose instructions stopped working in late 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.

Here we go!

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.) 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. qto 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. 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, GNOME, LXDE, or any other DE/WM. 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 and save it. genkernel all (this literally takes like an hour and 40 minutes on my dual core 2.66 ghz computer, so find something to do.) 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, change /dev/SWAP to /dev/sda3. Exit and save it with CTRL-X. cd /etc/init.d Before this next part run ifconfig. For me, and I think maybe a lot of people what is normally eth0 for the ethernet cord is enp0s25 or some other random variation of that. Wireless is usually wlp3s0. You should be able to tell what your ethernet card 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. It will say "localhost" as your device name.

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.)

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.

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) and Firefox.

Before you install XFCE you will need to install X.org.

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

There's a line that says USE=bindist or something close. We'll add on to that all of that stuff, with the quotation marks. Do CTRL-0 to save and CTRL-X to exit.

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.

Now, run: emerge --ask xorg-server

After 5 hours has passed (depending on your processor speed) and it looks like X.org is done compiling, do startx and see what happens.

Next you should emerge XFCE, 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.

You can now start using Gentoo!