gentoo linux installation

Example where Gentoo was installed on /dev/hda5 as / and /dev/hda6 as swap :

Part - 1 :

* Boot from a live-cd or any linux-distrib.

* Setup the partitions :
$ umount /dev/hda5 #(unmount disks before partitioning with cfdisk)
$ umount /dev/hda6
$ cfdisk #(for partitioning) :
Minimal : atleast one 6/7 GB Linux(type 82) partition.
and one 256-768 MB swap partition.
$ reboot # (critical)
$ umount /dev/hda5
$ mkreiserfs /dev/hda5 #(or any other fs :e.g., $ mkfs.reiser4 /dev/hda5)
$ mkdir /gentoo
$ mount -t reiserfs /dev/hda5 /gentoo
#(mount at a suitable mountpoint)
$ mkswap /dev/hda6

* Copy base files :
$ cd /gentoo
$ tar -xvjpf /mnt/cdrom/gentoo/base/stage3-athlon-xp-2005.1-r1.tar.bz2
#(untar the stage3 tarball -p for preserving
permissions)
$ tar -xvjf /mnt/cdrom/gentoo/base/portage-20051217.tar.bz2 -C /gentoo/usr/
#(untar a portage snapshot)
$ mkdir /mnt/hda1/usr/portage/distfiles
$ cp -rv /mnt/cdrom/gentoo/distfiles/* /gentoo/usr/portage/distfiles/
# (copy the distfiles - can also download from the
network.)
or, can also just symbolically link :
$ ln -sf /mnt/cdrom/gentoo/distfiles/* /gentoo/usr/portage/distfiles/

Note : All the distfiles in this CD belong to ACCEPT_KEYWORDS=~x86
(See MAKE.CONF section below for details)

* MAKE.CONF :
$ nano -w /gentoo/etc/make.conf
This is an important file - edit carefully ! e.g, a safe config :

CFLAGS="-O2 -march=athlon-xp -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"
USE="-gnome"

A "nice" config (my make.conf) e.g. :

CFLAGS="-O3 -march=i686 -mmmx -msse -fomit-frame-pointer -pipe -mfpmath=sse"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j5"
USE="-gnome sse mmx mmx2 nptl nptlonly"
#ACCEPT_KEYWORDS="~x86"
GENTOO_MIRRORS="http://mirror.gentoo.gr.jp/ http://gentoo.osusl.org/"

Explanation : * select -march among - i686 (for pentium/athlon), athlon
(vanilla), athlon-xp (current), pentium4, pentium3 etc.
* select -O2 for level 2 optimization (fast, stable),
-O3 (extreme),-Os (small memory footprint, small sized
binaries !)
* -pipe for using RAM more (good with 256MB+ of RAM)
* Dont change CHOST from default !
* Can also give CXX flags different from CFLAGS, usually
take the same. Use -mcpu instead of -march here.
* MAKEOPTS="-j2" : j2 => 2 CPUs to use, if available.(With
distcc, can also use -j4 or -j5 etc )
* USE flags : don't change if using binary packages !
Default USE flag is in /etc/make.profile/make.defaults.
Setting it /etc/make.conf will override those. e.g.,
here "-gnome" implies packages will be compiled without
Gnome support. Simply without the - , e.g., "gnome",
implies it will be compiled with Gnome support.
* ACCEPT_KEYWORDS="~x86" : For using masked packages

* Host network :
Set up network on host-machine, if using internet for packages and network
is not already setup. e.g., for static IPs (not DHCP):
$ ifconfig eth0 <ip address> netmask <netmask address> up
$ route add default gw <gateway address>
$ nano -w /etc/resolv.conf : e.g.,

domain <set domain name here>
nameserver <DNS server address>
nameserver <Alternate DNS server address>

* CHROOT :
$ mount -t proc none /gentoo/proc
$ mount -t none /dev /gentoo/dev -o bind
$ chroot /gentoo /bin/bash
$ env-update
$ source /etc/profile
You are inside Gentoo ! If using proxies for fetching packages from the
network, to permanently set the http_proxy env-variable :
$ nano -w /etc/env.d/99local

http_proxy=<http proxyaddress>
ftp_proxy=<ftp proxy address>

$ env-update
$ source /etc/profile
(Add any further environmental var.s needed to be set permanently to
this file in the same fashion.)

* Here we go Emerging ! :
$ emerge --metadata
More about EMERGE - the heart of Gentoo portage in docs/emerge.txt.

* KERNEL + timezone :

a) Time zones :
See available timezones :
$ ls /usr/share/zoneinfo
and set appopriate zone : e.g.,
$ ln -sf /usr/share/zoneinfo/Asia/Calcutta /etc/localtime

b) Download a kernel source tarball and any patches and make it ! :
(See kernel/README-kernel.txt for more details. Do things mentioned
in it, except the bootloader (GRUB) part, which we do in the end.)
$ cd /usr/src
Open another shell (<alt> + <right-arrow>) and copy the sources :
$ tar -xvjf /mnt/cdrom/gentoo/kernel/2.6.15-nitro3/linux-2.6.15.tar.bz2 -C /gentoo/usr/src/
$ cp /mnt/cdrom/gentoo/kernel/2.6.15-nitro3/patch-2.6.15-nitro3 /gentoo/usr/src/
$ cp /mnt/cdrom/gentoo/kernel/2.6.15-nitro3/31_back-to-1G-lowmem.patch /gentoo/usr/src/
$ cp /mnt/cdrom/gentoo/kernel/2.6.15-nitro3/config-2.6.15-nitro3 /gentoo/usr/src/
Come back to the Gentoo shell (<alt> + <left-arrow>) and continue :
$ mv linux-2.6.15 linux-2.6.15-nitro3
$ ln -sf linux-2.6.15-nitro3 linux
$ cd linux
$ patch -p1 < ../patch-2.6.15-nitro3
$ patch -p1 < ../31_back-to-1G-lowmem.patch
Alternatively, to get Gentoo kernel sources :
$ USE="-doc symlink" emerge gentoo-sources
$ cd /usr/src/linux (it will be a symbolic link to the gentoo-sources)
Now, the usual :
$ cp ../config-2.6.15-nitro3 .config
$ make menuconfig
Now make changes to the config according to your system -
especially processor type, motherboard chipset, ide and
sata (scsi), ethernet card, sound and video, filesystems
etc, plus all the optional optimizing features.
Then,
$ make
$ make modules_install
$ cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.15-nitro3
$ cp .config /boot/config-2.6.15-nitro3
$ cp System.map /boot/System.map-2.6.15-nitro3

c) If you have compiled some optional features in kernel as modular, and
want to load them automatically at startup - first search for all search
for all such modules :
$ find /lib/modules/2.6.15-nitro3/ -type f -iname '*.ko' -or '*.o
and then edit the file :
$ nano -w /etc/modules.autoload.d/kernel-2.6
and add the names of the necessary modules, one per line. e.g. :

snd-via82xx
nvidia # (this module required for Nvidia
propreitary drivers)

To give options to those modules, append them to the file
/etc/modules.d/aliases. For giving options for alsa, append to file
/etc/modules.d/alsa, for e.g;

options snd-via82xx dxs_support=5

* /ETC/FSTAB :
$ nano -w /etc/fstab : A sample /etc/fstab -

# -------------------------------------essential---------------------------
/dev/hda3 / reiserfs noatime,notail 0 1
/dev/hda5 none swap sw 0 0
# ------------------------------------very essential-----------------------
proc /proc proc defaults 0 0
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
# -------------------------------------other-------------------------------
/dev/fd0 /floppy auto rw,noauto,user,sync 0 0
/dev/cdroms/cdrom0 /cdrom iso9660 noauto,ro 0 0
/dev/hda1 /gentoo reiserfs defaults 0 0
/dev/hda6 /data reiserfs defaults 0 0
/dev/hda7 /pool reiserfs defaults 0 0
# --------------------------- FreeBSD drives (if any) ---------------------
#/dev/hda8 /fbsd/a ufs ro,ufstype=ufs2 0 0
#/dev/hda10 /fbsd/d ufs ro,ufstype=ufs2 0 0
#/dev/hda11 /fbsd/e ufs ro,ufstype=ufs2 0 0
Note that the directories for the respective mount-points should exist
or be created.

* HOSTNAME :
$ nano -w /etc/conf.d/hostname

HOSTNAME="matrix"

$ rc-update add hostname default

$ nano -w /etc/conf.d/domainname
( or /etc/nisdomainname or /etc/dnsdomainname )

NISDOMAIN="<domain name>"

$ rc-update add domainname default

RC-UPDATE is used for adding or removing services from startup & shutdown.

* NETWORK :
$ nano -w /gentoo/conf.d/net :e.g.,

config_eth0=("<ip adderess> netmask <netmask address>");
routes_eth0=("default gw <gateway address>");

For DHCP, use a blank /etc/conf.d/net !

$ rc-update add net.eth0 default

$ nano -w /gentoo/etc/resolv.conf : e.g.,

domain <domain address>
nameserver < DNS address >
nameserver < alternate DNS address>

Also, if using DHCP, would like to set in /etc/conf.d/rc :

RC_NET_STRICT_CHECKING="none"

so that it doesn't keep waiting for DHCP to be up.
* OTHER :
$ nano -w /etc/rc.conf

DISPLAYMANAGER="kdm"
XSESSION="kde-3.4.3"

$ nano -w /etc/conf.d/clock

CLOCK="UTC"

(Don't change this to "local", if having problems.)

$ nano -w /etc/conf.d/rc :

RC_PARALLEL_STARTUP="yes"

for parallel startup of services. Better set "no".

Also, if using DHCP, would like to set

RC_NET_STRICT_CHECKING="none"

so that it doesn't keep waiting for DHCP to be up.
* Installing other essential packages :
0) SSH server autostart :
$ rc-update add sshd default
(To remove a service from startup/shutdown :
$ rc-update del <service> default>
To see available services, see /etc/init.d/)
1) Syslog-ng (essential)
$ emerge syslog-ng
$ rc-update add syslog-ng default
2) Cron (optional) for scheduling jobs -
$ emerge vixie-cron
$ rc-update add vixie-cron default
3) Slocate (optional) :
$ emerge slocate
4) Reiserfsprogs (essential) :
$ emerge reiserfsprogs
For reiser4 support also :
$ emerge reiser4progs
5) Dhcpcd, if using DHCP (optional) :
$ emerge dhcpcd
6) Rp-pppoe, if using PPPoE (optional) :
$ USE="-X" emerge rp-pppoe
7) Extended volm mgmnt sys (optional) :
(In fact, dont use it at all!)
$ USE="-X" emerge evms

* BOOTLOADER = GRUB :
$ emerge grub
$ nano -w /boot/grub/menu.lst : Sample -

splashimage (hd0,4)/boot/grub/splash.xpm.gz
timeout 5
default 0

title Gentoo 2005.1
root (hd0,0)
kernel (hd0,0)/boot/vmlinuz-2.6.14-nitro2 root=/dev/hda1 vga=791 ro

title Slackware 10.2
kernel (hd0,4)/boot/vmlinuz-2.6.14-nitro2 vga=791 root=/dev/hda5 ro

## Boot Microsoft Windows(TM)
#title Windows XP
#root (hd0,0)
#makeactive
#chainloader +1

Both SATA (sda,sdb etc) and IDE (hda,hdb) etc. are named hdX.
Numbers start from 0, so for e.g., /dev/sda =(hd0), /dev/hdc =
(hd2),/dev/sdb7 = (hd1,6) & /dev/hda5 = (hd0,4) etc.

$ cp /boot/grub/menu.lst /boot/grub/grub.conf
$ grub --no-floppy
This will drop you to a grub-shell :
> root (hd0,0) (boot is /dev/hda1)
> setup (hd0) (set up grub on MBR)
> quit

BOOTLOADER = LILO :
If using reiser4 as root (and boot), either use patched GRUB, or use LILO (better) :
$ emerge lilo
$ nano -w /etc/lilo.conf : Sample -

# /etc/lilo.conf

lba32
compact
prompt
timeout=50
#map=/boot/map

boot=/dev/hda

install=menu
menu-scheme=Gb:rw:Yb:Yb
menu-title="Welcome"

#install=bmp
#bitmap=/boot/sarge.bmp
#bmp-colors=1,,0,2,,0
#bmp-table=120p,173p,1,15,17
#bmp-timer=254p,432p,1,0,0

image=/boot/vmlinuz-2.6.15-nitro3
root=/dev/hda1
label="Gentoo-2005.1"
vga=791
# initrd=/boot/initrd.splash
# append="splash=verbose"
read-only

#other=/dev/hda1
# label="Windows_XP"

$ lilo # (Run lilo after editing grub each time.)
Note that "boot=/dev/hda" implies that it will be installed to the MBR of hda.

* Installing graphical boot (Optional fancy!):
1) Compile kernel with fbsplash (Nitro patches have it !)
2) $ emerge splashutils
3) $ emerge splash-themes-livecd (Can also search for other themes)
4) $ splash_geninitramfs -v -g /boot/initrd.splash -r 1024x768 livecd-2006.0
(Can search for more themes and emerge them, and themes are in /etc/splash)
5) Edit /boot/grub/menu.lst and grub.conf :

title Gentoo 2006.0
root (hd0,0)
kernel (hd0,0)/boot/vmlinuz-2.6.14-nitro2 root=/dev/hda1 vga=791 ro splash=silent,theme:livecd-2005.1 quiet CONSOLE=/dev/tty1
initrd (hd0,0)/boot/initrd.splash
Or likewise edit /etc/lilo.conf and add.
Part-2 :

Remaining packages can be emerged by either chrooting from an existing distro
/ live CD or booting into the distro. (Method for chrooting : First mount the
gentoo root drive, mount proc, mount proc, chmod, env-update, and
source /etc/profile.

A logical sequence of steps :

1) If using internet for fetching packages, may need to set up proxies by
either temporarily / permanently setting proxy variables:
1) tempo : e.g.,
$ export http_proxy=<httpproxy>
$ export ftp_proxy=<ftpproxy>
2) perma : same method for setting any environment variable permanently :
$ nano -w /etc/env.d/99local
http_proxy=<httpproxy>
ftp_proxy=<ftpproxy>
$ env-update
$ source /etc/profile

2) $ emerge -Dup world
$ emerge -Du world
(Better :
$ emerge -Due world , because USE flags changed.)
This will upgrade the installed base according to the current snaphsot in
/usr/portage. (This will take a few hours.)
After this, may require to run
$ env-update
$ etc-update
If it asks about which config files to use, take "-3". May need to change
a few config files edited earlier and now reset to default.

3) Update the gcc-version (optional) :
To see available gcc-versions :
$ gcc-config -l
Then select a particular version and set :
$ gcc-config i686-pc-linux-gnu-3.4.4
After updating gcc, recompile all stuff including kernel :
$ emerge -evp world
$ emerge -e world
Recompile the kernel. (Delete the old kernel in /usr/src completely and
start afresh.)

4) Some nice packages in order :

Note : If facing any problems during lengthy emerges, try running
/sbin/ldconfig before emerging again.

Can give these at one go like :
$ emerge -Du <pkg1> <pkg2> ... <pkgn>
and come back after a day !
Choose only required packages and in the order needed.

app-admin/sudo samba nfs-utils ftp alsa-utils sox* aalib eject lm_sensors* hddtemp
kdebase* kmix
ffmpeg gstreamer xvid libdvdread lame toolame libtheora libdv libdts libmatroska win32codecs mplayer*
mozilla-firefox ymessenger d4x* prozgui* gaim valknut skype*
sun-jdk corefonts netscape-flash rar unrar Archive-Rar
kdeutils kdepim kdegraphics-meta kdeartwork-meta baghira* gtk-engines-qt*
konq-plugins kdenetwork smb4k nmap johntheripper apache
kdewebdev htmltidy kompare cervisia
tetex latex2html kile latex-beamer*
acroread openoffice-bin*
qcad gimp 3ddesktop kxdocker* xvidcap
dvd+rw-tools kiso extract-xiso nrg2iso bin2iso xbiso emovix* k3b
xine-ui vlc* amarok*
wine
frozen-bubble supertux pingus *
blas-atlas* hdf5 fftw octave spice

* $ USE="-alsa" emerge sox

* Post install :
$ sensors-detect
$ rc-update add lm_sensors default

* May require to re-emerge kdebase( do it someday overnight) after all
(more or less) packages have been installed. (Konqueror may not support
some protocols initially, e.g. smb, if emerged before samba.)

* mplayer : emerge it, unmerge it (emerge -C) and install it from sources
with all-codecs-pack ! See extrapacks/mplayer/ for more.
Make sure you have most of the codecs before emerging mplayer
(emerge win32codecs, libdv, libtheora etc etc. Do the
./configure and find out what features (codecs etc.) are missing
and emerge required features.
After installing mplayer, install xmmsmplayer from sources.
See extrapacks/mplayer/ for more.

* d4x GUI can be crashy.

* $ ACCEPT_KEYWORDS=~x86 emerge prozgui

* $ ACCEPT_KEYWORDS=~x86 emerge skype

* Configuring baghira :
kde_control_center > app+themes > window_dec :
- select baghira
- default mode : jaguar

* $ ACCEPT_KEYWORDS=~x86 emerge gtk-engines-qt
Go to KDE_control_center > App+themes > GTK_styles+fonts ,
toggle options and reapply to settings to take effect.

* $ ACCEPT_KEYWORDS=~x86 emerge latex-beamer

See docs/emerge.txt for "masked packages".

* Don't try to "emerge openoffice", as it requires tremendous resources
(~3 GB disk space and 1 GB RAM and ~12-18 hrs to compile from sources.)

* $ ACCEPT_KEYWORDS=~x86 emerge kxdocker

* $ ACCEPT_KEYWORDS=~x86 emerge emovix
Emovix extension for k3b enables creating bootable liveCDs containing
video files. Has minimum OS overhead and contains mplayer for playing
videos.

* vlc will work only from console as USE="-gnome".

* compiling amarok with xine engine support can be used for streaming with
http proxies.

* Game executables are installed in /usr/games/bin/ (which isn't in PATH
of root, so, do something like
$ /usr/bin/games/pingus
etc.
For users (ncluding root) to play games, they should be in "games" group. e.g. -
$ gpasswd -a root games
See adding users below.

* $ interactive=1 emerge blas-atlas

5) After installing kdebase, do :
$ rc-update add xdm default
to automatically start kdm.

Configuring X :
$ cp config/xorg.conf /etc/X11/xorg.conf
$ nano -w /etc/X11/xorg.conf
For Nvidia cards, see extrapacks/nvidia/ folder.
For others, the default xorg.conf in config/xorg.conf is guaranteed to work
for most cards (vesa driver). If not using Nvidia's propreitary drivers in
extrapacks/nvidia/ for Nvidia cards, then use <Driver "nv"> in
<Section "Device">. For better graphics, use "i810" for intel, "radeon"
for ATI, "sis" for SIS etc.
Make sure to have compiled the kernel with appropriate driver support (see
DeviceDrivers --> CharacterDevices --> /dev/agpgart and
DeviceDrivers --> CharacterDevices --> DirectRenderingManager. For intel,
select the i915 driver. Dont select framebuffer support for specific cards
in DeviceDrivers --> GraphicsSupport)

KDM config file : /usr/kde/3.4/share/config/kdm/kdmrc.
To enable xdmcp, do it here.

6) Adding users :
The following groups are available : users,wheel, cdrom, floppy, usb, audio,
video, tty, games, wheel, portage ... and more.
Adding a new user :
$ useradd -m -G users,wheel,audio -s /bin/bash <user-name>
Followed by :
$ passwd <user-name>
Adding user to more groups :
$ gpasswd -a <user-name> wheel
PS:This documentation was actually made by my friend and i just made small edits here and there.

for more information on gentoo linux visit Gentoo Linux -- Gentoo Linux News
 
Hey cool guide, but if u could explain a bit then it would help noobs.. For me i use a shorter method to install..:)
 
people with any doubts can always pm me.

making this guide any simpler will make it much longer.

there are simple ways to install, but this is online installation,
and u compile ur own kernal so ur system is completely optimized
 
Back
Top