Install Gentoo Linux

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 13:29, 3 March 2006 by (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I'm almost finished with my how-to, but I don't know how to upload it to the wiki, so here it is. I'm sure I left something out, but the steps are there. A good amount of this stuff is from TGL's gentoo beta 1 how-to. As usual, backup your data before starting. You will be formatting partitions and a mistake could cause you to lose everything. You have been warned.

For AWX, I will be changing journaling as soon as I have time (maybe in a few weeks, but the instructions here and in TGL's how-to should get others up and running without too much pain. I found that getting portage and the overlay to work was the most difficult part. I tried my best to explain it at
<st1:time Minute="0" Hour="2">2:00 am</st1:time>. Let me know if it is nor clear enough and I'll see what I can do.

Without further delay, here is the How-To:

Start by using any FTP client to upload EM_mode_binaries.tar.bz2 (you can download it from <a href="" target="_blank"></a>) to /tmp on the Kuro (hint: Windows may change the extension of the file when you download it from the internet). Then login to the kuro using a telnet client

Kroutoshikou KURO-BOX (IETSUNA)
kernel 2.4.17-kuro-box on ppc

KURO-BOX-EM login: root

Lets see what we've got

# df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/ram0 9677 5102 4575 53% /
#cd /tmp

Change to the root and untar the binaries.

#cd /
#tar xvzf /tmp/EM_mode_binaries.tar.gz

Check and set the date.

Fri Feb 1 12:37:03 JST 2006
#date 02032238
Thu Feb 3 22:38:00 JST 2006

We run fdisk and create partitions. I use 4 partitions. hda1 for /, hda2 for the swap space, hda3 for /var, and hda4 for my data store (/datafiles) Once the partitione are created we format the partitions.

Here we format the first partition on /dev/hda (the hard drive is /dev/hda).

# mke2fs -j /dev/hda1
mke2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1251712 inodes, 2502115 blocks
125105 blocks (5.00%) reserved for the super user
First data block=0
77 block groups
32768 blocks per group, 32768 fragments per group
16256 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

We do this for all of the partitions we plan to use.
# mke2fs -j /dev/hda3
# mke2fs -j /dev/hda4

Next we create the swap space

# mkswap /dev/hda2
Setting up swapspace version 1, size = 518184960 bytes

We will create the directoy /gentoo and mount /dev/hda1 there. this allows us to create the gentoo system on the hard drive instead of in the flash ram disk. It will later become

our root.

# mkdir /gentoo
# mount -t ext3 /dev/hda1 /gentoo

We now use our FTP client to upload system-20060108.tar.gz (from <a href="" target="_blank"></a>) to the /gentoo directory on the kuro. we also upload portage-snapshot-20060108.tar.gz. Use the most current one you can find. It can be found at any of the gentoo mirrors. The last file we need to upload is the current portage overlay which was portage-overlay-20060122.tar.gz when I wrote this. It can also be found at <a href="" target="_blank"></a>

Now we make /gentoo/var and mount /dev/hda3 there

# mkdir /gentoo/var
# mount -t ext3 /dev/hda3 /var

We now change directories to /gentoo and untar the system in what will be our root directory

#cd /gentoo
# tar xvjf system-20060108.tar.gz


Next we mount /proc

# mount -t proc none /gentoo/proc

and configure name resolution

# cp -L /etc/resolv.conf /gentoo/etc/

And then we chroot into the new gentoo system

# chroot /gentoo /bin/bash

We set up the terminal

KURO-BOX-EM / #export TERM=vt100

Next we setup portage. This might be a good time to get a drink or walk the dog.

KURO-BOX-EM / #cd /var
KURO-BOX-EM var #tar xvjf /portage-20060126.tar.gz

Next we install the portage overlay

KURO-BOX-EM var # mkdir overlays
KURO-BOX-EM var # cd overlays
KURO-BOX-EM overlays # mkdir 20060122
KURO-BOX-EM overlays # cd 20060122
KURO-BOX-EM 20060122 # tar xvjf /overlay-20060122.tar.gz


KURO-BOX-EM 20060122 #

Now we create empty directories for distfiles and binaries
KURO-BOX-EM 20060122 # cd /var
KURO-BOX-EM portage # mkdir packages
KURO-BOX-EM portage # mkdir distfiles

Now we configure portage

KURO-BOX-EM portage #cd /etc
KURO-BOX-EM etc #nano make.conf

#The GENTOO_MIRRORS and SYNC lines need to be adjusted. pick the three nearest
#sites listed at <a href="" target="_blank"></a> for your GENTOO_MIRRORS line.

CFLAGS="-O2 -mcpu=603e -fno-strict-aliasing -pipe -fsigned-char"

#I store my overlays in a directory based on the date of the overlay


GENTOO_MIRRORS=" <a href="" target="_blank"></a>


Next we set up the portage profile

KURO-BOX-EM etc #rm make.profile

Notice the 20060122 in the following line. Change it to the date of your overlay in order to point to the correct directory. The link is the relative diretory from /etc. Notice we have to go up 1 level (../) before going back down the /var part of the tree.

KURO-BOX-EM etc #ln -s ../var/overlays/20060122/profiles/kurobox make.profile
KURO-BOX-EM kurobox #cd /var/overlays

Notice the 20060122 in the following lines. Change it to the date of your overlay in order to point to the correct directory. It is the relative path from the profile in the overlay to the profile in the official portage tree. Each "../" indicates a directory up in the tree. Just count the directories up and then add the path back down.

KURO-BOX-EM overlays # echo "../../../../portage/profiles/default-linux/ppc/2005.1/ppc" > 20060122/profiles/kurobox/parent
KURO-BOX-EM overlays #cd /etc

Now lets regenerate the portage cache. This would be a good time for a bathroom break or a quick run to the store for a snack.

KURO-BOX-EM etc #emerge metadata

>>> Updating Portage cache: 100%


We edit /etc/fstab as required. Here are the important parts of my fstab:

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/hda1 / ext3 noatime 0 0
/dev/hda2 none swap sw 0 1
/dev/hda3 /var ext3 noatime 0 2
/dev/hda4 /datafiles ext3 noatime 0 0

# NOTE: The next line is critical for boot!
none /proc proc defaults 0 0

Now we'll check if the system is up to date

KURO-BOX-EM etc #emerge -puD system

If there are packages that need installing/upgrading wait until you finish the install guide and reboot the system before running "emerge -uD world". I know for a fact that glibc won't emerge if you try to do it right now, but it will after the install is complete.

Next we change the root password and add a user who is a member of wheel so they can su to root.

KURO-BOX-EM etc #passwd
New UNIX password:
Retype new UNIX password:
passwd: password updated successfully
KURO-BOX-EM etc # useradd dtaylor -m -G users,wheel -s /bin/bash
KURO-BOX-EM etc # passwd dtaylor
New UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Next we configure the network.

KURO-BOX-EM etc #cd conf.d
KURO-BOX-EM conf.d #cp net.example net
KURO-BOX-EM conf.d #nano net

If you want a static IP address you need to uncomment a couple of lines. Scroll down to the section INTERFACE HANDLERS and uncomment the following lines. Do not uncomment the "default via 4321:0:1:2:3:4:567:89ab" line. You will want to change the IP address gateway address to suit your network. If you want to use DCHP, don't edit the file at all as it defaults to DCHP.

config_eth=( " netmask broadcast" )

"default via"
# "default via 4321:0:1:2:3:4:567:89ab"

Add net.eth0 to your default runlevel or you won't be able to log in.

KURO-BOX-EM conf.d #cd /etc
KURO-BOX-EM etc #rc-update add net.eth0 default

Now we get SSH working. This step will take a few minutes and will throw a few errors.

KURO-BOX-EM etc #/etc/init.d/sshd start

Then we start putty on our computer and try to login. Once you are sure you can login exit putty, stop sshd, and add it to the default runlevel.

KURO-BOX-EM etc #/etc/init.d/sshd stop
KURO-BOX-EM etc #rc-update add sshd dafault

Next we make sure that the proper daemons are set to the default runlevel

KURO-BOX-EM etc # ls runlevels/default/
local net.eth0 netmount sshd

and then we exit the chroot system

KURO-BOX-EM etc # exit

Unmount everything
# cd /
# umount /gentoo/var
# umount /gentoo/proc
# umount /gentoo

Set the box to boot to the new system
# echo -n "OKOK" > /dev/fl3

and then restart the system
# shutdown -r now

Wait a few minutes and then log onto your kuro with putty. Now would be a good time to update everything and take a short vacation as it will be emerging applications for a day or three.

KURO-BOX-EM # cd /
KURO-BOX-EM # emerge -uD world

Last we need to update our config files. Don't do this blindly as you can easily break your brand new system. You need to understand what the configuration files mean and choose what lines you want to edit.

KURO-BOX-EM # etc-update