Gentoo on Strato (2004.0)
Eine Anleitung zur installation von Gentoo Linux (2004.0) auf einem Strato RootServer
Booten des Strato Nofall-Systems
Die Installation wird über das Notfall-System gestartet, das über den Kundenservicebereich gebootet werden kann. Dannach auf dem Notfall-System per SSH einloggen:
login as: root Sent username "root" root@h129x.serverkompetenz.net's password: BusyBox v0.60.5 (2003.04.02-10:03+0000) Built-in shell (ash) Enter 'help' for a list of built-in commands.
Paritionierung überprüfen
Die Installation des Systems habe ich mit folgender Festplattenaufteilung vorgenommen (das bootable Flag muss für /dev/hda1 unbedingt gesetzt sein):
# fdisk /dev/hda
The number of cylinders for this disk is set to 7476.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/hda: 255 heads, 63 sectors, 7476 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 7 56196 83 Linux
/dev/hda2 8 71 514080 82 Linux swap
/dev/hda3 72 7476 59480662+ 83 Linux
Dateisysteme und Swap vorbereiten
Dateisysteme und Swap werden neu angelegt, um die SuSE-Installation zu löschen.
Zunächst den Swap-Bereich anlegen:
# mkswap /dev/hda2 Setting up swapspace version 1, size = 526413824 bytes
Die Boot-Partition formatieren:
# mke2fs /dev/hda1 ... Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 35 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
Das Journal einschalten und reguläre Filesystemchecks ausschalten:
# tune2fs -j -c 0 -i 0 /dev/hda1 tune2fs 1.27 (8-Mar-2002) Setting maximal mount count to -1 Setting interval between check 0 seconds Creating journal inode: done This filesystem will be automatically checked every -1 mounts or 0 days, whichever comes first. Use tune2fs -c or -i to override.
Das Root-Filesystem formatieren:
# mke2fs /dev/hda3 .. Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 35 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override
Auch hier das Journal einschalten und reguläre Filesystemchecks ausschalten:
# tune2fs -j -c 0 -i 0 /dev/hda3 tune2fs 1.27 (8-Mar-2002) Setting maximal mount count to -1 Setting interval between check 0 seconds Creating journal inode: done This filesystem will be automatically checked every -1 mounts or 0 days, whichever comes first. Use tune2fs -c or -i to override.
Mountpoints anlegen und mounten:
# mkdir -p /mnt/boot # mount /dev/hda3 /mnt # mount /dev/hda1 /mnt/boot
Gentoo Linux Stagefile installieren
In BusyBox ist leider das Kompressionsprogramm bzip2 nicht enthalten. Im folgenden wird eine statische binary von bzip2 unter /tmp abgelegt:
# cd /tmp # wget ftp://sources.redhat.com/pub/bzip2/v102/bzip2-102-x86-linux24 # chmod a+x /tmp/bzip2-102-x86-linux24
Das Gentoo Stagefile nach /mnt installieren:
# cd /mnt # wget http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/releases/x86/2004.0/stages/x86/stage3-x86-20040218.tar.bz2 -O -|/tmp/bzip2-102-x86-linux24 -d |tar xvf -
BusyBox tar kann leider keine Pfade > 100 Zeichen verarbeiten. Im Gentoo Stage3-File befinden sich unter /usr/share/doc/ncurses-5.3-r5/html/ada/ einige (unwichtige) Dateien, die diese Grenze überschreiten und somit nicht installiert werden. Allerdings befindet sich auch eine wichige Datei darunter:
/usr/lib/gcc-lib/i386-pc-linux-gnu/3.3.2/include/g++-v3/i386-pc-linux-gnu/bits/codecvt_specializations.h
Am Besten diese Datei später manuell auf dem laufenden System zurückspielen, sonst kann es zu Problemen beim Compilieren von C++-Sourcen kommen[1].
dev Dateisystem mounten[2]:
# mount -o bind /dev /mnt/dev
proc Dateisystem mounten:
# mount -t proc none /mnt/proc/
Nameserverkonfiguration übernehmen und chroot in das Gentoo Rootverzeichnis:
# cp /etc/resolv.conf /mnt/etc/ # chroot /mnt /bin/bash
Root Passwort setzen:
# passwd New UNIX password: Retype new UNIX password:
Portage Tree Update durchführen:
# emerge sync
Zeitzone setzen:
# ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
Kernelkonfiguration
Linux Sourcen istallieren und Kernelkonfiguration vornehmen:
# emerge vanilla-sources # cd /usr/src/linux # make menuconfig
Folgende Kerneloptionen müssen unbedingt ausgewählt werden:
- CONFIG_EEPRO100=y
- CONFIG_E1000=y
- CONFIG_DEVFS_FS=y
- CONFIG_DEVFS_MOUNT=y
- CONFIG_IDE=y
- CONFIG_BLK_DEV_IDE=y
- CONFIG_BLK_DEV_IDEDISK=y
- CONFIG_IDEDISK_MULTI_MODE=y
- CONFIG_SERIAL=y
- CONFIG_SERIAL_CONSOLE=y
Ältere Server haben eine 100MBit-, neuere eine GigaBit-Ethernetkarte[2]. Kernel kompilieren und installieren:
# make dep bzImage modules modules_install ... # cp arch/i386/boot/bzImage /boot/ # cp System.map /boot/
/etc/fstab editieren:
/dev/hda1 /boot ext3 noatime 1 1 /dev/hda3 / ext3 defaults 0 0 /dev/hda2 none swap sw 0 0 none /proc proc defaults 0 0 none /dev/shm tmpfs defaults 0 0
Netzwerkkonfiguration
net.eth0 zum default runlevel hinzufügen:
# rc-update add net.eth0 default
/etc/conf.d/net editieren:
iface_eth0="dhcp"
Grub Installieren und Konfigurieren
ebuild installieren:
# emerge grub
und für Boot von Festplatte konfigurieren:
# grub grub> root (hd0,0) grub> setup (hd0)
/boot/grub/grub.conf editieren:
timeout 5 default 0 serial --unit=0 --speed=57600 --word=8 --parity=no --stop=1 terminal serial title GNU/Linux root (hd0,0) kernel /bzImage root=/dev/hda3 console=tty0 console=ttyS0,57600
Konfiguration der seriellen Login-Console
Strato bietet einen Zugang zur seriellen Console per SSH an. Der Bootvorgang ist nun über Grub steuerbar.
Damit eine Login auch bei fehlerhafter Netzwerk-Konfiguration möglich ist, sollte man die serielle Console konfigurieren. Folgende Zeile muss in /etc/inittab eingetragen
werden:
# serial console s0:123457:respawn:/sbin/agetty 57600 /dev/ttyS0
Das PAM-Modul pam_securetty erlaubt kein root-Login, falls die serielle Console nicht in /etc/securetty eingeragen ist. Also noch folgende
Zeile in /etc/securetty hinzufügen:
tts/0
Das System booten
Nicht vergessen über den Kundenservicebereich das System für einen normalen reboot zu konfigurieren. Viel Glück:
# reboot
Kritik und Anregungen
Diese Anleitung enstand aus einem Putty-Logfile, das ich während der Installation erstellt habe. Es können durchaus noch einige Fehler enthalten sein. Feedback bitte an gentoo@hoetzel.info
TODOs für diese Anleitung
- Verwendung von
e2label
[1] Besser ein statisch gebundenes GNU-tar verwenden [2] Ein Dankeschön an Ramy Hardan für die Infos
