Gentoo installation

From OpenSource-WiKi

Jump to: navigation, search

Contents

Introduction

This page dedicates on Gentoo installation on Laptops like

  • IBM T41/T42 (written 08-jun-2008)
  • HP 430 (written 26-aug-2009)
  • Lenovo G550 (written 05-oct-2010)
  • Desktop (written 10-aug-2011)

but should be usable for other models of laptops too.

Boot using Gentoo LiveCD

If you want to work on text mode, type

gentoo-nofb nox nosound

at the boot prompt.

Setup Network Interface

DHCP

DHCP is enabled by default, revert to Manual settings if dhcp does not work

Manual Setting

ifconfig eth0 xxx.xxx.xxx.xxx netmask 255.255.255.0
route add default gw xxx.xxx.xxx.xxx
vi /etc/resolv.conf
File: /etc/resolv.conf
 search wlink.com.np
 nameserver 202.79.32.4

Create partitions using fdisk,plan your partation

fdisk -l
fdisk /dev/sda

Fdisk Template

/dev/sda1             50G  HPFS/NTFS           C:\
/dev/sda2             20G  Unknown             Leopard
/dev/sda3     /boot   200M Linux
/dev/sda4             80G  Extended Partition
/dev/sda5     /       15G  Linux
/dev/sda6     swap    2G   Linux Swap
/dev/sda7             24G  FAT32                D:\
/dev/sda8             40G  HPFS/NTFS            E:\

Format your Partitions using mkfs.ext3

mkfs.ext3 -j /dev/hdax

Format Swap partition and mount it

mkswap /dev/sda6
swapon /dev/sda6

Mount the partitions to /mnt/gentoo

mount /dev/sda5 /mnt/gentoo
mkdir /mnt/gentoo/boot
mkdir /mnt/gentoo/proc
mount /dev/sda3 /mnt/gentoo/boot

Start the installation using Stage3

Download the stage3 snapshot from the internet OR use one from CD

For IBM T41/T42, HP 540

http://gentoomirror.wlink.com.np/releases/x86/current-stage3/
wget http://gentoomirror.wlink.com.np/releases/x86/current-stage3/stage3-i686-20090908.tar.bz2

For Lenovo G550

http://gentoomirror.wlink.com.np/releases/amd64/current-stage3/
wget http://gentoomirror.wlink.com.np/releases/amd64/current-stage3/stage3-amd64-20100930.tar.bz2
mkdir /mnt/gentoo/INSTALL
cd /mnt/gentoo/INSTALL
 tar -xvjpf stage3*.tar.bz2 -C /mnt/gentoo

Install the Portage

Download the portage snapshot from the internet OR use one from CD

http://gentoomirror.wlink.com.np/snapshots/
wget http://gentoomirror.wlink.com.np/snapshots/portage-latest.tar.bz2
tar -xvjf portage*.tar.bz2 -C /mnt/gentoo/usr
mkdir /mnt/gentoo/usr/portage/distfiles
cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles

Configure the Compile Options

vi /mnt/gentoo/etc/make.conf

Contents of make.conf file

For IBM T41/T42

File: /etc/make.conf
# For IBM T41/T42
CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
MAKEOPTS="-j1"

VIDEO_CARDS="radeon"

# Step 1
USE="acpi alsa automount crypt sqlite tcpd threads tcpd -xulrunner"

# Use our synced portage tree + proxies + synced packages
SYNC="rsync://mirror.wlink.com.np/gentoo-portage"
GENTOO_MIRRORS="http://gentoomirror.wlink.com.np http://mirror.datapipe.net/gentoo"
http_proxy="http://mirror.wlink.com.np:8080"

For HP 540

File: /etc/make.conf
 # For HP 540
 CHOST="i686-pc-linux-gnu"
 CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
 CXXFLAGS="${CFLAGS}"
 MAKEOPTS="-j4"

 VIDEO_CARDS="intel"
 INPUT_DEVICES="evdev"

# Setp 1
USE="acpi automount crypt dbus -fortran hal laptop sqlite symlink tcpd threads"

# Use our synced portage tree + proxies + synced packages
SYNC="rsync://mirror.wlink.com.np/gentoo-portage"
GENTOO_MIRRORS="http://gentoomirror.wlink.com.np http://mirror.datapipe.net/gentoo"
http_proxy="http://mirror.wlink.com.np:8080"


For Lenovo G550

File: /etc/make.conf
 # For Lenovo G550
 CHOST="x86_64-pc-linux-gnu"

 # 64 bit profile (amd64) for < GCC 4.3 
 # CFLAGS="-march=nocona -O2 -pipe"
 # 64 bit profile (amd64) for >= GCC 4.3 
 CFLAGS="-march=core2 -O2 -pipe"

 CXXFLAGS="${CFLAGS}"
 MAKEOPTS="-j3"

 VIDEO_CARDS="intel"
 INPUT_DEVICES="evdev"

# Step 1
USE="acpi automount crypt dbus -fortran hal laptop sqlite symlink tcpd threads"

# Use our synced portage tree + proxies + synced packages
SYNC="rsync://mirror.wlink.com.np/gentoo-portage"
GENTOO_MIRRORS="http://gentoomirror.wlink.com.np http://mirror.datapipe.net/gentoo"
http_proxy="http://mirror.wlink.com.np:8080"

Syncronize the time

ntpdate 0.gentoo.ntp.org

Entering the chroot enviroment

cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev/ /mnt/gentoo/dev
chroot /mnt/gentoo
env-update
source /etc/profile

Configure TimeZone

cp /usr/share/zoneinfo/Asia/Kathmandu /etc/localtime
echo 'TIMEZONE="Asia/Kathmandu"' >> /etc/conf.d/clock

Syncing the Portage Tree

emerge --sync

Bootstrapping

cd /usr/portage

[Note:Check the TIME of the machine before bootstraps]

./scripts/bootstrap.sh -f

This builds bootstrap which emerges 9 packages including gcc so it takes about an hour to finish the process

./scripts/bootstrap.sh

Build the System

Note: "emerge -e system" builds the system from scratch, so have patience.

Tries to update/install about 147 packages

emerge --pretend -e system

or

emerge --pretend --verbose --emptytree system

It takes only 45 seconds to download packages from our local mirror

emerge --fetchonly -e system

It takes about 2 hours 35 minutes to 4 hours to finish the task

emerge -v -e system

Fetch the Kernel Sources

It takes about 2 minutes to download from local mirror and complete task

emerge -v gentoo-sources

Build the Kernel

cd /usr/src/linux
make menuconfig

Batch

make && make modules_install && make install

It tool 15 minutes for completing the task


As USE="symlink" is already in /etc/make.conf, you don't need to do following commands

cp arch/i386/boot/bzImage /boot/kernel-2.x.xx-gentoo-rx
cp System.map /boot/System.map-2.x.xx-gentoo-rx
cp .config /boot/config-2.x.xx-gentoo-rx

instead, do

 make install

Change Root Password

password root

Emerge packages that you will need just after booting with your new kernel

Batch

emerge --pretend --verbose syslog-ng vixie-cron logrotate mlocate dhcpcd wireless-tools vim ntp gentoolkit pciutils
emerge --fetchonly --verbose syslog-ng vixie-cron logrotate mlocate dhcpcd wireless-tools vim ntp gentoolkit pciutils

It took 15 minutes to complete the task

emerge --verbose syslog-ng vixie-cron logrotate mlocate dhcpcd wireless-tools vim ntp gentoolkit pciutils
rc-update add vixie-cron default

For syslog-ng, cron, logrotate and locate

emerge -v syslog-ng vixie-cron logrotate mlocate

For commands like dhcpcd, iwconfig

emerge -v dhcpcd wireless-tools

For commands like vi, ntpdate, equery, lspci

emerge -v vim ntp gentoolkit pciutils

How-to configure grub

Here are steps to install grub cleanly without touching original Windows XP Professional that came preinstalled in T41. The idea is to install grub in boot sector of linux partition instead of harddisk's MBR.

emerge -v grub

Create grub config file like an example below

nano /boot/grub/menu.lst
File: /boot/grub/menu.lst
# 20-jun-2008

default 1
timeout 30

splashimage=(hd0,2)/boot/grub/splash.xpm.gz

title Windows XP
rootnoverify (hd0,0)
# makeactive
chainloader +1

title Gentoo Linux linux-2.6.24-gentoo-r8 DEFAULT
root (hd0,2)
kernel /boot/vmlinuz root=/dev/hda3 video=uvesafb:ywrap,mtrr,1024x768-32@60
fdisk -l

Disk /dev/hda: 40.0 GB, 40007761920 bytes
240 heads, 63 sectors/track, 5168 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0xcccdcccd

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1        3457    26134888+   7  HPFS/NTFS
/dev/hda2            3458        3597     1058400   82  Linux swap / Solaris
/dev/hda3   *        3598        4697     8316000   83  Linux

Installing grub

grub

Find out grub id for your boot device

grub > find /boot/grub/stage1

and put the value in "root" command below, mine is (hda0,2) 3rd partition of first harddisk.

grub > root (hd0,2)

Install grub in boot sector of first harddisk leaving the Windows MBR alone,

grub > setup (hd0,2)

However if you want to install grub in MBR, run the following command instead

grub > setup (hd0)

then quit grub.

grub > quit

Re-Configuring the Compile Options

vi /mnt/gentoo/etc/make.conf

For IBM T41/T42

Add more compile options and edit "USE" flags for IBM T41/T42

File: /etc/make.conf
 # For IBM T41/T42

# Add more of these USE flags "X dbus gnome hal java jpeg nsplugin opengl png xinerama xulrunner" 

# Step 2
USE="X acpi alsa automount crypt dbus gnome hal java jpeg nsplugin opengl png sqlite tcpd threads tcpd xinerama "

For HP 540

Add more compile options and edit "USE" flags for HP 540

File: /etc/make.conf
 # For HP 540

# Add more of these USE flags "X alsa bluetooth consolekit dvd dvdr ffmpeg gnome gstreamer java jpeg libnotify laptop nautilus nsplugin opengl png svg win32codecs xinerama xulrunner"

# Step 2
USE="X acpi alsa automount bluetooth consolekit crypt dbus dvd dvdr ffmpeg -fortran gnome gstreamer hal java jpeg libnotify laptop nautilus nsplugin opengl png sqlite svg symlink tcpd threads win32codecs xinerama xulrunner"

Re-Build the System

emerge --pretend --verbose -N system
emerge --fetchonly -N system

It took 34 minutes to compile (6 new packages 4 re-installs)

emerge -vN system

If you can't reboot or shutdown from gnome, make sure you've run

rc-update add consolekit default

List of some recommended packages

You'll need to modify other portage files:

File: /etc/portage/package.keywords
=net-misc/gnome-rdp-0.2.3 ~x86
net-wireless/broadcom-sta     # for HP 430
net-wireless/b43-firmware     # for Lenovo G550
net-wireless/b43-fwcutter     # for Lenovo G550
net-wireless/bluez


File: /etc/portage/package.use

media-video/vlc aac a52 aksa cdio cdda cddb dts httpd live modplug mp3 mpeg musepack ncurses nsplugin ogg opengl optimisememory oss rtsp stream svg svga vcd vlm win32codecs

net-misc/openvpn enable-password-save

net-analyzer/iptraf suid

gnome-base/gnome-applets battstat networkmanager

Do

emerge --sync 

and then, Verify with -pv switches, to download replace -pv with -fv and to emerge replace -pv with -v

For IBM T41/T42

emrege -pv alsa-utils acpid tpb acpitool laptop-mode-tools radeontool hibernate-tools pm-utils

For HP430

emerge -pv alsa-utils acpid ???? ???

For Lenovo G550

It took 5 minutes to complete the task

emerge -pv alsa-utils acpid tpb acpitool laptop-mode-tools pm-utils b43-firmware
rc-update add dbus default
rc-update add alsasound boot

Packages for X

Batch

emerge --pretend --verbose xorg-server gdm gnome-session gnome gnome-themes firefox vlc rdesktop tigervnc

Downloading took 4 minutes from local mirror

emerge --fetchonly --verbose xorg-server gdm gnome-session gnome gnome-themes firefox vlc rdesktop tigervnc
Step 1

In order to circumvent circular dependencies

USE="-cups" emerge --pretend --verbose jdk

Took 5 minutes to download from home (wireless link)

USE="-cups" emerge --fetchonly --verbose jdk

It took 16 minutes to emerge

USE="-cups" emerge --verbose jdk
Step 2

For X

For gnome-light Compilation took 2 hours (gnome-light) total 175 packages

emerge -pv xorg-server gdm gnome-session gnome-light gnome-themes  
rc-update add consolekit default
rc-update add hald default
rc-update add xdm default

It took 54 minutes to compile

emerge -pv firefox vlc tigervnc rdesktop

For gnome - if you choose gnome instead of gnome-light Following command requires total 338 packages

emerge -pv xorg-server gdm gnome-session gnome gnome-themes  

At last I did emerge gnome instead of gnome-light in order to get all the useful utilities ;)

For synaptics touchpad

emerge xf86-input-synaptics


For applets

add battstat and networkmanager in package.use file
emerge gnome-applets ....

For sound volume control ?

emerge -pv gnome-media ?

Needed for Mikritik winbox

emerge -pv wine
emerge -pv vmware-workstation
fetch failed so downloaded the package through torrent and emerged
/etc/modules.autoload.d/kernel-2.6
 # for vmware
 vmblock
 vmci
 vmmon
 vmnet
 vsock


package.keywords
  www-plugins/adobe-flash
package.license
  www-plugins/adobe-flash AdobeFlash-10.1
emerge -pv adobe-flash

Extra command line utilities

for bash-completion

emerge -pv bash-completion

configuring bash-completion

eselect bashcomp list
eselect bashcomp enable findutils

Miscellaneous network utilities

Batch

emerge --pretend --verbose ftp iptables tcpdump vconfig
emerge --fetchonly --verbose ftp iptables tcpdump vconfig

For ftp, iptables

emerge -pv ftp iptables

For tcpdump,

emerge -pv tcpdump 

For vconfig - VLAN tagging command

emrege -pv vconfig

Misc

Batch

emerge --pretend --verbose jre jdk jconfig openvpn x2vnc bind-tools smartmontools samba links iptraf ipcalc lsof fping htping nmap
emerge --fetchonly --verbose jre jdk jconfig openvpn x2vnc bind-tools smartmontools samba links iptraf ipcalc lsof fping htping nmap
emerge -pv jre jdk jconfig openvpn x2vnc 
emerge -pv bind-tools smartmontools
emerge -pv samba links
emerge -pv iptraf ipcalc
emerge -pv lsof
emerge -pv fping htping nmap

Miscellaneous utilities

Batch

emerge --pretend --verbose mc eix
emerge --fetchonly --verbose mc eix


Applications

Batch

emerge --pretend --verbose openoffice
emerge --fetchonly --verbose openoffice
Personal tools