User:Pavlix/Install

In this page I collect my slightly different ways of installing Gentoo for various environments. I'm maintaining it for myself, so feel free to read it but don't forget that there's official documentation.


 * Handbook:Main_Page
 * http://www.gentoo.org/doc/en/gentoo-x86-quickinstall.xml

PXE
Upstream status:


 * PXE images not distributed
 * PXE documentation uses NFS, not squashfs, entirely wrong for a live system

Manual way:


 * grub2-mknetdir -v --net-directory=/tftproot
 * download install-amd64-minimal-20141204.iso
 * mount the iso
 * modify initrd and merge in squashfs
 * create grub.conf

Created a script and documented in Gentoo Wiki:


 * gentoo-boot-pxe /tftproot install-amd64-minimal-20141204.iso
 * Installation_alternatives

Publish over tftp:

Configure DHCP server
TODO

Boot the live system
My goal in this section is to get you booted as quickly as possible with a bare minimum of packages installed in the proces.

Note: I recently heard about Stage7 which has a potential of getting you there even faster but I haven't tried it, yet.

Boot
Use PXE boot to start the live system. It may take quite some time and no progress information is displayed by GRUB.

Optional: Obtain remote access
Connect over SSH:

Alternative: SSH without host keys.

Configure and mount storage
Format disks – Single disk laptop:

Format disks – Storage server with four disks:

Don't forget to configure your  with any filesystems including the rootfs.

Optional: Synchronize system time
Bug: The livecd already configures network, I have no idea why it doesn't also update the time.

Install and enter the base system
curl http://ftp.fi.muni.cz/pub/linux/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20141204.tar.bz2 | tar -C /mnt/gentoo -xjp

Get current portage tree
Bug: emerge-webrsync complains about nonexistence of /usr/portage so that it looks as if it failed but it didn't.

Select profile (laptop with systemd)
Set profile (systemd laptop):

Configure and build kernel
Get kernel and initramfs tools (Laptop with systemd):

Note: Classic genkernel has been masked in the systemd profile. Note: lvm2 gets installed as a dependency. Bug: It indirectly hard depends depends on boost which takes ages to build.

Get kernel and initramfs tools (Storage server):

Build kernel and initramfs:

Bug: I had to add  to build the initramfs.

In the menuconfig (laptop): enable systemd support in kernel

systemd wasn't able to learn about the completed cryptsetup.
 * Bug: systemd works without it but cryptsetup/fstab ordering fails! apparently

enable kms by default to get good VT resolution and working X11


 * Bug: xorg won't start otherwise
 * Bug: screen wouldn't go back on after sleep on Lenovo T540p

In the menuconfig (storage server):

No changes needed.

Configure and install bootloader
Install bootloader tools:

Bug: On one of my installations, grub couldn't be installed without running.

Install bootloader (laptop):

Install bootloader (storage server):

Configure bootloader

Reboot
Install tools needed after reboot:

Configure tools needed after reboot:

When using OpenRC:

See also: Network_management_using_DHCPCD

Set root password:

Bug: You need to set the root password to enable the root account even if you're only going to log in remotely. You also need to set it if you want to be able to log in locally in emergency.

Optional: Configure the build system and rebuild all packages
In ancient times, you could opt to install using the stage1 tarball, and would have all packages built with the build configuration you wanted. This is no longer supported by the Gentoo project. With the stage3 tarball installalation you have a good number of packages already built with the default configuration instead.

Warning: The rebuild process can be very time consuming and the optimizations may not even be significant. The default configuration is good enough for many use cases. Setting just the CPU_FLAGS_X86 to at least get advanced CPU features used by some software packages and running  is much faster, though.

Warning: Optimizing to a specific type of CPU may prevent you from easily moving the system to another machine. Default configuration or a broader set of CPUs (e.g.  instead of  ) may help.

Examine the hardware
Examine the system for CFLAGS and learn what gcc thinks about the target platform:

gcc -march=native -Q --help=target emerge --oneshot app-portage/cpuinfo2cpuflags cpuinfo2cpuflags-x86

Configure the build system
Configure CFLAGS and CPU_FLAGS_X86, add $CPU_FLAGS_X86 to USE, remove bindist and cpu flags from USE.

nano /etc/portage/make.conf

Rebuild all packages
It is the easiest way to get a system built with the above configuration but it may take a lot of time depending on your hardware. It is a good idea to clean up unnecessary packages before and after the process.

Check for packages with old CFLAGS
The package CFLAGS are stored in.

My output shows a couple of packages with custom, none of them actually built with the old   or anything like that.

Install and configure important gentoo packages
Now that we're not going to rebuild the whole system any more, it is time to add various other packages for everyday use. I'm using package sets to have common sets of packages used accross machines.

Create and install packages
Note: The items that are commented out are either not installable in Gentoo stable environment (which I consider a bug) or not needed on all my systems.

Enable power button on OpenRC systems:

TODO: I'm considering creating an overlay just for the package sets.

Configure remote shell accounts
For each user, create a user account and set a dummy password so that SSH recognizes that the account is not locked and enter the user account using sudo.

In the user account, configure SSH:

Enable bash completion
See also:


 * Bash

Configure printing
Make sure Avahi is running and used per configuration of  if you want to search for printers that support Mulitcast DNS.

Don't forget to adjust the paper size and set your printer as the default printer.

Install and configure virtualization tools
On server:

You will need to rebuild the kernel with appropriate options.

Bug: The libvirt package is not capable of reconfiguring the kernel.

On client:

Bug: Without use flag adaptation it installs more packages. But even with it, there's a lot of dependencies.

See also:


 * http://big-elephants.com/2013-07/creating-virtual-networks-with-kvm-on-gentoo/