Now is a good time to set up your Linux environment, starting with the ''~/.bashrc'' (configuration for shell) file. Every administrator has their own preferencies, but we suggest the following lines.

+

Now is a good time to set up your Linux environment. We're going to configure some global Gentoo settings so that all users will benefit. Individual users can customize their own settings using the ''.bashrc'' file in their home directory.

−

export EDITOR=vi

+

−

export CVS_RSH=ssh

+

First off we will configure our default text editor. This will be the editor used by tools such as '''<code>vipw</code>'''. To set the default editor, change the <code>EDITOR</code> variable in the ''/etc/rc.conf'' file:

−

export TERM=vt100

+

−

alias ls="ls -hqp --color"

+

EDITOR="vi"

+

+

Gentoo defaults to '''<code>nano</code>''' as the editor, this is a simpler editor than vi and should be used if you've not worked with vi/vim before.

+

+

You may also want to configure the root shell to use colour. To do this, copy everything from ''/etc/skel'' to root's home directory. When creating new users, the '''<code>useradd</code>''' command will create a home directory and copy these files for you if you specify the -m option.

+

+

Finally, we'll set up a few aliases to make life easier. You can add these lines to your ''~/.bashrc'' file and they will only apply to you. If you want these aliases to be set for all users, you can create a ''/etc/profile.d'' folder and put these settings in a file called ''aliases'' (or whatever you like) in there.

+

alias c=clear

alias c=clear

alias r="fc -e - "

alias r="fc -e - "

+

alias h="fc -l"

−

Change '''<code>vi</code>''' to your preferred editor. Other possible options are '''<code>vim</code>''' or '''<code>nano</code>'''. You might want to change '''<code>TERM</code>''', too. The '''<code>ls</code>''' alias line produces a more readable output (and coloured, too). You can use '''<code>fc -l</code>''' to list recent commands and '''<code>r</code>''' to repeat them ('''<code>r</code>''' repeats the last, '''<code>r foo</code>''' repeats the last command beginning '''<code>foo</code>''' and '''<code>r nnn</code>''' repeats command number '''<code>nnn</code>''' from the '''<code>fc -l</code>''' output). '''<code>c</code>''' clears the terminal window.

+

These aliases allow you to use '''<code>h</code>''' to list recent commands and '''<code>r</code>''' to repeat them ('''<code>r</code>''' repeats the last, '''<code>r foo</code>''' repeats the last command beginning '''<code>foo</code>''' and '''<code>r nnn</code>''' repeats command number '''<code>nnn</code>''' from the '''<code>h</code>''' output). '''<code>c</code>''' clears the terminal window.

== Keep Gentoo Up-to-date ==

== Keep Gentoo Up-to-date ==

Line 50:

Line 59:

For technical details about this feature, check the [[Survive without ppc_uartd]] page.

For technical details about this feature, check the [[Survive without ppc_uartd]] page.

−

== Keep your box on time ==

+

== Keep on Time ==

−

=== Timezone ===

+

=== Set Your Timezone ===

−

The first thing to do if the clock of your box is important to you is to set its timezone (yeah, that could have been in the install guide, i forgot). It is as simple as creating the right symlink at the right place:

+

The first thing to do if the your Kurobox's system time is important to you is to set the timezone. This is as simple as creating a symlink to ''/etc/localtime'' from the right place. Timezone files are stored in /usr/share/zoneinfo. You will need to search around for the appropriate file to link from.

# ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime

# ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime

−

# ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime

−

=== Using NTP ===

+

=== Set the Hardware Clock ===

−

NTP (Network Time Protocol) is a protocol that synchronizes system clocks with other servers. Once configured, your box will always stay perfectly on time, and can also serve as the primary time server for other machines in your network.

+

The hardware clock in the Kurobox may be set to Japanese time, so the system clock will be adjusted each time Gentoo boots. To fix this, set the hardware clock using ''/sbin/hwclock'':

−

A '''<code>net-misc/ntp binary package</code>''' is available, so you can '''<code>emerge -g</code>''' it.

+

# /sbin/hwclock --set --date="12/31/2007 18:13:00"

−

For the configuration, I suggest you read the [http://gentoo-wiki.com/NTP HOWTO NTP] from the Gentoo Linux Wiki.

+

−

== Some system packages you should really install ==

+

Alternatively, you can edit ''/etc/conf.d/clock'' so the hardware clock is set during shutdown - this should work well when combined with a running ntp client:

−

Right after the installation, your system is really minimalistic. Here are a few packages that you probably should install:

+

# /etc/conf.d/clock

−

=== A log daemon ===

+

CLOCK_SYSTOHC="yes"

−

Possible choices are:

+

−

app-admin/syslog

+

=== Install NTP ===

−

app-admin/metalog

+

NTP (Network Time Protocol) is a protocol that synchronizes the system clock with other servers. Once configured, your Kurobox will always stay perfectly on time, and can also serve as the primary time server to other machines in your network.

−

app-admin/syslog-ng

+

A '''net-misc/ntp''' binary package is available, so you can use '''<code>emerge -g</code>'''. We recommend you read [http://gentoo-wiki.com/NTP HOWTO NTP] from the Gentoo Linux Wiki for configuration instructions.

−

I personally prefer syslog-ng, thus that's the one i provide as binary package. But metalog is also worth a try, feel free to compile it. And once you've installed and configured one, remember to add it to the default runlevel:

+

+

== Recommended Packages ==

+

After the initial installation, your system will be very minimalistic. Here are a few packages that are not necessary for Gentoo to function, but we recommend you install them.

+

=== Log Daemon ===

+

The original author of this article personally prefers '''app-admin/syslog''' and has made this available as a binary package. However, the author also mentions that '''app-admin/metalog''' is worth a try.

+

+

Once you've installed and configured your log daemon, remember to add it to the default runlevel:

# rc-update add syslog-ng default

# rc-update add syslog-ng default

+

To complement this, and to avoid having your ''/var/log'' growing enormously large, use '''app-admin/logrotate''' to rotate, compress, and/or mail log files to you. You should add this as a cron job.

−

=== A cron daemon (scheduler) ===

+

=== Task Scheduler (cron daemon) ===

−

I suggest you try '''<code>sys-process/fcron</code>''': it can understand traditional crontabs (à la vixie-cron and friends), but adds many other useful features (daily/weekly/etc. targets, cpu load control, per-user crontabs, etc.) and does not require your Kurobox to be on 24 hours a day. This should also be added to the default runlevel.

+

If you would like to automate scripts to run at certain times, you will need a cron daemon. We suggest you try '''sys-process/fcron'''; it can understand traditional crontabs (à la vixie-cron and friends), but adds many other useful features and does not require your Kurobox to be on twenty-four hours a day. This should also be added to the default runlevel.

+

+

=== /tmp Cleaner ===

+

Just like your system logs, you will want to keep your ''/tmp'' directory size under control. You can use '''app-admin/tmpreaper'''.

−

=== Logrotate ===

−

That's the complement of your logger daemon, to avoid having your ''/var/log'' growing again and again. '''<code>emerge logrotate</code>''', configure it, and check it is in your cron jobs.

−

=== Tmpreaper ===

−

Just like logrotate, you probably want that to keep your ''/tmp'' size under control. '''<code>emerge tmpreaper</code>'''.

== Kernel modules ==

== Kernel modules ==

Depending if you are using a Kuro or a Kuro/HG, the compiled kernel modules are in two different packages:

Depending if you are using a Kuro or a Kuro/HG, the compiled kernel modules are in two different packages:

Line 83:

Line 96:

sys-kernel/modules-kurobox-hg

sys-kernel/modules-kurobox-hg

You probably want to install one of this package. I've not much looked at the old Kuro ones, but the HG ones for instance add the generic scsi driver (which i think is required for mounting usb devices), more filesystems, more NLS encodings, etc. If there are there some modules you want loaded on boot, add them to ''/etc/modules.autoload.d/kernel-2.4'', and run '''<code>update-modules</code>'''.

You probably want to install one of this package. I've not much looked at the old Kuro ones, but the HG ones for instance add the generic scsi driver (which i think is required for mounting usb devices), more filesystems, more NLS encodings, etc. If there are there some modules you want loaded on boot, add them to ''/etc/modules.autoload.d/kernel-2.4'', and run '''<code>update-modules</code>'''.

−

+

{{Template:Articles|Kurobox|Gentoo}}

−

[[Category:Gentoo]]

+

−

[[Category:HowTo]]

+

Latest revision as of 10:00, 15 December 2009

This document is not meant to become a generic Gentoo administration guide, but more to collect a few tricks specific to the usage of the distribution on a Kurobox. For a more general documentation, please refer to the official documentation, in particular:

Customize Your Environment

Now is a good time to set up your Linux environment. We're going to configure some global Gentoo settings so that all users will benefit. Individual users can customize their own settings using the .bashrc file in their home directory.

First off we will configure our default text editor. This will be the editor used by tools such as vipw. To set the default editor, change the EDITOR variable in the /etc/rc.conf file:

EDITOR="vi"

Gentoo defaults to nano as the editor, this is a simpler editor than vi and should be used if you've not worked with vi/vim before.

You may also want to configure the root shell to use colour. To do this, copy everything from /etc/skel to root's home directory. When creating new users, the useradd command will create a home directory and copy these files for you if you specify the -m option.

Finally, we'll set up a few aliases to make life easier. You can add these lines to your ~/.bashrc file and they will only apply to you. If you want these aliases to be set for all users, you can create a /etc/profile.d folder and put these settings in a file called aliases (or whatever you like) in there.

alias c=clear
alias r="fc -e - "
alias h="fc -l"

These aliases allow you to use h to list recent commands and r to repeat them (r repeats the last, r foo repeats the last command beginning foo and r nnn repeats command number nnn from the h output). c clears the terminal window.

Keep Gentoo Up-to-date

One of the advantages of using the Gentoo distribution is it's package management system known as portage. You used this before when you first installed, but it's always a good idea to continue to keep your system up-to-date with the latest stable ppc packages (and non-stable ~ppc packages if you are adventurous!).

Use the following command to update your portage tree. This will synchronize the portage tree with an official Gentoo mirror, and let your system know what is the status of the latest packages. You can run this as a cron job, or manually when you've got some time.

emerge --sync

Once you've done this, you can update any packages that need to be updated. You can use the command below to do that. A description of what the switches do (from man emerge) is listed below that.

emerge -uNDv world

--update (-u)

Updates packages to the best version available, which may not always be the highest version number due to masking for testing and development. This will also update direct dependencies which may not be what you want. In general, use this option only in combination with the world or system target.

--newuse (-N)

Tells emerge to include installed packages where USE flags have changed since compilation. An asterisk marks when a USE flag has changed since the package was compiled.

--deep (-D)

When used in conjunction with --update, this flag forces emerge to consider the entire dependency tree of packages, instead of checking only the immediate dependencies of the packages. As an example, this catches updates in libraries that are not directly listed in the dependencies of a package.

--verbose (-v)

Tell emerge to run in verbose mode. Currently this flag causes emerge to print out GNU info errors, if any, and to show the USE flags that will be used for each package when pretending.

Install Binary Packages

Project Gentoo on the Kurobox will try to provide up-to-date binary packages for some commonly used applications that take a long time to build, such as net-www/apache, dev-db/mysql, etc.
Using binary packages may seem like an unusual practice for a Gentoo system, but it is actually very simple. In /etc/make.conf, declare the hosts of binaries you want to use:

Then, when you want to emerge a binary package instead of compiling from the source, use the -g switch. For example:

# emerge -g dev-db/mysql

If a suitable binary is not found, emerge will fallback to installing from the source code. If you only want to accept binary packages, use the -G switch instead of -g. Finally, if you want emerge to always try to get a binary prior to compiling without having to use the switch every time, add getbinpkg to FEATURES in /etc/make.conf.

[TODO: pros and cons of binary packages, relation to USE flags, etc.]

--Jkk 09:29, 10 July 2006 (CDT) The last update to the PORTAGE_BINHOST was made March 6th, 2006.

The power/reset buttons explained

Your Gentoo system has a special setup for the power (the one in front of the box) and reset (the small one on the back) buttons:

to shut down your box, press the front button for ~6 seconds. That will do a "shutdown -h now".

to reset your box, push the front button twice in less than 3 seconds. This will do a "shutdown -r now".

to reset your box in EM mode (in case of troubles), press the back button for ~6 seconds.

Keep on Time

Set Your Timezone

The first thing to do if the your Kurobox's system time is important to you is to set the timezone. This is as simple as creating a symlink to /etc/localtime from the right place. Timezone files are stored in /usr/share/zoneinfo. You will need to search around for the appropriate file to link from.

# ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime

Set the Hardware Clock

The hardware clock in the Kurobox may be set to Japanese time, so the system clock will be adjusted each time Gentoo boots. To fix this, set the hardware clock using /sbin/hwclock:

# /sbin/hwclock --set --date="12/31/2007 18:13:00"

Alternatively, you can edit /etc/conf.d/clock so the hardware clock is set during shutdown - this should work well when combined with a running ntp client:

# /etc/conf.d/clock
CLOCK_SYSTOHC="yes"

Install NTP

NTP (Network Time Protocol) is a protocol that synchronizes the system clock with other servers. Once configured, your Kurobox will always stay perfectly on time, and can also serve as the primary time server to other machines in your network.
A net-misc/ntp binary package is available, so you can use emerge -g. We recommend you read HOWTO NTP from the Gentoo Linux Wiki for configuration instructions.

Recommended Packages

After the initial installation, your system will be very minimalistic. Here are a few packages that are not necessary for Gentoo to function, but we recommend you install them.

Log Daemon

The original author of this article personally prefers app-admin/syslog and has made this available as a binary package. However, the author also mentions that app-admin/metalog is worth a try.

Once you've installed and configured your log daemon, remember to add it to the default runlevel:

# rc-update add syslog-ng default

To complement this, and to avoid having your /var/log growing enormously large, use app-admin/logrotate to rotate, compress, and/or mail log files to you. You should add this as a cron job.

Task Scheduler (cron daemon)

If you would like to automate scripts to run at certain times, you will need a cron daemon. We suggest you try sys-process/fcron; it can understand traditional crontabs (à la vixie-cron and friends), but adds many other useful features and does not require your Kurobox to be on twenty-four hours a day. This should also be added to the default runlevel.

/tmp Cleaner

Just like your system logs, you will want to keep your /tmp directory size under control. You can use app-admin/tmpreaper.

Kernel modules

Depending if you are using a Kuro or a Kuro/HG, the compiled kernel modules are in two different packages:

sys-kernel/modules-kurobox
sys-kernel/modules-kurobox-hg

You probably want to install one of this package. I've not much looked at the old Kuro ones, but the HG ones for instance add the generic scsi driver (which i think is required for mounting usb devices), more filesystems, more NLS encodings, etc. If there are there some modules you want loaded on boot, add them to /etc/modules.autoload.d/kernel-2.4, and run update-modules.