Difference between revisions of "Install the Gentoo Image"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(Configure Network)
Line 106: Line 106:
  
 
== Configure Network ==
 
== Configure Network ==
Next we configure the network. If you want to use DCHP, you can skip this step as the image is configured for DCHP.  
+
Next we configure the network. If you want to use DCHP, you can skip this step as the image is configured for DCHP. We need nano to edit the file so we'll grab it from the new system.
  
 +
KURO-BOX-EM etc # cp /gentoo/usr/sbin/nano /usr/sbin
 
  KURO-BOX-EM etc # cd conf.d  
 
  KURO-BOX-EM etc # cd conf.d  
 
  KURO-BOX-EM conf.d # nano net  
 
  KURO-BOX-EM conf.d # nano net  

Revision as of 14:37, 31 May 2006

Using this method, you can install an entire Gentoo image complete with portage and overlay 20060216 in about 30 minutes. This image was created on 5/30/2006 immediately following a deep world update. I will periodically perform a deep world update and replace the image located at www.kurobox.com/downloads/gentoo/gentoo-image.tgz. If you are aware of a major update that should be included in this image please email dtaylor at kurobox dot com with a description of the update and I will put it on my very long list of things to do.

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

Note: The /etc/fstab file that comes with the Gentoo image is configured to work with 
this harddisk partitioning scheme. If you want to use a different partitioning scheme
you must edit /etc/fstab accordingly.

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 image (More on that later).

# fdisk /dev/hda 

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 Image

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 the Image

We now use our FTP client to upload gentoo-image.tgz from http://www.kurobox.com/downloads/gentoo to the /gentoo directory on the kuro.

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

# cd /gentoo
# tar zxvf gentoo-image.tgz 

Once the image is untarred we can delete the image from /gentoo.

# rm gentoo-image.tgz 

Next we change the GENTOO_MIRRORS and SYNC lines in /etc/make.conf to suit 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.

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

Configure Network

Next we configure the network. If you want to use DCHP, you can skip this step as the image is configured for DCHP. We need nano to edit the file so we'll grab it from the new system.

KURO-BOX-EM etc # cp /gentoo/usr/sbin/nano /usr/sbin
KURO-BOX-EM etc # cd conf.d 
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.

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" 
)

Clean up and Reboot

Unmount everything

# cd / 
# umount /gentoo/var 
# 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. The first time the system boots it will take a while as it needs to generate the certificates used by sshd. Login with user id root and password kurobox.

Post Installation Tasks

First we set the root password and create a new user who is a member of wheel so they can su to root.

kurobox ~ # cd /
kurobox # passwd 
New UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully 
localhost # useradd dtaylor -m -G users,wheel -s /bin/bash 
kurobox # passwd dtaylor 
New UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully 
kurobox #

Now would be a good time to update everything. This shouldn't take too long as an emerge -uD world was run on the image prior to creating the tarball on 5/30/06.

 kurobox / # emerge -uD world 

Last, if anything was updated and portage says we need to update update our config files we run etc-update. 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.

kurobox / # etc-update

That's it. You're done. You should consider going to the Administrate your Gentoo System page and installing some system utilities.