- 1 Introduction
- 2 Resources
- 3 Spring 2012
- 3.1 About Gentoo
- 3.2 We Begin!
- 3.3 Networking
- 3.4 Partitioning
- 3.5 Formatting
- 3.6 Mounting
- 3.7 Date
- 3.8 Stages
- 3.9 Installing stage3
- 3.10 Setting up make.conf
- 3.11 Preparing to chroot
- 3.12 Chrooting!
- 3.13 Portage
- 3.14 Emerge the text editor of your choice
- 3.15 Setting your locale
- 3.16 Set your timezone
- 3.17 Running updates
- 4 Spring 2011 Slides
The Gentoo Workshop is intended to broaden interest in Gentoo Linux. Participants learn how to install and maintain Gentoo, such that they will be able to carry out these steps outside of the structured environment of the workshop.
- x86: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml
- amd64: http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml
FAQs and HOWTOs:
Gentoo is a "metadistribution", due to it's nearly unlimited configurability.
All programs, libraries, etc. are compiled from source, similar to LFS. However, Gentoo includes Portage, a tool that automates some compilation tasks.
Gentoo performs marginally better than binary distributions due to compiled programs being tuned to the host machine, but that's not as important as the extremely high degree of control over the system that Gentoo affords.
The cost of this power is complexity and effort. But, it's hard to go back to binary distributions once you grok Gentoo.
- A good backup never hurt anyone :)
- Make sure your machine is connected to the external Clarkson network via ethernet.
- Boot the live cd. All of the defaults should be adequate.
- You are now inside a environment in which you can start building.
- `ping www.google.com` If this works youre networking is setup properly
- ethX is your primary adapter where X the number of your netork card
- `ifconfig` If you see your adapter shows up (ethX) procede to dhcpcd
- `ifconfig -a` This shows all of your network adapters
- `ifconfig ethX up` This makes sure your adapter is enabled
- `dhcpcd ethX` this will attempt to obtain an IP address for ethX
- `ping www.google.com`
For the next few steps, we are assuming you wish to use /dev/sda for your gentoo installation. If you wish to install to a different drive, from here on /dev/sda will be /dev/sdX where X is the letter of the target device
/dev/sda1 /boot ext2 100MB /dev/sda2 swap linux-swap 1-4GB /dev/sda3 / ext4 or xfs the rest
- / is the root of your filesystem
- /boot will store your kernel image(s) and grub (a boot loader)
- swap is how linux uses space on a hard drive as ram. This is usually only used if you run out of physical memory
We will use the `parted` to format the disk.
!!!WARNING!!! The data on /dev/sda will be destroyed
- `parted /dev/sda`
- `mklabel msdos` or `mlabel gpt` This creates the partition table
- `mkpart primary ext2 0MB 100MB` Create the boot partition
- `mkpart primary linux-swap 100MB 2GB` Create a swap partition close to 2GB
- `mkpart primary ext4 2GB -1s` Use the rest of the drive for /
- `p` Verify everthing worked properly
- `q` Exit the utility
- `mkfs.ext2 /dev/sda1`
- `mkswap /dev/sda2`
- `mkfs.ext4` or `mkfs.xfs`
/mnt/gentoo will serve as the location where we will start our build
- `mount /dev/sda3 /mnt/gentoo`
- `mkdir /mnt/gentoo/boot`
- `mount /dev/sda1 /mnt/gentoo/boot`
- `swapon /dev/sda2`
This may seem like a odd time to worry about such things. Tar checks the timestamps on archived files and will holler bloody murder if you try to extract files from the future.
- `date` If this is close to correct, you can move on
- `date MMDDhhmmYYYY`
There are three possible “stages” from which to install Gentoo:
- stage1: closer to LFS, you must compile the entire toolchain from scratch before you can proceed. (no longer supported officially)
- stage2: no longer supported at all
- stage3: the toolchain is provided in a binary form
The stage3 tarball we are about to download contains binaries of GCC and other toolchain utilities. However, you can recompile the entire toolchain to emulate a stage1 install from a stage3. This process will give you a toolchain built for your specific machine by the most recent version of GCC. The downside? It takes about 6 hours if you have a good machine. In the interests of time, we will only do a stage3 install.
We will use a text based web browser (links) to download the necessary files
- `cd /mnt/gentoo/`
- `links http://mirror.clarkson.edu/gentoo/`
- Download "releases/(your architecture)/current-stage3/stage3-i686-______.tar.bz2"
- Download "snapshots/portage-latest.tar.bz2"
- 'q' Exit links
Next we will extract the stage3 and portage tarballs
- `tar xvjpf stage3-*.tar.bz2`
- `tar xvjf portage-latest.tar.bz2 -C /mnt/gentoo/usr`
The stage3 tarball will create the skeleton of a linux system. The portage snapshot contains a recent portage tree, portage is gentoo's interpretation of a "package manager"
Setting up make.conf
/etc/make.conf is portage's main configuration file. It lets you specify information on how portage should build and install pacakges for your system.
CFLAGS are your flags for gcc, CXXFLAGS are your flags for g++
- -O1 lowest optimization
- -O2 safe optimization
- -O3 unsafe optimization
- -fomit-frame-pointer causes programs that don't use a frame pointer to be compiled without one. This can make debugging quite difficult.
- -pipe use pipes to pass files where possible, increased speed, slightly more memory usage
- -march=___ causes optimazation for your processor, see: http://en.gentoo-wiki.com/wiki/Safe_Cflags
gcc and g++ can use mutiple threads to take advantage of computers that have multiple cpu cores.
- MAKEOPTS="-jN" where N is the number of cores + 1
Set mirror info for portage
Preparing to chroot
Copy over DNS info
- cp -L /etc/resolv.conf /mnt/gentoo/etc/
Mount /dev /proc
- mount -t proc none /mnt/gentoo/proc
- mount --rbind /dev /mnt/gentoo/dev
Chrooting allows you to enter the environment you created and run commands as if it is actually running.
- chroot /mnt/gentoo /bin/bash
Setup your environment
- env-update (refresh environment variables)
- source /etc/profile (export new variables)
- export PS1 = "(chroot)$PS1)"
You are now inside your new gentoo installation!
- `emerge` is the command used to install and remove packages
- `equery` is used to find information on a package
- `eselect` is used to configure system parameters like gcc version and kernel version
- `revdep-rebuild` is used to make sure the libraries on your system are in the right version
- `emerge --sync` updates your portage tree
- `emerge -uDN world` updates the entire system
- `emerge -s sl` search for a package called sl
- `eselect kernel list` lists available kernels
Run `emerge --sync`
Emerge the text editor of your choice
- emerge vim
Setting your locale
- uncomment en_US.UTF-8 ...
Set your timezone
- `ls /usr/share/zoneinfo/` list available timezones
- `cp /usr/share/zoneinfo/EST /etc/localtime`
Run `emerge -puDN world` to make sure everything checks out, then run `emerge -uDN world`
To be continued...
Spring 2011 Slides
These slideshow presentations are Copyright © 2011 by Mark Platek and are licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.