Friday, September 19, 2008

gentoo install from harddisk

dig from gentoo install guide

grub load untared minimal live cd


1. for windows system (fat32): install grub for dos
cp grld to C:\
add "c:\grldr="grub"" to the last of boot.ini file

2. configure menu.lst
need to uncompress *.sqashfs folder to partition
uncompress isolinux folder
set it to :

kernel (hd0,0)/boot/gentoo/gentoo root=/dev/ram0 init=/linuxrc dokeymap
looptype=squashfs loop=/image.squashfs cdroot vga=791
splash=silent,theme:livecd-2007.0 CONSOLE=/dev/tty1 nox
initrd (hd0,0)/boot/gentoo/gentoo.igz


if it is grub for linux , just need to set menu.lst file correctly.

(The following specs and the timing information should help you determine
a rough estimate of the time you need to complete your install)

# grep bogo /proc/cpuinfo
bogomips : 3337.81

# hdparm -tT /dev/sda
Timing cached reads: 1100 MB in 2.00 seconds = 549.97 MB/sec
Timing buffered disk reads: 224 MB in 3.01 seconds = 74.36 MB/sec

# grep MemTotal /proc/meminfo
MemTotal: 509248 kB

livecd root # ifconfig eth0
livecd root # route add default gw
livecd root # echo nameserver > /etc/resolv.conf

(ext2 is all you need on the /boot partition)
livecd ~ # mke2fs /dev/sda1

(Let's use ext3 on the main partition)
livecd ~ # mke2fs -j /dev/sda3

(Create and activate swap)
livecd ~ # mkswap /dev/sda2 && swapon /dev/sda2

livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/sda1 /mnt/gentoo/boot
livecd ~ # cd /mnt/gentoo

Howto make partition changes visible to the kernel without reboot

(very important if you cannot reboot your system but changed partition during installation )

Install parted in debian

#apt-get install parted

Now this will install partprobe and parted.Partprobe inform the OS of partition table changes. partprobe is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the
partition table.


partprobe [-d] [-s] [devices...]

-d DonĂ¢t update the kernel.
-s Show a summary of devices and their partitions.
-h Show summary of options.
-v Show version of program.

Using partprobe


(Check the clock)
livecd gentoo # date
Mon Mar 6 00:14:13 UTC 2006

(Set the current date and time if required)
livecd gentoo # date 030600162006 (Format is MMDDhhmmYYYY)
Mon Mar 6 00:16:00 UTC 2006

livecd gentoo # links
(Pick a mirror, move to the releases/x86/2008.0/stages/ directory, highlight the
stage3 of your choice, probably the i686 stage3 and press D to download it)

(Or download it directly with wget without choosing a nearby mirror)
livecd gentoo # wget*tar.bz2

livecd gentoo # time tar xjpf stage3*

real 1m14.157s
user 1m2.920s
sys 0m7.530s

livecd gentoo # cd /mnt/gentoo/usr
livecd usr # links
(Pick a mirror, move to the snapshots/ directory,
highlight portage-latest.tar.bz2 and press D to download it)

(Or download it directly with wget without choosing a nearby mirror)
livecd gentoo # cd /mnt/gentoo/usr
livecd usr # wget

livecd usr # time tar xjf portage-lat*

real 0m40.523s
user 0m28.280s
sys 0m8.240s

livecd usr # cd /
livecd / # mount -t proc proc /mnt/gentoo/proc
livecd / # cp -L /etc/resolv.conf /mnt/gentoo/etc/
livecd / # chroot /mnt/gentoo /bin/bash
livecd / # env-update && source /etc/profile
>>> Regenerating /etc/

livecd / # ls /usr/share/zoneinfo
(Using Brussels as an example)
livecd / # cp /usr/share/zoneinfo/Europe/Brussels /etc/localtime

livecd / # date
Wed Mar 8 00:46:05 CET 2006

livecd / # cd /etc
livecd etc # echo " mybox localhost" > hosts
livecd etc # sed -i -e 's/HOSTNAME.*/HOSTNAME="mybox"/' conf.d/hostname
(Use defined host name and check)
livecd etc # hostname mybox
livecd etc # hostname -f

livecd etc # time emerge gentoo-sources

real 2m51.435s
user 0m58.220s
sys 0m29.890s
livecd etc # cd /usr/src/linux
livecd linux # make menuconfig
(Configure your kernel)
livecd linux # time make -j2

(Elapsed time depends highly on the options you selected)
real 3m51.962s (so fast ........ impossible .... -_-! )
user 3m27.060s
sys 0m24.310s

livecd linux # make modules_install
livecd linux # cp arch/i386/boot/bzImage /boot/kernel

livecd linux # cd /etc
livecd etc # nano -w fstab
/dev/sda1 /boot ext2 noauto,noatime 1 2
/dev/sda3 / ext3 noatime 0 1
/dev/sda2 none swap sw 0 0

livecd etc # cd conf.d
livecd conf.d # echo 'config_eth0=( "" )' >> net
livecd conf.d # echo 'routes_eth0=( "default via" )' >> net
livecd conf.d # rc-update add net.eth0 default
(If you compiled your network card driver as a module,
add it to /etc/modules.autoload.d/kernel-2.6)

livecd conf.d # echo r8169 >> /etc/modules.autoload.d/kernel-2.6
(If you want to reconnect via ssh after you have rebooted your new box)
livecd conf.d # rc-update add sshd default

livecd conf.d # passwd
New UNIX password: type_the_password
Retype new UNIX password: type_the_password_again
passwd: password updated successfully

livecd conf.d # nano -w /etc/conf.d/clock

livecd conf.d # nano -w /etc/rc.conf
livecd conf.d # nano -w /etc/conf.d/rc
livecd conf.d # nano -w /etc/conf.d/keymaps

livecd conf.d # time emerge syslog-ng vixie-cron

real 1m54.099s
user 1m2.630s
sys 0m34.620s
livecd conf.d # rc-update add syslog-ng default
livecd conf.d # rc-update add vixie-cron default

livecd conf.d # emerge xfsprogs (If you use the XFS file system)
livecd conf.d # emerge jfsutils (If you use the JFS file system)
livecd conf.d # emerge reiserfsprogs (If you use the Reiser file system)
livecd conf.d # emerge dhcpcd (If you need a DHCP client)
livecd conf.d # emerge ppp (If you need PPPoE ADSL connectivity)

livecd conf.d # time emerge grub

real 1m4.634s
user 0m39.460s
sys 0m15.280s
livecd conf.d # nano -w /boot/grub/grub.conf

default 0
timeout 10

title Gentoo
root (hd0,0)
kernel /boot/kernel root=/dev/sda3

livecd conf.d # grub
Probing devices to guess BIOS drives. This may take a long time.

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs__5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2 /boot/
grub/menu.lst"... succeeded

grub> quit

livecd conf.d # exit
livecd / # umount /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo
livecd / # reboot
(Don't forget to remove the CD)

(Clean up your known_hosts file because your new box
has generated a new definitive hostkey)

$ nano -w ~/.ssh/known_hosts
(Look for the IP of your new PC and delete the line,
then save the file and exit nano)

(Use the IP address of your new box)
$ ssh [email protected]
The authenticity of host ' (' can't be established.
RSA key fingerprint is 96:e7:2d:12:ac:9c:b0:94:90:9f:40:89:b0:45:26:8f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Password: type_the_password

mybox ~ # adduser -g users -G lp,wheel,audio,cdrom,portage,cron -m john
mybox ~ # passwd john
New UNIX password: Set John's password
Retype new UNIX password: Type John's password again
passwd: password updated successfully

mybox ~ # emerge mirrorselect
mybox ~ # mirrorselect -i -o >> /etc/make.conf
mybox ~ # mirrorselect -i -r -o >> /etc/make.conf
(Usually, (the number of processors + 1) is a good value)
mybox ~ # echo 'MAKEOPTS="-j2"' >> /etc/make.conf

mybox ~ # emerge -vpe world
(Portage displays the packages and their USE flags, as an example, let's
disable ipv6 and fortran, and enable unicode)

mybox ~ # echo 'USE="nptl nptlonly -ipv6 -fortran unicode"' >> /etc/make.conf

mybox ~ # cd /etc
mybox etc # nano -w locale.gen
mybox etc # locale-gen

mybox etc # nano -w make.conf
(Set -march to your CPU type in CFLAGS)
CFLAGS="-O2 -march=athlon-xp -pipe"
(Add the following line)
(Only add the following if you know what you're doing)

(Install ccache)
mybox etc # emerge ccache

(Please note that the switch to ~x86 causes many packages to be upgraded)
mybox etc # emerge -vpuD --newuse world
(Take a good look at the package list and their USE flags,
remove blocking packages if any, and start the lengthy process)

mybox etc # time emerge -vuD --newuse world
(79 packages have been (re)compiled)

real 180m13.276s
user 121m22.905s
sys 36m31.472s

(Remerge libtool to avoid further potential problems)

mybox etc # emerge --oneshot libtool

(Update config files, make sure you do not let dispatch-conf
update config files you have edited)

mybox etc # dispatch-conf

(If perl has been updated, you should run the perl-cleaner script)
mybox etc # time perl-cleaner all
real 1m6.495s
user 0m42.699s
sys 0m10.641s

(In case of a major upgrade of python, you should run the python-updater script)
mybox etc # python-updater

No comments: