Vissie's Gentoo Setup

From The World according to Vissie
Jump to navigation Jump to search
    • To change the root password, use the passwd utility:
  • Optional: Starting the SSH Daemon
    • If you want to allow other users to access your computer during the Gentoo installation (perhaps because those users are going to help you install Gentoo, or even do it for you), you need to create a user account for them and perhaps even provide them with your root password (only do that if you fully trust that user).
    • To fire up the SSH daemon, execute the following command:
/etc/init.d/sshd start
    • To login from another PC, just do:
ssh UserName@HostName
  • then run fdisk
fdisk -l

to list all the disks. Select the correct one!

fdisk /dev/hda1
    • We first have to delete all partitions, well if you want to...
p - print info
d - delete partitions
n p 1 <enter> +32M  (for boot partition)
a 1 (to make it bootable)
n p 2 <enter> +512M t 2 82 (for swap)
n p 3 <enter> <enter>
w (to write the changes)
  • Make File System
mke2fs /dev/sda1 (ext2)
mkswap /dev/sda2 (swap)
mke2fs -j /dev/sda3 (ext3)
  • Enable swap
swapon /dev/sda2
  • Create directories and mount
mount /dev/sda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot
  • Install Stage Tarball
    • Check date
    • and to update (MMDDhhmmYYYY syntax (Month, Day, hour, minute and Year))
date 032916212005
    • Downloading the Stage Tarball from the internet
    • Move to the releases/x86/2008.0/ directory. There you should see all available stage files for your architecture (they might be stored within subdirectories named after the individual subarchitectures). Select one and press D to download. When you're finished, press Q to quit the browser.


      • Make sure you download a stage3 tarball - installations using a stage1 or stage2 tarball are not supported anymore.
    • Unpacking the Stage Tarball
cd /mnt/gentoo
tar xvjpf stage3-*.tar.bz2
    • The x stands for Extract, the v for Verbose to see what happens during the extraction process (optional), the j for Decompress with bzip2, the p for Preserve permissions and the f to denote that we want to extract a file, not standard input.
  • Install Portage
    • Fire up links (or lynx) and go to our Gentoo mirror list. Pick a mirror close to you and open the snapshots/ directory. There, download the latest Portage snapshot (portage-latest.tar.bz2) by selecting it and pressing D.
tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
  • Configuring the Compile Options
    • vim /mnt/gentoo/etc/make.conf
      • With MAKEOPTS you define how many parallel compilations should occur when you install a package. A good choice is the number of CPUs in your system plus one, but this guideline isn't always perfect.
  • Installing the Gentoo Base System
    • Update your mirrors link
mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
    • A second important setting is the SYNC setting in make.conf.
mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf
    • Copy DNS
cp -L /etc/resolv.conf /mnt/gentoo/etc/
    • Mounting the /proc and /dev Filesystems
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
  • Entering the new Environment
chroot /mnt/gentoo /bin/bash
>> Regenerating /etc/
source /etc/profile
export PS1="(chroot) $PS1"
    • Congratulations! You are now inside your own Gentoo Linux environment.
  • Updating the Portage tree
emerge --sync
  • Configuring the USE variable
    • As an example we show a USE setting for a KDE-based system with DVD, ALSA and CD Recording support:
vim /etc/make.conf
USE="-gtk -gnome qt3 qt4 kde dvd alsa cdr"
  • Configuring the Kernel
    • Timezone
      • Look for your timezone in /usr/share/zoneinfo, then copy it to /etc/localtime.
cp /usr/share/zoneinfo/GMT /etc/localtime
cp /usr/share/zoneinfo/Europe/Zurich /etc/localtime
    • Installing the Sources
emerge gentoo-sources
ls -l /usr/src/linux
    • Default: Manual Configuration
cd /usr/src/linux
make menuconfig
Processor type and features --->
  (Change according to your system)
  (Athlon/Duron/K7) Processor family
File systems --->
  Pseudo Filesystems --->
    [*] /proc file system support
    [*] Virtual memory file system support (former shm fs)
(Select one or more of the following options as needed by your system)
  <*> Reiserfs support
  <*> Ext3 journalling file system support
  <*> JFS filesystem support
  <*> Second extended fs support
  <*> XFS filesystem support
      • If you have an Intel CPU that supports HyperThreading (tm), or you have a multi-CPU system, you should activate "Symmetric multi-processing support":
Processor type and features  --->
  [*] Symmetric multi-processing suppor
      • If you have more than 4GB of RAM, you need to enable "High Memory Support (64G)".
      • If you use USB Input Devices (like Keyboard or Mouse) don't forget to enable those as well
Device Drivers --->
  [*] HID Devices  --->
    <*>   USB Human Interface Device (full HID) support
      • If you want PCMCIA support for your laptop, don't forget to enable support for the PCMCIA card bridge present in your system:
Bus options (PCI, PCMCIA, EISA, MCA, ISA)  --->
  PCCARD (PCMCIA/CardBus) support  --->
    <*> PCCard (PCMCIA/CardBus) support
 (select 16 bit if you need support for older PCMCIA cards. Most people want this.)
    <*>   16-bit PCMCIA support
    [*]   32-bit CardBus support
 (select the relevant bridges below)
    --- PC-card bridges
    <*> CardBus yenta-compatible bridge support (NEW)
    <*> Cirrus PD6729 compatible bridge support (NEW)
    <*> i82092 compatible bridge support (NEW)
    <*> i82365 compatible bridge support (NEW)
    <*> Databook TCIC host bridge support (NEW)
      • Do not turn off kernel framebuffer support as it is required for a successful boot. If you are using an NVIDIA based chipset, you should use the Open Firmware framebuffer.
Device Drivers --->
  Graphics support --->
    <*> Support for frame buffer devices
make && make modules_install
      • When the kernel has finished compiling, copy the kernel image to /boot. Use whatever name you feel is appropriat.
cp arch/i386/boot/bzImage /boot/kernel-2.6.24-gentoo-r5
    • Kernel Modules
      • You should list the modules you want automatically loaded in /etc/modules.autoload.d/kernel-2.6
      • For instance, to automatically load the 3c59x.ko module, edit the kernel-2.6 file and enter the module name in it. "3c59x"
find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko'
nano -w /etc/modules.autoload.d/kernel-2.6
  • Configuring your System
    • Filesystem Information
      • Create /etc/fstab
vim /etc/fstab
/dev/sda1   /boot        ext2    defaults,noatime     1 2
/dev/sda2   none         swap    sw                   0 0
/dev/sda3   /            ext3    noatime              0 1
/dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0
      • To improve performance, most users would want to add the noatime mount option, which results in a faster system since access times aren't registered (you don't need those generally anyway).
    • Networking Information
vim /etc/conf.d/hostname
    • Setting the domainname
vim /etc/conf.d/net
(Set the dns_domain variable to your domain name)

In addition, remove string .\O from file /etc/issue to get rid of the annoying unknown_domain in the welcome message "This is host.unknown_domain ...".

      • DHCP is used by default. For DHCP to work, you will need to install a DHCP client. This is described later in Installing Necessary System Tools. Do not forget to install a DHCP client.
vim /etc/conf.d/net
      • To have your network interfaces activated at boot, you need to add them to the default runlevel.
rc-update add net.eth0 default
    • System Information
      • Optional: Get PCMCIA Working
emerge pcmciautils
      • Root Password
      • System Information
        • Gentoo uses /etc/rc.conf for general, system-wide configuration. Open up /etc/rc.conf and enjoy all the comments in that file :)
      • UNICODE specifies whether you want to have UNICODE support in the console. If you set to yes, please make sure to set a UNICODE aware CONSOLEFONT and KEYMAP in the /etc/conf.d/consolefont and /etc/conf.d/keymaps config files.
vim /etc/rc.conf

Gentoo uses /etc/conf.d/keymaps to handle keyboard configuration. Edit it to configure your keyboard.

vim /etc/conf.d/keymaps
      • For Swiss Frensh use /usr/share/keymaps/i386/qwertz/ So just add "fr_CH" or "fr_CH-latin1"
vim /etc/conf.d/clock
  • Installing Necessary System Tools
    • System Logger
emerge syslog-ng
rc-update add syslog-ng default
    • Optional: Cron Daemon
emerge vixie-cron
rc-update add vixie-cron default
    • Optional: File Indexing
emerge slocate
    • File System Tools
      • Please note that tools for managing ext2/ext3 filesystems (e2fsprogs) are already installed as a part of the system.
    • Networking Tools
emerge dhcpcd
  • Configuring the Bootloader
    • Optional: Framebuffer
      • If you have configured your kernel with framebuffer support (or you used genkernel default kernel configuration), you can activate it by adding a vga and/or a video statement to your bootloader configuration file.
      • First of all, you need to know what type of framebuffer device you're using. If you use a Gentoo patched kernel tree (such as gentoo-sources) you will have had the possibility of selecting uvesafb as the VESA driver. If this is the case, you are using uvesafb and do not need to set a vga statement. Otherwise you are using the vesafb driver and need to set the vga statement.
    • The result of those two statements could be something like vga=0x318 video=vesafb:mtrr:3,ywrap or video=uvesafb:mtrr:3,ywrap,1024x768-32@85. Write this setting down; you will need it shortly
    • Default: Using GRUB
emerge grub
vim /boot/grub/grub.conf
  # Which listing to boot as default. 0 is the first, 1 the second etc.
  default 0
  # How many seconds to wait before the default listing is booted.
  timeout 30
  # Nice, fat splash-image to spice things up :)
  # Comment out if you don't have a graphics card installed
  title Gentoo Linux 2.6.24-r5
  # Partition where the kernel image (or operating system) is located
  root (hd0,0)
  kernel /boot/kernel-2.6.24-gentoo-r5 root=/dev/sda3
  title Gentoo Linux 2.6.24-r5 (rescue)
  # Partition where the kernel image (or operating system) is located
  root (hd0,0)
  kernel /boot/kernel-2.6.24-gentoo-r5 root=/dev/sda3 init=/bin/bb
      • Setting up GRUB using grub-install
grep -v rootfs /proc/mounts > /etc/mtab
grub-install --no-floppy /dev/sda
    • Rebooting the System
umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
  • If you get the “One of the files in /etc/{conf.d,init.d} or /etc/rc.conf has a modification time in the future”-error. So here is some help, then posibly the files in /etc/conf.d and /etc/init.d had no timestamp (you can check with ls -lR). You can solve this by a hearty:
touch /etc/{conf.d,init.d}/*; touch /etc/rc.conf.
  • Finalizing your Gentoo Installation
    • User Administration
      • To see a list of groups
      • To create a user:
useradd -m -G users,wheel,audio -s /bin/bash snakeskin
passwd snakeskin or su snakeskin, then passwd
    • Disk Cleanup
rm /portage-latest.tar.bz2*
rm /stage3-*.tar.bz2*