HowTos for general administration

The Getting Started and Maintenance chapters describe how to get started with Debian Edu and how to do the basic maintenance work. The howtos in this chapter have some more "advanced" tips and tricks.

Configuration history: tracking /etc/ using the git version control system

With the introduction of etckeeper in Debian Edu Squeeze (previous versions used etcinsvk which was removed from Debian), all files in /etc/ are tracked using git as a version control system.

This makes it possible to see when a file is added, changed and removed, as well as what was changed if the file is a text file. The git repository is stored in /etc/.git/.

Every hour, any changes are automatically recorded, allowing configuration history to be extracted and reviewed.

To look at the history, the command etckeeper vcs log is used. To check the differences between two points in time, a command like etcinsvk vcs diff  can be used.

See the output of man etckeeper for more information.

List of useful commands:

etckeeper vcs log
etckeeper vcs status
etckeeper vcs diff
etckeeper vcs add .
etckeeper vcs commit -a
man etckeeper

Usage examples

On a freshly installed system, try this to see all changes done since the system was installed:

etckeeper vcs log

See which files are currently not tracked and which are not up-to-date:

etckeeper vcs status

To manually commit a file, because you don't want to wait up to an hour:

etckeeper vcs commit -a /etc/resolv.conf

Resizing Partitions

In Debian Edu, all partitions other than the /boot/ partition are on logical LVM volumes. With Linux kernels since version 2.6.10, it is possible to extend partitions while they are mounted. Shrinking partitions still needs to happen while the partition is unmounted.

It is a good idea to avoid creating very large partitions (over, say, 20GiB), because of the time it takes to run fsck on them or to restore them from backup if the need arises. It is better, if possible, to create several smaller partitions than one very large one.

The helper script debian-edu-fsautoresize is provided to make it easier to extend full partitions. When invoked, it reads the configuration from /usr/share/debian-edu-config/fsautoresizetab, /site/etc/fsautoresizetab and /etc/fsautoresizetab. It then proposes to extend partitions with too little free space, according to the rules provided in these files. If run with no arguments, it will only show the commands needed to extend the file system. The argument -n is needed to actually execute these commands to extend the file systems.

The script is executed automatically every hour on every client listed in the fsautoresize-hosts netgroup.

When the partition used by the Squid proxy is resized, the value for cache size in etc/squid/squid.conf needs to be updated as well. The helper script /usr/share/debian-edu-config/tools/squid-update-cachedir is provided to do this automatically, checking the current partition size of /var/spool/squid/ and configuring Squid to use 80% of this as its cache size.

Logical Volume Management

Logical Volume Management (LVM) enables resizing the partitions while they are mounted and in use. You can learn more about LVM from the LVM HowTo.

To extend a logical volume manually you simply tell the lvextend command how large you want it to grow to. For example, to extend home0 to 30GB you use the following commands:

lvextend -L30G /dev/vg_system/skole+tjener+home0
resize2fs /dev/vg_system/skole+tjener+home0

To extend home0 by additional 30G, you insert a '+' (-L+30G)

Installing a graphical environment on the main-server to use GOsa²

If you (probably accidentally) installed a pure main-server profile and don't have a client with a web-browser handy, it's easy to install a minimal desktop on the main server using this command sequence in a (non-graphical) shell as the user you created during the main server's installation (first user):

  $ sudo apt-get update
  $ sudo apt-get install gnome-session gnome-terminal iceweasel xorg
  # after installation, start a graphical session for the first user 
  $ startx

Using ldapvi

ldapvi is a tool to edit the LDAP database with a normal text editor on the commandline.

The following needs to be executed:

ldapvi --ldap-conf -ZD '(cn=admin)'

Note: ldapvi will use whatever is the default editor. By executing export EDITOR=vim in the shell prompt one can configure the environment to get a vi clone as editor.

To add an LDAP object using ldapvi, use object sequence number with the string add in front of the new LDAP object.

/!\ Warning: ldapvi is a very powerful tool. Be careful and don't mess up the LDAP database, same warning applies for JXplorer.

JXplorer, an LDAP GUI

If you prefer a GUI to work with the LDAP database, check out the jxplorer package, wich is installed by default. To get write access connect like this:

host: ldap.intern
port:636
Base dn:dc=skole,dc=skolelinux,dc=no 
Security level: ssl + user + password
User dn: cn=admin,ou=ldap-access

Click "This session only" if asked for the certificate.

ldap-createuser-krb, a command-line tool

ldap-createuser-krb is a small command line tool to create LDAP users and set their passwords in Kerberos. It's mostly useful for testing, though.

Using stable-updates (formerly known as volatile)

Since the Squeeze release, Debian has included packages formerly maintained in volatile.debian.org in the 2011 created stable-updates suite.

While you can use stable-updates directly, you don't have to: stable-updates are pushed into the stable suite regularily when stable point releases are done, which roughly happens every two months.

Using backports.debian.org to install newer software

You are running Debian Edu because you prefer the stability of Debian Edu. It runs great; there is just one problem: sometimes software is a little bit more outdated than you like. This is where backports.debian.org steps in.

Backports are recompiled packages from Debian testing (mostly) and Debian unstable (in a few cases only, e.g. security updates), so they will run without new libraries (wherever this is possible) on a stable Debian distribution like Debian Edu. We recommend you to pick out individual backports which fit your needs, and not to use all backports available there.

Using backports is simple:

echo "deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt sources.list
apt-get update

After which one can install backported packages easily, the following command will install a backported version of tuxtype:

apt-get install -t wheezy-backports tuxtype

Backports are automatically updated (if available) just like other packages. (Previously, extra configuration was needed to achieve this, but since 2011 this [[http://backports.debian.org/news/squeeze-backports_and_lenny-backports-sloppy_started/|is not needed anymore].

Like the normal archive, backports has three sections: main, contrib and non-free.

Upgrading with a CD or similar image

If you want to upgrade from one version to another (for example from Wheezy 7.1+edu0 to 7.3+edu1) but you do not have Internet connectivity, only physical media, follow these steps:

Insert the CD / DVD / Blue-ray disc / USB flash drive, mount it and use the apt-cdrom command:

mount /media/cdrom
apt-cdrom add -m

To quote the apt-cdrom(8) man page:

Then run these two commands to upgrade the system:

apt-get update
apt-get upgrade

Automatic cleanup of leftover processes

killer is is a perl script that gets rid of background jobs. Background jobs are defined as processes that belong to users who are not currently logged into the machine. It's run by cron job once an hour.

To install it run the following command as root:

 apt-get install killer

Automatic installation of security upgrades

unattended-upgrades is a Debian package which will install security (and other) updates automatically. If you plan to use it, you should have some means to monitor your systems, such as installing the apt-listchanges package and configuring it to send you emails about updates. And there is always /var/log/dpkg.log.

To install these packages run the following command as root:

 apt-get install unattended-upgrades apt-listchanges

Automatic shutdown of machines during the night

It is possible to save energy and money by automatically turning client machines off at night and back on in the morning. The package will try to turn off the machine every hour on the hour from 16:00 in the afternoon, but will not turn it off if it seems to have users. It will try to tell the BIOS to turn on the machine around 07:00 in the morning, and the main-server will try to turn on machines from 06:30 by sending wake-on-lan packets. These times can be changed in the crontabs of individual machines.

Some considerations should be kept in mind when setting this up:

How to set up shutdown-at-night

On clients that should turn off at night, touch /etc/shutdown-at-night/shutdown-at-night, or add the hostname (that is, the output from 'uname -n' on the client) to the netgroup "shutdown-at-night-hosts". Adding hosts to the netgroup in LDAP can be done using the GOsa² web tool. The clients might need to have wake-on-lan configured in the BIOS. It is also important that the switches and routers used between the wake-on-lan server and the clients will pass the WOL packets to the clients even if the clients are turned off. Some switches fail to pass on packets to clients that are missing in the ARP table on the switch, and this blocks the WOL packets.

To enable wake-on-lan on the server, add the clients to /etc/shutdown-at-night/clients, with one line per client, IP address first, followed by MAC address (ethernet address), separated by a space; or create a script /etc/shutdown-at-night/clients-generator to generate the list of clients on the fly.

Here is an example /etc/shutdown-at-night/clients-generator for use with sitesummary:

  #!/bin/sh
  PATH=/usr/sbin:$PATH
  export PATH
  sitesummary-nodes -w

An alternative if the netgroup is used to activate shutdown-at-night on clients is this script using the netgroup tool from the ng-utils package:

  #!/bin/sh
  PATH=/usr/sbin:$PATH
  export PATH
  netgroup -h shutdown-at-night-hosts

Access Debian-Edu servers located behind a firewall

To access machines behind a firewall from the Internet, consider installing the package autossh. It can be used to set up an SSH tunnel to a machine on the Internet that you have access to. From that machine, you can access the server behind the firewall via the SSH tunnel.

Installing additional service machines for spreading the load from main-server

In the default installation, all services are running on the main-server, tjener. To simplify moving some to another machine, there is a minimal installation profile available. Installing with this profile will lead to a machine, which is part of the Debian Edu network, but which doesn't have any services running (yet).

These are the required steps to setup a machine dedicated to some services:

HowTos from wiki.debian.org

The HowTos from http://wiki.debian.org/DebianEdu/HowTo/ are either user- or developer-specific. Let's move the user-specific HowTos over here (and delete them over there)! (But first ask the authors (see the history of those pages to find them) if they are fine with moving the howto and putting it under the GPL.)

CategoryPermalink