Difference between revisions of "Administrate Your Gentoo System"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(Keep Gentoo Up-to-date)
m (How to install binary packages)
Line 28: Line 28:
 
; <code>--verbose (-v)</code> : 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.
 
; <code>--verbose (-v)</code> : 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.
  
== How to install binary packages ==
+
== 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.)
+
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 seems unusual on a Gentoo system, but is actually really easy. In ''/etc/make.conf'', declare the hosts of binaries you want to use:
+
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:
 
  PORTAGE_BINHOST="http://tdegreni.free.fr/kurobox/packages/"
 
  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:
+
Then, when you want to emerge a binary package instead of compiling from the source, use the ''-g'' switch. For example:
  # emerge -g mysql
+
  # emerge -g dev-db/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''.
+
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 '''<code>getbinpkg</code>''' to FEATURES in ''/etc/make.conf''.
  
 
[TODO: pros and cons of binary packages, relation to USE flags, etc.]
 
[TODO: pros and cons of binary packages, relation to USE flags, etc.]
 +
 +
--[[User:Jkk|Jkk]] 09:29, 10 July 2006 (CDT) The last update to the PORTAGE_BINHOST was made March 6th, 2006.
  
 
== The power/reset buttons explained ==
 
== The power/reset buttons explained ==

Revision as of 14:29, 10 July 2006

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

Customize Your Environment

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.

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 preferred editor. Other possible options are vim or nano. 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.

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:

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

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.

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 (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. 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 Linux 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 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:

# rc-update add syslog-ng default

A cron daemon (scheduler)

I suggest you try sys-process/fcron: 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.

Logrotate

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