Administrate Your Gentoo System

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 00:52, 15 March 2006 by Viscous liquid (Talk)

Jump to: navigation, search

How to administrate your Gentoo system

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:

  • Part II of the Gentoo Handbook
  • The excellent Gentoo security guide
  • The Gentoo Samba howto, and many other specific guides.


Contents


Environmental files

Now is a good time to set up your ~/.bashrc (configuration for shell) file. Every administrator has their own preferencies, but at a very minimum, I'd suggest the following:

export EDITOR=vi
export CVS_RSH=ssh
export TERM=vt100
alias ls="ls -hqp --color"
alias c=clear
alias r="fc -e - "

Change vi to your prefered editor. You might want to change TERM, too. The ls alias line produces a more readable output (and coloured, too). You can use fc -l 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 fc -l output). c clears the terminal window.

How to install binary packages

The Gentoo/Kuro project will try to provide up-to-date binary packages for some commonly used applications that take much time to compile on a Kurobox (like apache, mysql, etc.) Using binary packages may seems unusual on a Gentoo system, but is actually really easy. In /etc/make.conf, declare the hosts of binaries you want to use:

PORTAGE_BINHOST="http://tdegreni.free.fr/kurobox/packages/"

Then, when you want "emerge" to fetch a binary package instead of compiling, use the -g option. For instance:

# emerge -g mysql

If no suitable binary is found, emerge will fallback to an usual from-sources installation. If you want to accept only binary package, then use -G instead of -g. Finally, if you want emerge to always try to get a binary prior to compiling, then you can add getbinpkg to your FEATURES in /etc/make.conf.

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

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.

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

Keep your box on time

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:

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

Using ntp

Ntp is a protocol that permits syncing time with other servers. Once configured, your box will always stay perfectly on time, and can also be turned into a time server for the other machines of your LAN. A net-misc/ntp binary package is available, so you can emerge -g it. For the configuration, I suggest you read the Howto NTP from the Gentoo Wiki.

Some system packages you should really install

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

A log daemon

Possible choices are:

app-admin/syslog 
app-admin/metalog
app-admin/syslog-ng

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

# rc-update add syslog-ng default

A cron daemon

I suggest you try sys-apps/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.). It is available as binary package. Oh, and that also should be added to the default runlevel.

Logrotate

That's the complement of your logger daemon, to avoid having your /var/log growing again and again. <code>emerge logrotate, 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. emerge 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.