Difference between revisions of "Install Gentoo Linux"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(mark slightly old)
 
(48 intermediate revisions by 12 users not shown)
Line 1: Line 1:
<p class=MsoNormal><span class=postbody1><span style='font-size:9.0pt;
+
<p style="border:dashed 1px red;background:Lemonchiffon;padding:5px;text-align:justify;margin:0 5px">'''These instructions are a couple releases old.'''  Use this method only if you want to customize your install!
font-family:Verdana'>
+
 
Added drive prep information 3/5/06 <Br>
+
Each of the steps required to install Gentoo Linux on the Kurobox are shown here in detail, so you can tailor your install as you see fit. If you want to install Gentoo exactly as shown here without any customization and significantly less work, and you would like to avoid a lengthy (~48 hours) emerge -uD world, go to the '''[[Install The 2007 PPC Gentoo|2007 PPC Gentoo Install]]''' page and follow the instructions there. </p>
Added drive journaling and indexing 3/7/06 <Br>
+
 
<Br>
+
 
<Br>
+
I'm sure I left something out, but the steps are here. 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 which destroys all data. You have been warned.  
I'm sure I left something out, but the steps are here. 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 which destroys all data. You have been warned.  
+
== Preparing for Install ==
<br>
+
<br>
+
<Br>
+
 
Start by using any FTP client to upload EM_mode_binaries.tar.bz2 (you can download it from http://kurobox.com/downloads/gentoo 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  
 
Start by using any FTP client to upload EM_mode_binaries.tar.bz2 (you can download it from http://kurobox.com/downloads/gentoo 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  
<br>
+
 
<br>
+
Kroutoshikou KURO-BOX (IETSUNA)  
<br>
+
kernel 2.4.17-kuro-box on ppc  
Kroutoshikou KURO-BOX (IETSUNA)  
+
KURO-BOX-EM login: root  
kernel 2.4.17-kuro-box on ppc  
+
Password: ''kuro'' (''kuroadmin'' on HG)
<br>
+
 
<br>
+
KURO-BOX-EM login: root  
+
<br>
+
Password:kuro
+
<br>
+
<br>
+
 
Lets see what we've got  
 
Lets see what we've got  
<br>
+
# df
<br>
+
Filesystem 1k-blocks Used Available Use% Mounted on
<span class=postbody1># df </span><br>
+
/dev/ram0 9677 5102 4575 53% /
<span class=postbody1>Filesystem 1k-blocks Used Available Use% Mounted on </span><br>
+
# ls /tmp
<span class=postbody1>/dev/ram0 9677 5102 4575 53% / </span><br>
+
EM_mode_binaries.tar.gz  
<span class=postbody1>#cd /tmp </span><br>
+
 
<span class=postbody1>#ls </span><br>
+
=== Install EM mode utilities ===
EM_mode_binaries.tar.gz  
+
<br>
+
<br>
+
 
Change to the root and untar the binaries.  
 
Change to the root and untar the binaries.  
<br>
+
# cd /  
<br>
+
# tar xvzf /tmp/EM_mode_binaries.tar.gz  
<span class=postbody1>#cd / </span><br>
+
bin/ <br>
<span class=postbody1>#tar xvzf /tmp/EM_mode_binaries.tar.gz </span><br>
+
bin/sfdisk  
bin/ <br>
+
bin/fdisk  
bin/sfdisk <br>
+
bin/bzip2  
bin/fdisk <br>
+
bin/date  
bin/bzip2 <br>
+
bin/chroot  
bin/date <br>
+
#
bin/chroot <br>
+
 
<span class=postbody1># </span><br>
+
Check and set the date.  
<br>
+
# date  
Check and set the date. <br>
+
Fri Feb 1 12:37:03 JST 2006  
<br>
+
# date 02032238  
<span class=postbody1>#date </span><br>
+
Thu Feb 3 22:38:00 JST 2006
Fri Feb 1 12:37:03 JST 2006 <br>
+
 
<span class=postbody1>#date 02032238 </span><br>
+
=== Partitioning & Formating HDD ===
Thu Feb 3 22:38:00 JST 2006 <br>
+
We run fdisk and create partitions. I use four partitions: ''hda1'' for ''/'', ''hda2'' for the swap space, ''hda3'' for ''/var'', and ''hda4'' for data storage (''/datafiles''). [http://www.gentoo.org/doc/en/handbook/handbook-ppc.xml?part=1&chap=4#doc_chap2 This section] from the Gentoo Handbook explains how to prepare your hard disk (create partitions). For most users, 10gb each for ''/'' on ''hda1'' and ''/var'' on ''hda3'' is adequate. 512mb is good for a swap space on ''hda2'' and use the remainder for ''/datafiles'' on ''hda4''. However you can decide which way you want to break up your hard disk. Remember you need to mount all of the drives (except the swap and /datafiles) before you untar the system file (More on that later).  
<br>
+
 
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). [http://www.gentoo.org/doc/en/handbook/handbook-ppc.xml?part=1&chap=4 This page] from the Gentoo Handbook explains how to prepare your harddisk (create partitions). For most 10 gig for / on hda1 and /var on hda3 is adequate. 512 meg is good for a swap space on hda2 and use the remainder for /datafiles on hda4. However you decide to break up your harddisk, remember you need to mount all of the drives (except the swap and /datafiles) before you untar the system file (More on that later). <Br>
+
# fdisk /dev/hda  
<Br>
+
 
<span class=postbody1>#fdisk /dev/hda </span><br>
+
I have read that journaling and indexing will speed up your system. If you would like to setup journaling and indexing click [[journaling_and_indexing | here]] and follow the instructions for formatting your partitions. A tune2fs binary for the Kuro can be downloaded from http://www.kurobox.com/downloads/gentoo. When you are done, click the link to return to this page and you will be returned at the step where we create the [[#swap|swap space]]. If you don't want to set up full journaling and indexing just continue on with these instructions.
<Br>
+
 
I have read that journaling and indexing will speed up your system. If you would like to setup journaling and indexing click [http://www.kurobox.com/mwiki/index.php?title=journaling_and_indexing here]. When you are done come back to this page and skip down about 30 lines to the part where we create the swap space. tune2fs is available for download at http://www.kurobox.com/downloads/gentoo. <Br>
+
 
<Br>
+
Once the partitions are created we format the partitions. Here we format the first partition on /dev/hda (the hard drive is /dev/hda).
<br>
+
# mke2fs -j /dev/hda1  
Once the partitions are created we format the partitions. Here we format the first partition on /dev/hda (the hard drive is /dev/hda). <br>
+
mke2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09  
<br>
+
Filesystem label=  
<span class=postbody1># mke2fs -j /dev/hda1 <br>
+
OS type: Linux  
mke2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09 <br>
+
Block size=4096 (log=2)  
Filesystem label= <br>
+
Fragment size=4096 (log=2)  
OS type: Linux <br>
+
1251712 inodes, 2502115 blocks  
Block size=4096 (log=2) <br>
+
125105 blocks (5.00%) reserved for the super user  
Fragment size=4096 (log=2) <br>
+
First data block=0  
1251712 inodes, 2502115 blocks <br>
+
77 block groups  
125105 blocks (5.00%) reserved for the super user <br>
+
32768 blocks per group, 32768 fragments per group  
First data block=0 <br>
+
16256 inodes per group  
77 block groups <br>
+
Superblock backups stored on blocks:  
32768 blocks per group, 32768 fragments per group <br>
+
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632  
16256 inodes per group <br>
+
Superblock backups stored on blocks: <br>
+
Writing inode tables: done  
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 <br>
+
Creating journal (8192 blocks): done  
<br>
+
Writing superblocks and filesystem accounting information: done  
Writing inode tables: done <br>
+
Creating journal (8192 blocks): done <br>
+
This filesystem will be automatically checked every 29 mounts or  
Writing superblocks and filesystem accounting information: done <br>
+
180 days, whichever comes first. Use tune2fs -c or -i to override.
<br>
+
#  
<span class=postbody1>This filesystem will be automatically checked every 29
+
 
mounts or </span><br>
+
<span class=postbody1>180 days, whichever comes first. Use tune2fs -c or -i to
+
override. </span><br>
+
<span class=postbody1># </span><br>
+
<br>
+
 
We do this for all of the partitions we plan to use. <br>
 
We do this for all of the partitions we plan to use. <br>
<span class=postbody1># mke2fs -j /dev/hda3 </span><br>
+
# mke2fs -j /dev/hda3  
<span class=postbody1># mke2fs -j /dev/hda4 </span><br>
+
.
<br>
+
.
Next we create the swap space <br>
+
.
<br>
+
# mke2fs -j /dev/hda4  
<span class=postbody1># mkswap /dev/hda2 </span><br>
+
 
Setting up swapspace version 1, size = 518184960 bytes <br>
+
<div id=swap>Next we create the swap space</div>
<span class=postbody1># </span><br>
+
# mkswap /dev/hda2  
<br>
+
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. ><br>
+
#
<br>
+
 
<span class=postbody1># mkdir /gentoo </span><br>
+
== Install Gentoo KuroBox Stage 3 ==
<span class=postbody1># mount -t ext3 /dev/hda1 /gentoo </span><br>
+
 
<br>
+
=== Mount new partitions ===
We now use our FTP client to upload system-20060108.tar.gz from http://www.kurobox.com/downloads/gentoo 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 http://www.kurobox.com/downloads/gentoo. <br>
+
This will allow us to create the gentoo system on the hard drive instead of in the flash ram disk. We will create the directoy /gentoo mount /dev/hda1 there, then create /gentoo/var and mount /dev/hda3.
<br>
+
# mkdir /gentoo
Now we make /gentoo/var and mount /dev/hda3 there <br>
+
# mount -t ext3 /dev/hda1 /gentoo
<br>
+
# mkdir /gentoo/var
<span class=postbody1># mkdir /gentoo/var </span><br>
+
# mount -t ext3 /dev/hda3 /gentoo/var
<span class=postbody1># mount -t ext3 /dev/hda3 /gentoo/var </span><br>
+
 
<br>
+
=== Extracting Stage 3 ===
We now change directories to /gentoo and untar the system in what will be our root directory <br>
+
We now use our FTP client to upload system-20060108.tar.gz from http://www.kurobox.com/downloads/gentoo 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 http://www.kurobox.com/downloads/gentoo.  
<br>
+
 
<span class=postbody1>#cd /gentoo </span><br>
+
We now change directories to /gentoo and untar the system in what will be our root directory
<span class=postbody1># tar xvjf system-20060108.tar.gz </span><br>
+
# cd /gentoo
./bin/ <br>
+
# tar xvjf system-20060108.tar.gz  
./bin/gawk <br>
+
./bin/  
<br>
+
./bin/gawk  
<br>
+
  .
./var/state/.keep <br>
+
  .
./var/empty/ <br>
+
  .
./var/empty/.keep <br>
+
./var/state/.keep  
./bin/awk <br>
+
./var/empty/  
<span class=postbody1># </span><br>
+
./var/empty/.keep  
<br>
+
./bin/awk  
Next we mount /proc <br>
+
#
<br>
+
 
<span class=postbody1># mount -t proc none /gentoo/proc </span><br>
+
=== Chroot into new enviroment ===
<br>
+
Next we mount /proc  
and configure name resolution <br>
+
# mount -t proc none /gentoo/proc  
<br>
+
 
<span class=postbody1># cp -L /etc/resolv.conf /gentoo/etc/ </span><br>
+
and configure name resolution. The -L option makes sure we copy the actual file as opposed to a symbolic link.
<br>
+
And then we chroot into the new gentoo system <br>
+
# cp -L /etc/resolv.conf /gentoo/etc/  
<br>
+
 
<span class=postbody1># chroot /gentoo /bin/bash </span><br>
+
and then we chroot into the new gentoo system  
KURO-BOX-EM / # <br>
+
# chroot /gentoo /bin/bash  
<br>
+
KURO-BOX-EM / #  
We set up the terminal <br>
+
 
<br>
+
We set up the terminal  
KURO-BOX-EM / #export TERM=vt100 <br>
+
KURO-BOX-EM / #export TERM=vt100
<br>
+
 
Next we setup portage. This might be a good time to get a drink or walk the dog. <br>
+
=== Install portage ===
<br>
+
Next we setup portage. This might be a good time to get a drink or walk the dog.  
KURO-BOX-EM / #cd /var <br>
+
KURO-BOX-EM / # cd /var  
KURO-BOX-EM var #tar xvjf /portage-20060126.tar.gz <br>
+
KURO-BOX-EM var # tar xvjf /portage-20060126.tar.gz  
<br>
+
 
Next we install the portage overlay <br>
+
Next we install the portage overlay. I store my overlays in a subdirectory of /var/overlays. The subdirectory is based on the date of the overlay. Note that if the overlay you download is not a .gz file you should omit the z switch in the tar command below (tar xvf...).
<br>
+
 
KURO-BOX-EM var # mkdir overlays <br>
+
KURO-BOX-EM var # mkdir overlays  
KURO-BOX-EM var # cd overlays <br>
+
KURO-BOX-EM var # cd overlays  
KURO-BOX-EM overlays # mkdir 20060122 <br>
+
KURO-BOX-EM overlays # mkdir 20060122  
KURO-BOX-EM overlays # cd 20060122 <br>
+
KURO-BOX-EM overlays # cd 20060122  
KURO-BOX-EM 20060122 # tar xvjf /overlay-20060122.tar.gz <br>
+
KURO-BOX-EM 20060122 # tar xvjf /overlay-20060122.tar.gz  
<br>
+
profiles/  
profiles/ <br>
+
profiles/kurobox/  
profiles/kurobox/ <br>
+
profiles/kurobox/make.defaults  
profiles/kurobox/make.defaults <br>
+
  .
<br>
+
  .
<br>
+
  .
sys-kernel/modules-kurobox-hg/Manifest <br>
+
sys-kernel/modules-kurobox-hg/Manifest  
sys-kernel/modules-kurobox-hg/files/ <br>
+
sys-kernel/modules-kurobox-hg/files/  
sys-kernel/modules-kurobox-hg/files/digest-modules-kurobox-hg-2.4.17 <br>
+
sys-kernel/modules-kurobox-hg/files/digest-modules-kurobox-hg-2.4.17  
KURO-BOX-EM 20060122 # <br>
+
KURO-BOX-EM 20060122 #  
<br>
+
 
Now we create empty directories for distfiles and binaries <br>
+
Now we create empty directories for distfiles and binaries  
KURO-BOX-EM 20060122 # cd /var <br>
+
KURO-BOX-EM 20060122 # cd /var  
KURO-BOX-EM portage # mkdir packages ><br>
+
KURO-BOX-EM var # mkdir packages  
KURO-BOX-EM portage # mkdir distfiles <br>
+
KURO-BOX-EM var # mkdir distfiles  
<br>
+
 
Now we configure portage <br>
+
Now we configure portage. The GENTOO_MIRRORS and SYNC lines need to be adjusted for your location. Pick the three nearest sites listed at http://www.gentoo.org/main/en/mirrors.xml for your GENTOO_MIRRORS line. For Your SYNC line, your choices are namerica, samerica, europe, asia and au (australia) in place of namerica in my SYNC line. Also, make sure the PORTDIR_OVERLAY line matches the location of your overlay.
<br>
+
 
KURO-BOX-EM portage #cd /etc <br>
+
KURO-BOX-EM var # cd /etc
KURO-BOX-EM etc #nano make.conf <br>
+
KURO-BOX-EM etc # nano make.conf
<br>
+
 
<span class=postbody1>#The GENTOO_MIRRORS and SYNC lines need to be adjusted. Pick the three nearest sites listed at http://www.gentoo.org/main/en/mirrors.xml for your GENTOO_MIRRORS line. <br>
+
</span><br>
+
CFLAGS=&quot;-O2 -mcpu=603e -fno-strict-aliasing -pipe -fsigned-char&quot;  
CFLAGS=&quot;-O2 -mcpu=603e -fno-strict-aliasing -pipe -fsigned-char&quot; <br>
+
CXXFLAGS=&quot;${CFLAGS}&quot;  
CXXFLAGS=&quot;${CFLAGS}&quot; <br>
+
<br>
+
PORTDIR=/var/portage  
PORTDIR=/var/portage <br>
+
DISTDIR=/var/distfiles  
DISTDIR=/var/distfiles <br>
+
PKGDIR=/var/packages  
PKGDIR=/var/packages <br>
+
RPMDIR=/var/rpm  
RPMDIR=/var/rpm <br>
+
<span class=postbody1>#I store my overlays in a directory based on the date of the overlay </span><br>
+
PORTDIR_OVERLAY="/var/overlays/20060122"  
PORTDIR_OVERLAY="/var/overlays/20060122" <br>
+
<br>
+
RSYNC_EXCLUDEFROM=/etc/portage/rsync_excludes  
RSYNC_EXCLUDEFROM=/etc/portage/rsync_excludes <br>
+
<br>
+
GENTOO_MIRRORS="http://www.gatech.edu/pub/gentoo/ http://ftp.ucsb.edu/pub/mirro..."
GENTOO_MIRRORS="http://www.gatech.edu/pub/gentoo/ http://ftp.ucsb.edu/pub/mirro..."  
+
<br>
+
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"  
<br>
+
 
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" <br>
+
Next we set up the portage profile  
<br>
+
KURO-BOX-EM etc # rm make.profile
<br>
+
 
Next we set up the portage profile <br>
+
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.  
<br>
+
KURO-BOX-EM etc # ln -s ../var/overlays/20060122/profiles/kurobox make.profile  
KURO-BOX-EM etc #rm make.profile <br>
+
KURO-BOX-EM etc # cd /var/overlays  
<br>
+
 
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. <br>
+
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.  
<br>
+
KURO-BOX-EM overlays # echo "../../../../portage/profiles/default-linux/ppc/2005.1/ppc" > 20060122/profiles/kurobox/parent  
KURO-BOX-EM etc #ln -s ../var/overlays/20060122/profiles/kurobox make.profile <br>
+
KURO-BOX-EM overlays # cd /etc  
KURO-BOX-EM kurobox #cd /var/overlays <br>
+
 
<br>
+
Now let's regenerate the portage cache. This would be a good time for a bathroom break or a quick run to the store for a snack.  
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. <br>
+
KURO-BOX-EM etc # emerge metadata  
<br>
+
Updating Portage cache: 100%  
KURO-BOX-EM overlays # echo "../../../../portage/profiles/default-linux/ppc/2005.1/ppc" > 20060122/profiles/kurobox/parent <br>
+
KURO-BOX-EM etc #
KURO-BOX-EM overlays #cd /etc <br>
+
 
<br>
+
Now we'll check if the system is up to date while at the same time testing portage.
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. <br>
+
KURO-BOX-EM etc # emerge -puD system
<br>
+
 
KURO-BOX-EM etc #emerge metadata <br>
+
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.
<br>
+
 
Updating Portage cache: 100% <br>
+
== Configure New System ==
<br>
+
=== Configure mounts (fstab) ===
KURO-BOX-EM etc # <br>
+
We edit /etc/fstab as required. Here are the important parts of my fstab:
<br>
+
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.  
We edit /etc/fstab as required. Here are the important parts of my fstab: <br>
+
/dev/hda1    /          ext3    noatime      0      1
<br>
+
/dev/hda2    none        swap    sw          0      1  
<span class=postbody1># NOTE: If your BOOT partition is ReiserFS, add the notail option to opts. <br>
+
/dev/hda3    /var        ext3    noatime      0      2  
/dev/hda1    /          ext3    noatime      0      0 <br>
+
/dev/hda4    /datafiles  ext3    noatime      0      1
/dev/hda2    none        swap    sw          0      1 <br>
+
/dev/hda3    /var        ext3    noatime      0      2 <br>
+
# NOTE: The next line is critical for boot!
/dev/hda4    /datafiles  ext3    noatime      0      0 <br>
+
none          /proc      proc    defaults    0      0
<br>
+
 
<span class=postbody1># NOTE: The next line is critical for boot! </span><br>
+
=== Set Root Password ===
none          /proc      proc    defaults    0      0 <br>
+
Next we change the root password and add a user who is a member of wheel so they can su to root.  
<br>
+
KURO-BOX-EM etc # passwd  
<br>
+
New UNIX password:  
Now we'll check if the system is up to date <br>
+
Retype new UNIX password:  
<br>
+
passwd: password updated successfully  
KURO-BOX-EM etc #emerge -puD system <br>
+
KURO-BOX-EM etc # useradd dtaylor -m -G users,wheel -s /bin/bash  
<br>
+
KURO-BOX-EM etc # passwd dtaylor  
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. <br>
+
New UNIX password:  
<br>
+
Retype new UNIX password:  
Next we change the root password and add a user who is a member of wheel so they can su to root. <br>
+
passwd: password updated successfully  
<br>
+
KURO-BOX-EM etc #
KURO-BOX-EM etc #passwd <br>
+
 
New UNIX password: <br>
+
=== Configure Network ===
Retype new UNIX password: <br>
+
Next we configure the network.
passwd: password updated successfully <br>
+
KURO-BOX-EM etc # cd conf.d  
KURO-BOX-EM etc # useradd dtaylor -m -G users,wheel -s /bin/bash <br>
+
KURO-BOX-EM conf.d # cp net.example net  
KURO-BOX-EM etc # passwd dtaylor <br>
+
KURO-BOX-EM conf.d # nano net  
New UNIX password: <br>
+
 
Retype new UNIX password: <br>
+
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. In the example I have set the IP address to 192.168.0.9, the network mask to 255.255.255.0, and the gateway to 192.168.0.1. Do not uncomment the default via 4321:0:1:2:3:4:567:89ab". You will want to change the IP address, subnet mask, and gateway address to suit your network. If you want to use DCHP, don't edit the file at all as it defaults to DCHP.  
passwd: password updated successfully <br>
+
 
KURO-BOX-EM etc # <br>
+
config_eth0=( 192.168.0.9 netmask 255.255.255.0
<br>
+
broadcast 192.168.0.255 )  
Next we configure the network. <br>
+
<br>
+
routes_eth0=(  
KURO-BOX-EM etc #cd conf.d <br>
+
"default via 192.168.0.1"  
KURO-BOX-EM conf.d #cp net.example net <br>
+
# &quot;default via 4321:0:1:2:3:4:567:89ab&quot;  
KURO-BOX-EM conf.d #nano net <br>
+
)
<br>
+
 
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. In the example I have set the IP address to 192.168.0.9, the network mask to 255.255.255.0, and the gateway to 192.168.0.1. Do not uncomment the default via 4321:0:1:2:3:4:567:89ab". 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. <br>
+
 
<br>
+
Add net.eth0 to your default runlevel or you won't be able to log in.  
config_eth=( 192.168.0.9 netmask 255.255.255.0
+
KURO-BOX-EM conf.d # cd /etc  
broadcast 192.168.0.255 ) <br>
+
KURO-BOX-EM etc # rc-update add net.eth0 default  
<br>
+
 
routes_eth0=( <br>
+
Now we get SSH working. This step will take a few minutes and will throw a few errors.  
"default via 192.168.0.1" <br>
+
KURO-BOX-EM etc # /etc/init.d/sshd start  
<span class=postbody1># &quot;default via 4321:0:1:2:3:4:567:89ab&quot; </span><br>
+
 
)<br>
+
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.  
<br>
+
KURO-BOX-EM etc # /etc/init.d/sshd stop  
<br>
+
KURO-BOX-EM etc # rc-update add sshd default
Add net.eth0 to your default runlevel or you won't be able to log in. <br>
+
 
<br>
+
Next we make sure that the proper daemons are set to the default runlevel  
KURO-BOX-EM conf.d #cd /etc <br>
+
KURO-BOX-EM etc # ls runlevels/default/  
KURO-BOX-EM etc #rc-update add net.eth0 default <br>
+
local net.eth0 netmount sshd
<br>
+
 
Now we get SSH working. This step will take a few minutes and will throw a few errors. <br>
+
== Clean up and Reboot ==
<br>
+
and then we exit the chroot system  
KURO-BOX-EM etc #/etc/init.d/sshd start <br>
+
KURO-BOX-EM etc # exit  
<br>
+
#  
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. <br>
+
 
<br>
+
Unmount everything  
KURO-BOX-EM etc #/etc/init.d/sshd stop <br>
+
# cd /  
KURO-BOX-EM etc #rc-update add sshd dafault <br>
+
# umount /gentoo/var  
<br>
+
# umount /gentoo/proc  
Next we make sure that the proper daemons are set to the default runlevel <br>
+
# umount /gentoo  
<br>
+
 
KURO-BOX-EM etc # ls runlevels/default/ <br>
+
Set the box to boot to the new system  
local net.eth0 netmount sshd <br>
+
# echo -n &quot;OKOK&quot; &gt; /dev/fl3  
<br>
+
 
and then we exit the chroot system <br>
+
and then restart the system  
<br>
+
# shutdown -r now  
KURO-BOX-EM etc # exit <br>
+
 
<span class=postbody1># </span><br>
+
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.  
<br>
+
localhost ~ # cd /
Unmount everything <br>
+
localhost / # emerge -uD world
<span class=postbody1># cd / </span><br>
+
 
<span class=postbody1># umount /gentoo/var </span><br>
+
Alternatively, if you worried about your SSH connection being disconnected and losing any packages that have not finished being emerged, you can use the following.
<span class=postbody1># umount /gentoo/proc </span><br>
+
localhost ~ # cd /  
<span class=postbody1># umount /gentoo </span><br>
+
localhost / # nohup emerge -uD world &
<br>
+
localhost / # tail -f nohup.out
Set the box to boot to the new system <br>
+
 
<span class=postbody1># echo -n &quot;OKOK&quot; &gt; /dev/fl3 </span><br>
+
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.  
<br>
+
localhost / # etc-update
and then restart the system <br>
+
 
<span class=postbody1># shutdown -r now </span><br>
+
==Troubleshooting==
<br>
+
 
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. <br>
+
===CoreUtils - Access Violation===
<br>
+
Problem: Coreutil fails to unlink with a message :
KURO-BOX-EM # cd / <br>
+
--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
KURO-BOX-EM # emerge -uD world <br>
+
LOG FILE = "/var/log/sandbox/sandbox-sys-apps_-_coreutils-5.94-r1-31309.log"
<br>
+
unlink:    /var/tmp/portage/coreutils-5.94-r1/work/coreutils-5.94/confdir3/confdir3/
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. <br>
+
confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/
<br>
+
confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/
KURO-BOX-EM # etc-update </p>
+
confdir3/...
 +
 
 +
Solution:
 +
 
 +
This seems to be a bug in portage.  [http://forums.gentoo.org/viewtopic-t-199407-highlight-confdir3.html Access Violation during emerge -u system]
 +
 
 +
To work around, tell emerge to ignore the sandbox for this package:
 +
localhost / # FEATURES="-sandbox -usersandbox" emerge --oneshot coreutils
 +
{{Template:Articles|Kurobox|Gentoo}}

Latest revision as of 22:23, 15 November 2007

These instructions are a couple releases old. Use this method only if you want to customize your install! Each of the steps required to install Gentoo Linux on the Kurobox are shown here in detail, so you can tailor your install as you see fit. If you want to install Gentoo exactly as shown here without any customization and significantly less work, and you would like to avoid a lengthy (~48 hours) emerge -uD world, go to the 2007 PPC Gentoo Install page and follow the instructions there.


I'm sure I left something out, but the steps are here. 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 which destroys all data. You have been warned.

Contents

Preparing for Install

Start by using any FTP client to upload EM_mode_binaries.tar.bz2 (you can download it from http://kurobox.com/downloads/gentoo 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 
Password: kuro (kuroadmin on HG)

Lets see what we've got

# df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/ram0 9677 5102 4575 53% /  
# ls /tmp
EM_mode_binaries.tar.gz 

Install EM mode utilities

Change to the root and untar the binaries.

# cd / 
# tar xvzf /tmp/EM_mode_binaries.tar.gz 
bin/ 
bin/sfdisk bin/fdisk bin/bzip2 bin/date bin/chroot #

Check and set the date.

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

Partitioning & Formating HDD

We run fdisk and create partitions. I use four partitions: hda1 for /, hda2 for the swap space, hda3 for /var, and hda4 for data storage (/datafiles). This section from the Gentoo Handbook explains how to prepare your hard disk (create partitions). For most users, 10gb each for / on hda1 and /var on hda3 is adequate. 512mb is good for a swap space on hda2 and use the remainder for /datafiles on hda4. However you can decide which way you want to break up your hard disk. Remember you need to mount all of the drives (except the swap and /datafiles) before you untar the system file (More on that later).

# fdisk /dev/hda 

I have read that journaling and indexing will speed up your system. If you would like to setup journaling and indexing click here and follow the instructions for formatting your partitions. A tune2fs binary for the Kuro can be downloaded from http://www.kurobox.com/downloads/gentoo. When you are done, click the link to return to this page and you will be returned at the step where we create the swap space. If you don't want to set up full journaling and indexing just continue on with these instructions.


Once the partitions 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 
#

Install Gentoo KuroBox Stage 3

Mount new partitions

This will allow us to create the gentoo system on the hard drive instead of in the flash ram disk. We will create the directoy /gentoo mount /dev/hda1 there, then create /gentoo/var and mount /dev/hda3.

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

Extracting Stage 3

We now use our FTP client to upload system-20060108.tar.gz from http://www.kurobox.com/downloads/gentoo 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 http://www.kurobox.com/downloads/gentoo.

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 
./bin/ 
./bin/gawk 
  .
  .
  .
./var/state/.keep 
./var/empty/ 
./var/empty/.keep 
./bin/awk 
#

Chroot into new enviroment

Next we mount /proc

# mount -t proc none /gentoo/proc 

and configure name resolution. The -L option makes sure we copy the actual file as opposed to a symbolic link.

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

and then we chroot into the new gentoo system

# chroot /gentoo /bin/bash 
KURO-BOX-EM / # 

We set up the terminal

KURO-BOX-EM / #export TERM=vt100

Install portage

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. I store my overlays in a subdirectory of /var/overlays. The subdirectory is based on the date of the overlay. Note that if the overlay you download is not a .gz file you should omit the z switch in the tar command below (tar xvf...).

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 
profiles/ 
profiles/kurobox/ 
profiles/kurobox/make.defaults 
  .
  .
  .
sys-kernel/modules-kurobox-hg/Manifest 
sys-kernel/modules-kurobox-hg/files/ 
sys-kernel/modules-kurobox-hg/files/digest-modules-kurobox-hg-2.4.17 
KURO-BOX-EM 20060122 # 

Now we create empty directories for distfiles and binaries

KURO-BOX-EM 20060122 # cd /var 
KURO-BOX-EM var # mkdir packages 
KURO-BOX-EM var # mkdir distfiles 

Now we configure portage. The GENTOO_MIRRORS and SYNC lines need to be adjusted for your location. Pick the three nearest sites listed at http://www.gentoo.org/main/en/mirrors.xml for your GENTOO_MIRRORS line. For Your SYNC line, your choices are namerica, samerica, europe, asia and au (australia) in place of namerica in my SYNC line. Also, make sure the PORTDIR_OVERLAY line matches the location of your overlay.

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


CFLAGS="-O2 -mcpu=603e -fno-strict-aliasing -pipe -fsigned-char" 
CXXFLAGS="${CFLAGS}" 

PORTDIR=/var/portage 
DISTDIR=/var/distfiles 
PKGDIR=/var/packages 
RPMDIR=/var/rpm 

PORTDIR_OVERLAY="/var/overlays/20060122" 

RSYNC_EXCLUDEFROM=/etc/portage/rsync_excludes 

GENTOO_MIRRORS="http://www.gatech.edu/pub/gentoo/ http://ftp.ucsb.edu/pub/mirro..."

SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage" 

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 etc # 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 let's 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% 
KURO-BOX-EM etc # 

Now we'll check if the system is up to date while at the same time testing portage.

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.

Configure New System

Configure mounts (fstab)

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      1 
/dev/hda2     none        swap     sw           0      1 
/dev/hda3     /var        ext3     noatime      0      2 
/dev/hda4     /datafiles  ext3     noatime      0      1 

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

Set Root Password

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 
KURO-BOX-EM etc #

Configure Network

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. In the example I have set the IP address to 192.168.0.9, the network mask to 255.255.255.0, and the gateway to 192.168.0.1. Do not uncomment the default via 4321:0:1:2:3:4:567:89ab". You will want to change the IP address, subnet mask, and 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_eth0=( 192.168.0.9 netmask 255.255.255.0
broadcast 192.168.0.255 ) 

routes_eth0=( 
"default via 192.168.0.1" 
# "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 default 

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

Clean up and Reboot

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.

localhost ~ # cd / 
localhost / # emerge -uD world 

Alternatively, if you worried about your SSH connection being disconnected and losing any packages that have not finished being emerged, you can use the following.

localhost ~ # cd / 
localhost / # nohup emerge -uD world & 
localhost / # tail -f nohup.out 

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.

localhost / # etc-update

Troubleshooting

CoreUtils - Access Violation

Problem: Coreutil fails to unlink with a message :

--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
LOG FILE = "/var/log/sandbox/sandbox-sys-apps_-_coreutils-5.94-r1-31309.log"
unlink:     /var/tmp/portage/coreutils-5.94-r1/work/coreutils-5.94/confdir3/confdir3/
confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/
confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/confdir3/
confdir3/...

Solution:

This seems to be a bug in portage. Access Violation during emerge -u system

To work around, tell emerge to ignore the sandbox for this package:

localhost / # FEATURES="-sandbox -usersandbox" emerge --oneshot coreutils