Hallo zusammen,

für die neue Installation meines Rechners habe ich eine Rennliste für die 
Installation von Gentoo erstellt (s. u.). Sie orientiert sich an der 
Erstinsallation für Beginner. Sie könnte also auch für alle die interessant 
sein, die das erste mal eine Gentoo Installation durchführen wollen und noch 
nicht so genau wissen, was alles zu tun ist. Ziel der Liste ist es, vor der 
Installation zu wissen was zu tun ist und ggfs. Änderungen vorzunehmen bevor 
die eigentlichen "physischen" Arbeiten beginnen. Das erscheint mir sinnvoller, 
als ein halb fertiges System ggfs. runterfahren zu müssen, weil ich irgendwo 
hängen bleibe.

Die Rennliste enthält folgende Prämissen:

1. Installation auf Intel G4400 Prozessor.
2. Nutzung von UEFI und GPT.
3. 64-Bit System (Multi-Arch).
4. Automatische Kernel Generierung.
5. Deutsche Lokalisierung (auch wenn die Rennliste auf Englisch ist :) ).
6. Verwendung von DHCP, Grub 2, sysklogd.
7. Festes Repository Server (halifax.rwth-aachen.de).

Zur Rennliste habe ich folgende Fragen (alle mit "TODO" gekennzeichnet):

-- Partitionierung --
Kann ich bei (parted) unit mib einfach die GB mit 1000 Einheiten bezeichnen?
-- schnipp --
(parted) mkpart primary 259 10259 
-- schnipp --

-- File System Generierung --
Ist mkfs.vfat für fat32 korrekt?
-- schnipp --
mkfs.vfat /dev/sda2 
-- schnipp --

-- Compiler Optionen --
Wie finde ich die richtigen Einstellungen für meinen Prozessor?

-- Betreten des neuen Systems --
Muss ich die Verzeichnisse hier anlegen bevor ich sie mounte?

-- schnipp --
mkdir /mnt/gentoo/proc
mkdir /mnt/gentoo/sys
mkdir /mnt/gentoo/dev
-- schnipp --

-- USE Flags --
Kann ich die USE Flag einfach so übernehmen?
-- schnipp --
emerge --info | grep ^USE >> /etc/portage/make.conf 
-- schnipp --

-- Locale --
Ist das die richtige Bezeichnung für DE UFT-8?
-- schnipp --
de_DE.UFT-8 UFT-8
-- schnipp --

-- Boot Loader --
Benötige ich das hier für die korrekte Boot Loader Installation bei gewähltem 
Partitionslayout?
-- schnipp --
mkdir /bootloader
mount /dev/sda1 /bootloader
grub-install --target=x86_64-efi --efi-directory=/bootloader
-- schnipp --

-- Desktop --
Wie installiere ich den gewünschten Desktop (MATE, XFCE)?

Ich freue mich über Eure Antworten.

Viele Grüße

Georg

-- schnipp --

# Install Gentoo: A Step-by-Step Instruction

# Source
# https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation/de
# https://wiki.ubuntuusers.de/wget/
# https://gentoo.org/downloads/mirrors/
# https://wiki.gentoo.org/wiki/Profile_(Portage)

# Remarks
# Placeholders are marked with <placeholder-description> .

# Plug-in network cable
# Insert Install Disc
# Switch machine on
# Select boot menu and choose UEFI as BIOS instead of BIOS

# Kernel Choice: gentoo
# Hardware Options: acpi=on doscsi docache 

# Boot AND immediately press Alt+F1 to select on non-US keyboard map

# Set Root Password
passwd

# Create User
# -m : create home dir
# -G : add user to group
useradd -m -G users <username>
passwd <password>

# Read Gentoo docs (as soon as internet connection is established)
# Alt+F2
links https://wiki.gentoo.org/wiki/Handbook:AMD64/de

# Determine Interface Names
ifconfig
# Alternative: ifconfig (for all devices (up AND down))
# ifconfig -a 
# Alternative
# ip addr

# Test Network
## Ping DNS Server of Internet Provider
cat /etc/resolv.conf
ping <address-of-internet-provider>

## Ping Any Web Site
ping -c 3 www.gentoo.org

# If network does not operate read
# https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Networking/de

# Partition Disc 
## INFO: GPT will be used as partition format
## Partition Schema
### Partition | File System    | Size         | Description
### 
----------|----------------|--------------|-------------------------------------------------------
### /dev/sda1 | (bootloader)   |   2 MB       | BIOS boot partition
### /dev/sdb2 | vfat for UEFI  | 256 MB       | Boot/UEFI systems partition
### /dev/sdb3 | (swap)         |  10 GB       | Swap partion (at least as big 
as RAM) for hiberantion)
### /dev/sdb4 | ext4           | Rest of Disc | Root partition

## Create Partitions
## -a optional : use optional partition alignment (recommended)
parted -a optional /dev/sda1
### Remove all existing partitions
(parted) rm x  # x = number of partition
### Make GPT label
(parted) mklabel gpt
### Tell gparted to use MB as unit size
(parted) unit mib
### Create 1st partition
(parted) mkpart primary 1 3
(parted) name 1 bootloader 
(parted) set 1 bios_grub on 
(parted) print 
### Create 2nd partition
(parted) mkpart primary 3 259
(parted) name 2 uefiboot
### Create 3rd partition
(parted) mkpart primary 259 10259  # TODO: correct ?
(parted) name 3 swap
### Create 4th partition
(parted) mkpart primary 10259 -1
(parted) name 4 root
### Check partitions
(parted) print
(parted) quit

# Create File Systems
mkfs.vfat /dev/sda2  # TODO: correct for vfat ?
mkfs.ext4 /dev/sda4
mkswap /dev/sda3
swapon /dev/sda3

# Mount File Systems
mkdir /mnt/gentoo
mount /dev/sda4 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda2 /mnt/gentoo/boot
mkdir /mnt/gentoo/tmp
chmod 777 /mnt/gentoo/tmp

# Download Stage3 tarball
cd /mnt/gentoo
wget -v 
http://ftp.halifax.rwth-aachen.de/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20170316.tar.bz2
tar xvjpf stage3-*.tar.bz2 --xattrs

# Compiler Options
## My processor supports
## MMX, 
## SSE, sSE2, SSE3, SSSE3, SSE4, 
## AES, AIVX, AVX2, 
## BMI, F16C, FMA3, EM64T, 
## Hyper Threading, NX/XD, TBT 2.0,
## VT-x
## Set Compiler Options
## TODO: How to find the correct compiler options for my system ?
cp /mnt/gentoo/usr/share/portage/config/make.conf.example 
/mnt/gentoo/etc/portage/make.conf
nano /mnt/gentoo/etc/portage/make.conf
(nano) CFLAGS="-march=native -O2 -pipe"
# Use the same settings for both variables
(nano) CXXFLAGS="${CFLAGS}"
(nano) MAKEOPTS="-j2"
(nano) CTRL+X

# Choose Mirror Server
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf

# Create Main Gentoo Repository
mkdir /mnt/gentoo/etc/portage/repos.conf
cp /mnt/gentoo/usr/share/portage/config/repos.conf 
/mnt/gentoo/etc/portage/repos.conf/gentoo.conf

# Copy DNS Information
cp -L /etc/resolv.conf /mnt/gentoo/etc/

# Mount File Systems
# TODO: Do I have to create the directories first ?
mkdir /mnt/gentoo/proc
mkdir /mnt/gentoo/sys
mkdir /mnt/gentoo/dev
mount -t proc proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev

# Enter new Gentoo Environment
chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"

# Mount Boot Partition
mkdir /boot  # TODO: Shold already be there (see: # Mount File Systems)
mount /dev/sda2 /boot

# Configure Portage
## Get Portage Snapshop
emerge-webrsync
## If an error occurs telling /usr/portage directory is missing,
## do nothing, directory is created.

## If updates are requested, ignore until the end of the installation.

# Select Installation Profile
## Although the system is used as a server,
## a desktop shall be present for convenience.
eselect profile set default/linux/amd64/13.0/desktop
emerge --ask --update --deep --newuse @world
## TODO: How can MATE, XFCE be installed?

# Configure USE Variable
## Show Current Profile
emorge --info | grep ^USE
## Show All Available Profiles
less /usr/portage/profiles/use.desc
## Add current USE flag definition to selected profile
emerge --info | grep ^USE >> /etc/portage/make.conf  # TODO: correct ?

# Configure Timezone
## Show available timezones
ls /usr/share/zoneinfo
## Select Timezone
echo "Europe/Brussels" > /etc/timezone
## Update Timezone Info
emerge --config sys-libs/timezone-data

# Generate Locales
nano -w /etc/locale.gen
(nano) en_US ISO-8859-1
(nano) en_US.UTF-8 UTF-8
(nano) de_DE ISO-8859-1
(nano) de_DE@euro ISO-8859-15
(nano) de_DE.UFT-8 UFT-8  # TODO: correct ?
(nano) CTRL+X

locale-gen
locale -a

# Set System-wide Locale
eselect locale list
nano -w /etc/env.d/02locale
(nano) LANG="de_DE.UTF-8"
(nano) LC_COLLATE="C"
(nano) CTRL+X 

env-update && source /etc/profile && export PS1="(chroot) $PS1"

# Install Sources
emerge --ask sys-kernel/gentoo-sources
ls -l /usr/src/linux

# Configure Kernel (using genkernel)
emerge --ask sys-kernel/genkernel
## genkernel reads in the /etc/fstab configuration
nano /etc/fstab
(nano) dev/sda2 /boot   ext2    defaults        0 2
(nano) CTRL+X 
## Generate Kernel
genkernel all
## Save Kernel and initramfs file names for later use
ls /boot/kernel* /boot/initramfs* >> kernel_info.txt

# # Configure Kernel Modules
find /lib/modules/<Kernelversion>/ -type f -iname '*.o' -or -iname '*.ko' | less
nano -w /etc/conf.d/modules
(nano) modules=<name-of-kernel-module>
(nano) CTRL+X 

# Install Firmware
emerge --ask sys-kernel/linux-firmware
# TODO: How do know which firmware modules I need?
# TODO: How do I find the correct modules for my hardware?

# Configure Filesystem Mount Points
## System runs on SSD
mv /etc/fstab /etc/fstab.orig
touch /etc/fstab
echo "/dev/sda2   /boot          vfat   defaults,noatime,discard      0  2" >> 
/etc/fstab
echo "/dev/sda3   none           swap   sw                            0  0" >> 
/etc/fstab
echo "/dev/sda4   /              ext4   defaults,noatime,discard      0  1" >> 
/etc/fstab
echo "/dev/cdrom  /media/cdrom   auto   noauto,user                   0  0" >> 
/etc/fstab

# Set Network Information
## Set hostname
mv /etc/conf.d/hostname /etc/conf.d/hostname.orig
touch /etc/conf.d/hostname
echo "hostname='<hostname>'" >> /etc/conf.d/hostname

##      Set domain name
mv /etc/conf.d/net /etc/conf.d/net.orig  # TODO: correct ? Can I move it 
completely or is appending better ?

## Set Greeting Message
mv /etc/issue /etc/issue.orig
touch /etc/issue
echo "Welcome to $hostname !" >> /etc/issue

# Configure Network
## Examples: /usr/share/doc/netifrc-*/net.example.bz2 
emerge --ask --noreplace net-misc/netifrc
mv /etc/conf.d/net /etc/conf.d/net.orig
touch /etc/conf.d/net
echo "config_eth0='dhcp'" >> /etc/conf.d/net
echo "config_eth1='dhcp'" >> /etc/conf.d/net
echo "config_eth2='dhcp'" >> /etc/conf.d/net
echo "config_eth3='dhcp'" >> /etc/conf.d/net

## Start Network at Boot
cd /etc/init.d
ln -s net.lo net.eth0
rc-update add net.eth0 default
rc-update add net.eth1 default
rc-update add net.eth2 default
rc-update add net.eth3 default

# If after booting the system we find out that the assumption 
# about the network interface name (which is currently documented 
# as eth0) was wrong, then execute the following steps to rectify this:
#
# Update the /etc/conf.d/net file with the correct interface name 
# (like enp3s0 instead of eth0).
# Create new symbolic link (like /etc/init.d/net.enp3s0).
# Remove the old symbolic link (rm /etc/init.d/net.eth0).
# Add the new one to the default runlevel.
# Remove the old one using rc-update del net.eth0 default.

# Configure Network Environment
mv /etc/hosts /etc/hosts.orig
touch /etc/hosts
echo "127.0.0.1  <hostname>.milkyway  <hostname>  localhost" >> /etc/hosts

# Set Root Password
passwd

# Init and Boot Configuration
nano -w /etc/rc.conf
nano -w /etc/conf.d/keymaps
nano -w /etc/conf.d/hwclock

# System Logger
emerge --ask app-admin/sysklogd
rc-update add sysklogd default
emerge --ask app-admin/logrotate

# Cron Daemon
emerge --ask sys-process/cronie
rc-update add cronie default

# File Indexing
emerge --ask sys-apps/mlocate

# Remote Access
rc-update add sshd default

# File System Tools
emerge --ask sys-fs/dosfstools

# Networking Tools
## DHCP Client
emerge --ask net-misc/dhcpcd

## Boot Loader
echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf
emerge --ask --verbose sys-boot/grub:2
mkdir /bootloader
mount /dev/sda1 /bootloader
grub-install --target=x86_64-efi --efi-directory=/bootloader  # TODO: correct ?

## Configure the Boot Loader
grub-mkconfig -o /boot/grub/grub.cfg

# Prepare for Re-Boot
## umount in chroot environment
umount /bootloader
umount /boot

## Lease chroot environment
exit

## unmount in Live System
cd
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount /mnt/gentoo{/boot,/sys,/proc,}
reboot

# Eject the CDROM
# Re-Boot the System

# Add Ordinary Users
useradd -m -G users,wheel,audio -s /bin/bash <username>
passwd <username>

echo "FINISH !"

_______________________________________________
Trolug_trolug.de mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/trolug_trolug.de

Antwort per Email an