/[fai]/branches/stable/3.4/doc/fai-guide.txt
ViewVC logotype

Contents of /branches/stable/3.4/doc/fai-guide.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6110 - (hide annotations) (download)
Tue Oct 5 15:16:40 2010 UTC (2 years, 7 months ago) by mika
File MIME type: text/plain
File size: 106266 byte(s)
add more detailed list of tasks
1 lange 5499 ////
2 lange 5549 -*- Doc -*-
3     ////
4 lange 5499
5     FAI Guide (Fully Automatic Installation)
6     ========================================
7     Thomas Lange <lange@informatik.uni-koeln.de>
8 mika 6110 3.0.2, Tue 28 Sep 2010 15:28:00 +0200
9 lange 5499
10     :faiver: 3.3
11     :nfsrootsize: 380
12 lange 5549 :mirrorsize: 22
13 lange 5499
14     ////
15     <tt> => _
16     <file => '
17     <var> => +
18     <prgn> =>` ` (wie manref)
19     <em> => _
20     ////
21    
22    
23    
24     .Abstract
25     FAI is a non-interactive system to install, customize and manage Linux
26     systems and software configurations on computers as well as virtual
27     machines and chroot environments, from small networks to large
28     infrastructures and clusters.
29    
30     This manual describes the Fully Automatic Installation package. This
31     includes the installation of the package, planning and creating of the
32     configuration and how to deal with errors.
33    
34 lange 5732 (c) 2000-2010 Thomas Lange
35 lange 5626
36 lange 5499 (c) 2005 Henning Glawe
37    
38    
39     .Copyright
40     This manual is free software; you may redistribute it and/or modify it
41     under the terms of the GNU General Public License as published by the
42     Free Software Foundation; either version 2, or (at your option) any
43     later version.
44    
45     This is distributed in the hope that it will be useful, but *without
46     any warranty*; without even the implied warranty of merchantability or
47     fitness for a particular purpose. See the GNU General Public License
48     for more details.
49    
50     A copy of the GNU General Public License is available as
51     '/usr/share/common-licenses/GPL' in the Debian GNU/Linux distribution
52     or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html[the
53     GNU website] You can also obtain it by writing to the Free Software
54     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
55     USA
56    
57     == [[introduction]]Introduction
58    
59     ////
60     -MT: general comments:
61     - dirinstall is only mentioned at the end
62     - mailinglists, IRC channel should be mentioned
63     ////
64    
65    
66     === [[availability]]Availability
67    
68    
69 lange 5626 Homepage::
70 mika 6107 http://fai-project.org
71 lange 5499
72 lange 5626 FAI wiki::
73 mika 6107 http://wiki.fai-project.org
74 lange 5499
75 lange 5626 Download::
76 mika 6107 http://fai-project.org/download
77 lange 5499
78 lange 5626 Entry for 'sources.list'::
79 mika 6107 `http://fai-project.org/download lenny koeln`
80 lange 5626
81     Mailing list::
82     https://lists.uni-koeln.de/mailman/listinfo/linux-fai
83    
84     Feedback::
85 mika 6107 Send feedback and comment to mailto:fai@fai-project.org[] or
86 lange 5626 to the mailing list.
87    
88     Bugs::
89     Use the Debian bug tracking system (BTS) http://bugs.debian.org for
90 lange 5499 reporting errors.
91    
92 lange 5626 User visible changes::
93 mika 6107 http://fai-project.org/NEWS
94 lange 5626
95     Source tree::
96 lange 5499 You can access the subversion repository containing the newest
97 lange 5626 developer version of FAI using the following commands
98     `svn co svn://svn.debian.org/svn/fai/trunk fai`
99 lange 5499
100 lange 5626 Source tree via http::
101     http://svn.debian.org/wsvn/fai/
102 lange 5499
103     Now read this manual, then enjoy the fully automatic installation and
104     your saved time.
105    
106     === [[motivation]]Motivation
107    
108     Have you ever performed identical installations of an operating system
109     several times? Would you like to be able to install a Linux cluster
110     with dozens of nodes single handedly?
111    
112     Repeating the same task again and again is boring -- and will surely
113     lead to errors. Also a whole lot of time could be saved if the
114     installations were done automatically. An installation process with
115     manual interaction does not scale. But clusters have the habit of
116     growing over the years. Think long-term rather than planning just a
117     few months into the future.
118    
119     In 1999, I had to perform an installation of a Linux cluster with one
120     server and 16 clients. Since I had much experience doing automatic
121     installations of Solaris operating systems on SUN SPARC hardware, the
122     idea to build an automatic installation for Debian was born. Solaris
123     has an automatic installation feature called JumpStart
124     footnote:[Solaris 8 Advanced Installation Guide at
125     http://docs.sun.com]. In conjunction with the auto-install scripts
126     from Casper Dik
127 mika 6106 footnote:[http://www.science.uva.nl/pub/solaris/auto-install], I could
128 lange 5499 save a lot of time not only for every new SUN computer, but also for
129     re-installation of existing workstations. For example, I had to build
130     a temporary LAN with four SUN workstations for a conference, which
131     lasted only a few days. I took these workstations out of our normal
132     research network and set up a new installation for the conference.
133     When it was over, I simply integrated the workstations back into the
134     research network, rebooted just once, and after half an hour,
135     everything was up and running as before. The configuration of all
136     workstations was exactly the same as before the conference, because
137     everything was performed by the same installation process. I also used
138     the automatic installation for reinstalling a workstation after a
139     damaged hard disk had been replaced. It took two weeks until I
140     received the new hard disk but only a few minutes after the new disk
141     was installed, the workstation was running as before. And this is why
142     I chose to adapt this technique to a PC cluster running Linux.
143    
144    
145    
146     === [[overview]]Overview and concepts
147    
148     FAI is a non-interactive system to install, customize and manage Linux
149     systems and software configurations on computers as well as virtual
150     machines and chroot environments, from small networks to large
151     infrastructures and clusters. You can take one or more virgin PCs,
152     turn on the power and after a few minutes Linux is installed,
153     configured and running on the whole cluster, without any interaction
154     necessary. Thus, it's a scalable method for installing and updating a
155     cluster unattended with little effort involved. FAI uses the Debian
156     GNU/Linux distribution and a collection of shell and Perl scripts for
157     the installation process. Changes to the configuration files of the
158     operating system can be made by cfengine, shell, Perl and expect
159     scripts.
160    
161     FAI's target group are system administrators who have to install Linux
162     onto one or even hundreds of computers. Because it's a general purpose
163     installation tool, it can be used for installing a Beowulf cluster, a
164     rendering farm or a Linux laboratory or a classroom. Also large-scale
165     Linux networks with different hardware or different installation
166     requirements are easy to establish using FAI. But don't forget to plan
167     your installation. Chapter <<plan>> has some useful hints for this
168     topic.
169    
170     First, some terms used in this manual are described.
171    
172     install server::
173     The host where the package 'fai-server' is installed. It provides
174     several services and data for all install clients. In the examples of
175     this manual this host is called 'faiserver'.
176    
177     install client::
178     A host which will be installed using FAI and a configuration provided
179     by the install server. Also called client for short. In this manual,
180     the example hosts are called 'demohost, nucleus, atom01, atom02,...'
181    
182     configuration::
183     The details of how the installation of the clients should be
184     performed. All configuration data is stored in a certain directory
185     structure and is also called configuration space or config space for
186     short. It includes information about:
187    
188     * Hard disk layout
189     * Local file systems, their types, mount points and mount options
190     * Software packages
191     * Keyboard layout, time zone, NIS, Xorg configuration, remote file
192 lange 5666 systems, user accounts, printers ...
193 lange 5499
194     nfsroot::
195     A file system located on the install server. It's the complete file
196     system for the install clients during the installation process. All
197     clients share the same nfsroot, which they mount read only.
198    
199     === [[work]]How does FAI work
200    
201     The install client which will be installed using FAI, is booted via
202     network card or from CD or USB stick. It gets an IP address and boots
203     a Linux kernel which mounts its root file system via NFS from the
204     install server. After the kernel is loaded, the FAI startup script
205     performs the automatic installation which doesn't need any
206     interaction. First, the hard disks will be partitioned, file systems
207     are created and then software packages are installed. After that, the
208     new installed operating system is configured to your local needs using
209     some scripts. Finally the new operating system will be booted from the
210     local disk.
211    
212     The details of how to install the computer (the configuration) are
213     stored in the configuration space on the install server. Configuration
214     files are shared among groups of computers if they are similar using
215     the class concept. So you need not create a configuration for every
216     new host. Hence, FAI is a scalable method to install a big cluster
217     with a great number of nodes.
218    
219     FAI can also be used as a network rescue system. You can boot your
220     computer, but it will not perform an installation. Instead it will run
221 lange 5549 a fully functional Debian GNU/Linux without using the local hard
222     disks. Then you
223 lange 5499 can do a remote login and backup or restore a disk partition, check a
224     file system, inspect the hardware or do any other task.
225    
226     ////
227     MT: here the class concept should be described, move the entire section
228     here.
229     ////
230    
231     === [[features]]Features
232    
233     * A fully automated installation can be performed.
234     * Very quick unattended installation.
235     * Update of running systems without re-installation.
236     * Easy creation of a virtualization environment or a chroot
237     * Hosts can boot from network card, CD, USB stick.
238     * Simple creation of the CD and USB stick.
239     * PXE with DHCP and BOOTP boot methods are supported.
240     * Lilo and grub support.
241     * ReiserFS, ext3 and XFS file system support.
242     * Software RAID and LVM support.
243     * Automatic hardware detection.
244     * Remote login via ssh during installation process possible.
245     * Two additional virtual terminals available during installation.
246     * All similar configurations are shared among all install clients.
247     * Log files for all installations are saved to the installation server.
248     * Shell, Perl, expect and cfengine scripts are supported for the configuration setup.
249     * Access to a Debian mirror via NFS, FTP or HTTP.
250     * Can be used as a rescue system.
251     * Flexible system through easy class concept.
252     * Diskless client support.
253     * Easily add your own functions via hooks.
254     * Easily change the default behavior via hooks.
255    
256    
257     == [[impatient]]Quickstart - For the impatient user
258    
259     So, you do not like to read the whole manual? You like to try an
260     installation without reading the manual? OK. Here's how to succeed in
261     a few minutes.
262    
263     * Install the package 'fai-quickstart' on your install server (see <<faisetup>>).
264    
265     * Edit 'fai.conf' run fai-setup -v and read its output.
266    
267     * Install the simple examples into the configuration space:
268    
269     ----
270     $ cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config/
271     ----
272    
273     * Get the MAC address of your demo host.
274     * Add your host (try to name it 'demohost') to 'dhcpd.conf' and
275     '/etc/hosts' (= your DNS) on the FAI server.
276     * When using PXE, tell the install client to boot the install
277     kernel and perform an installation during the next boot by calling
278     `fai-chboot` on the install server.
279     ----
280     fai-chboot -IFv demohost
281     ----
282    
283     * If you want to try FAI without setting up a PXE+DNS+DHCP-environment:
284     put the host names into '/etc/hosts' inside the nfsroot at '/srv/fai/nfsroot' and use
285     a CD/DVD to boot the client.
286     * Boot your demo host and enjoy the fully automatic installation.
287     * If the installation has finished successfully, the computer should boot a
288     small Debian system. You can login as user _demo_ or _root_ with password _fai_.
289    
290     But now don't forget to read chapters <<plan>>, <<instprocess>> and <<config>>!
291    
292    
293    
294     == [[inst]]Installing FAI
295    
296     === [[requirements]]Requirements
297    
298     ////
299     MT: split this section to mark the specific requirments:
300     - boot media
301     - source of the root file system
302     - config source
303     ////
304    
305    
306     The following items are required for an installation via FAI.
307    
308     A computer::
309     The computer must have a network interface card footnote:[If you
310     install from USB stick or CD you do not need a network card]. Unless a
311     diskless installation should be performed a local hard disk is also
312     needed. No floppy disk, CD-ROM, keyboard or graphics adapter is
313     needed.
314    
315 lange 5555 DHCP server::
316 lange 5499 The clients need one of these daemons to obtain boot information.
317    
318     TFTP server::
319     The TFTP daemon is used for transferring the kernel to the
320     clients. It's only needed when booting from network card with a boot
321     PROM.
322    
323     NFS-Root::
324     It is a directory which contains the whole file system for the install
325     clients during installation. It must be exported via NFS, so the
326     install clients can mount it. It will be created during the setup of
327     the FAI package and is also called *nfsroot*.
328    
329     Debian mirror::
330     Access to a Debian mirror is needed. A local mirror of all Debian
331     packages or an `apt-proxy(8)` is recommended if you install several
332     computers.
333    
334     Configuration space::
335     This directory tree, which contains the configuration data, is mounted
336     via NFS by default. But you can also get this directory from a
337     revision control system like CVS, subversion or Git.
338    
339     The NFS server will be enabled automatically when installing the
340     _fai-server_ package.
341    
342    
343     === [[debian-mirror]]How to create a local Debian mirror
344    
345     ////
346     MT: move this section near the end of the chapter, it's not as
347     important
348     ////
349    
350     The script `mkdebmirror` footnote:[You can find the script in
351     '/usr/share/doc/fai-doc/examples/utils/'] can be used for creating
352     your own local Debian mirror. This script uses the script
353     `debmirror(1)`. A partial Debian mirror only for i386 architecture for
354     Debian 5.0 (aka lenny) without the source packages needs about
355 lange 5645 {mirrorsize}GB of disk space. Accessing the mirror via HTTP will be the
356 lange 5499 default way in most cases. To see more output from the script call
357     +mkdebmirror -v+. A root account is not necessary to create and
358     maintain the Debian mirror.
359    
360     You can use the command `fai-mirror(1)` for creating a partial mirror
361     that only contains the software packages that are used in the classes
362     in your configuration space. A partial mirror containing all package
363     for the simple examples from the package fai-doc will only need about
364 lange 5645 440MB of disk space.
365 lange 5499
366     To use HTTP access to the local Debian mirror, install a web server
367     and create a symlink to the local directory where your mirror is
368     located:
369    
370     ----
371     faiserver# apt-get install apache2
372     faiserver# ln -s /files/scratch/debmirror /var/www/debmirror
373     ----
374    
375     Create a file `sources.list(5)` in '/etc/fai/apt' which gives access
376     to your Debian mirror. An example can be found in
377     '/usr/share/doc/fai-doc/examples/etc'. Also add the IP-address of the
378 lange 5555 HTTP server to the variable +$NFSROOT\_ETC\_HOSTS+ in
379 lange 5499 'make-fai-nfsroot.conf' when the install clients have no DNS access.
380    
381     ////
382     MT: some link to a signing howto would be nice
383     ////
384    
385    
386     === [[faisetup]]Setting up FAI
387    
388     To setup a FAI install server you need at least the packages
389     _fai-server_ and _fai-doc_. The package _fai-quickstart_ contains
390     dependencies on all required packages for an install server. Do not
391     install the package _fai-nfsroot_ on a normal system. This package can
392     only be installed inside the nfsroot.
393    
394     If you would like to install all packages that are useful for a FAI
395     install server, use the following command
396    
397     ----
398     # aptitude install fai-quickstart
399     Reading Package Lists... Done
400     Building Dependency Tree
401     Reading extended state information
402     Initializing package states... Done
403     Reading task descriptions... Done
404    
405     The following NEW packages will be installed:
406 mika 6028 apt-move{a} isc-dhcp-server{a} fai-doc{a} fai-quickstart fai-server{a}
407 lange 5499 genisoimage{a} inetutils-inetd{a} nfs-kernel-server{a}
408     openssh-server{a} syslinux-common{a} tftpd-hpa{a}
409     0 packages upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
410     Need to get 2593kB of archives. After unpacking 8561kB will be used.
411     Do you want to continue? [Y/n/?]
412     ----
413    
414     The configuration for the FAI package (not the configuration data for
415     the install clients) is defined in 'fai.conf'. Definitions that are
416     only used for creating the nfsroot are located in
417     'make-fai-nfsroot.conf'. Edit these files before calling
418     'fai-setup'. These are important variables in 'make-fai-nfsroot.conf':
419    
420     FAI\_DEBOOTSTRAP::
421     For building the nfsroot there's the command called
422     `debootstrap(8)`. It needs the location of a Debian mirror and the
423     name of the distribution (etch, lenny, sid) for which the basic Debian
424     system should be built.
425    
426     NFSROOT\_ETC\_HOSTS::
427     If you use HTTP or FTP access to the Debain mirror, add its IP-address
428     and the name to this variable. For a Beowulf master node, add the name
429     and IP-address of both networks to it. This variable is not needed
430     when the clients have access to a DNS server.
431    
432    
433     These are important variables in 'fai.conf':
434    
435     FAI\_CONFIG\_SRC::
436     This variables described how to access the configuration space on the
437     install clients. It's an Universal Resource Identifier
438     (URI). Currently supported methods are:
439    
440     - +nfs://host/path/to/exported/config+
441     The config space is mounted from host via NFS.
442    
443     - +cvs[+ssh]://user@host/path/to/cvsroot module[=tag]+
444     The config space is received from a cvs checkout.
445    
446     - +svn://user@host/svnpath+
447     The config space checked out from a subversion repository. Also
448     supported are svn+file, svn+http, svn+ssh, svn+https and checkouts
449     without a user name.
450    
451     - +git://host/path+
452     The config space checked out from a
453     git repository, host can be empty. Also supported is git+http.
454    
455 lange 5555 If +$FAI\_CONFIG\_SRC+ is undefined in 'fai.conf', then the default is
456 lange 5499 to use an NFS mount from the fai install server onto the install
457 lange 5626 client. It's the same as +nfs://\`hostname\`/$FAI\_CONFIGDIR+ with the
458 lange 5499 host name determined on the install server. Remember that this
459     directory must be exported to all install clients, so that all files
460     can be read by root.
461    
462    
463     FAI\_DEBMIRROR::
464     If you have NFS access to your local Debian mirror, specify the remote
465     file system. It will be mounted to +$MNTPOINT+, which must also be
466     defined. It's not needed if you use access via FTP or HTTP.
467    
468 lange 5638 A list of variables used by FAI can be found at
469 mika 6107 http://wiki.fai-project.org/index.php/Variables.
470 lange 5638
471 lange 5555 The content of '/etc/fai/apt/sources.list' and +$FAI\_DEBMIRROR+ are
472 lange 5499 used by the install server and also by the clients. If your install
473     server has multiple network cards and different host names for each
474     card (as for a Beowulf server), use the install server name which is
475     known by the install clients.
476    
477     FAI uses `debootstrap(8)` and `apt-get(8)` to create the nfsroot file
478     system in '/srv/fai/nfsroot'. It needs about {nfsrootsize} of free
479     disk space. After editing 'fai.conf' and 'make-fai-nfsroot.conf' call
480     `fai-setup`.
481    
482     include::includes/faisetup.txt[]
483    
484    
485     A complete example of 'fai-setup.log' is available on the FAI web
486     page. It's important that you find both lines that are marked with an
487     asterisk in your output. Otherwise something went wrong. If you'll get
488     a lot of blank lines, it's likely that you are using _konsole_, the X
489     terminal emulation for KDE which has a bug. Try again using _xterm_.
490    
491     The warning messages from dpkg about dependency problems can be
492     ignored. If you have problems running fai-setup, they usually stem
493 lange 5599 from `make-fai-nfsroot(8)`. Adding '-v' gives you a more verbose output
494 lange 5499 which may help you pinpoint the error. The output is written to
495     '/var/log/fai/make-fai-nfsroot.log'. It may help to enter the chroot
496 lange 5599 environment manually using this command.
497 lange 5499
498     ----
499     faiserver# chroot /srv/fai/nfsroot/live/filesystem.dir
500     ----
501    
502     The setup routine adds some lines to '/etc/exports' to export the
503     nfsroot and the configuration space to all hosts that belong to the
504     netgroup _faiclients_. If you already export a parent directory of
505     these directories, you may comment out these lines, since the kernel
506     NFS server has problems exporting a directory and one of its
507     subdirectories with different options.
508    
509     All install clients must belong to this netgroup, in order to mount
510 lange 5626 these directories successfully. Netgroups are defined in the file
511     '/etc/netgroup' or in the corresponding NIS map. An example can be found in
512     '/usr/share/doc/fai-doc/examples/etc/netgroup'. For more information,
513 lange 5499 read the manual pages `netgroup(5)` and the NIS HOWTO. After changing
514     the netgroups, the NFS server has to reload its configuration. Use the
515     following command:
516    
517     ----
518     faiserver# /etc/init.d/nfs-kernel-server reload
519     ----
520    
521     The setup also creates the account _fai_ (defined by +$LOGUSER+) if
522     not already available. So you can add a user before calling
523     `fai-setup(8)` using the command `adduser(8)` and use this as your
524     local account for saving log files. The log files of all install
525     clients are saved to the home directory of this account. If you boot
526     from network card, you should change the primary group of this
527     account, so this account has write permissions to '/srv/tftp/fai' in
528     order to change the symbolic links to the kernel image which is booted
529     by a client.
530    
531     ////
532     MT: the log files - which ones? Give a
533     little explanation here
534     ////
535    
536     After that, FAI is installed successfully on your server, but has no
537     configuration for the install clients. Start with the examples from
538     _/usr/share/doc/fai-doc/examples/simple/_ using the copy command above
539 lange 5555 and read <<config>>. Before you can set up a DHCP daemon, you
540 lange 5499 should collect some network information of all your install
541     clients. This is described in section <<mac>>.
542    
543     When you make changes to 'fai.conf', 'make-fai-nfsroot.conf' the
544     nfsroot has to be rebuilt by calling `make-fai-nfsroot(8)`. If you
545     only like to install a new kernel to the nfsroot add the flags _-k_ or
546     _-K_ to +make-fai-nfsroot+. This will not recreate your nfsroot, but
547     only updates your kernel and kernel modules inside the nfsroot or add
548     additional packages into the nfsroot.
549    
550     === [[troublefaisetup]]Troubleshooting the setup
551    
552     The setup of FAI adds the _fai_ account, exports file systems and
553     calls `make-fai-nfsroot(8)`. If you call _make-fai-nfsroot -v_ you
554     will see more messages. When using a local Debian mirror, it's
555     important that the install server can mount this directory via NFS. If
556     this mount fails, check '/etc/exports' and '/etc/netgroup'.
557    
558    
559     == [[booting]]Preparing booting
560    
561     Before booting the client for the first time, you have to choose which
562     medium you use for booting. Normally, you will configure the computer
563     to boot via network card. The preferred method for booting is using
564     PXE. PXE is the Preboot Execution Environment which most modern
565     network cards support. Also booting from CD-ROM or from an USB stick
566     is easy to set up.
567    
568     === [[nicboot]]Enabling PXE on a 3Com network card with boot PROM
569    
570     If you have a 3Com network card that is equipped with a boot ROM by
571     Lanworks Technologies or already includes the DynamicAccess Managed PC
572     Boot Agent (MBA) software
573     footnote:[http://support.3com.com/infodeli/tools/nic/mba.htm], you can
574     enter the MBA setup by typing +Ctrl+Alt+B+ during boot. The setup
575     should look like this:
576    
577     ----
578     Managed PC Boot Agent (MBA) v4.00
579     (C) Copyright 1999 Lanworks Technologies Co. a subsidiary of 3Com Corporation
580     All rights reserved.
581     ============================================================
582     Configuration
583    
584     Boot Method: PXE
585    
586     Default Boot: Network
587     Local Boot: Enabled
588     Config Message: Enabled
589     Message Timeout: 3 Seconds
590     Boot Failure Prompt: Wait for timeout
591     ============================================================
592     Use cursor keys to edit: Up/Down change field, Left/Right change value
593     ESC to quit, F9 restore previous settings, F10 to save
594     ----
595    
596     Set the boot method to +PXE+ (do not use RPL or BOOTP) and enable
597     local boot in this menu. So the first boot device will be the network
598     card using PXE, and the second should be the local hard disk. This has
599     to be configured in the BIOS of your computer.
600    
601     === [[pxeboot]]Booting from network card with a PXE conforming boot ROM
602    
603 lange 5534 Almost all modern bootable network cards support the PXE boot environment.
604 lange 5499 Some network cards (e.g. on notebooks) have a fixed boot
605     configuration, so they can only use the PXE boot protocol. This
606     requires a PXE Linux boot loader and a special version of the _TFTP_
607     daemon, which is available in the Debian package
608 lange 5626 +tftpd-hpa+.
609 lange 5499
610 lange 5555 First, install following additional needed packages:
611 lange 5499
612     ----
613 mika 6028 faiserver# apt-get install isc-dhcp-server syslinux-common tftpd-hpa
614 lange 5499 ----
615    
616     Then set up the DHCP daemon. A sample configuration file can be found
617     in '/usr/share/doc/fai-doc/examples/etc/dhcpd.conf'. Copy this file to
618 mika 6028 '/etc/dhcp/dhcpd.conf'.
619 lange 5499
620     The install client then loads the pxelinux boot loader which receives
621     its configuration via TFTP from a file in the directory
622 lange 5555 '/srv/tftp/fai/pxelinux.cfg' (defined by the variable +$TFTPROOT+ in
623 lange 5499 'make-fai-nfsroot.conf'). Using the command `fai-chboot(8)` you can
624     define which kernel will be loaded by the PXE Linux loader and which
625     additional parameters are passed to this kernel. You should read the
626     manual pages, which give you some good examples.
627    
628     See '/usr/share/doc/syslinux/pxelinux.doc' for more detailed
629     information.
630    
631     === [[bootfloppy]]Creating a boot floppy
632    
633     If your network card can't boot by itself, you can create a small boot
634     floppy that uses etherboot, which will provide the PXE feature for
635     your network card. So you can use DHCP and TFTP to get the install
636     kernel that was created with `mknbi-linux(8)`. A lot of ethernet
637     cards support booting via ethernet if a special boot EPROM is inserted
638     or booted from floppy provided by http://rom-o-matic.net. In depth
639     documentation about booting via ethernet may be found at
640     http://www.etherboot.org.
641    
642    
643     === [[cdboot]]Booting from a CD-ROM
644    
645     It's possible to perform an automatic installation from CD-ROM without
646     an install server. The CD-ROM contains all data needed for the
647     installation. The command `fai-cd(8)` puts the nfsroot, the
648     configuration space and a subset of the Debian mirror onto a
649     CD-ROM. The partial mirror is created using the command
650     `fai-mirror(1)` which contains all packages that are used by the
651     classes used in your configuration space. A sample ISO image is
652 mika 6107 available at http://fai-project.org/fai-cd.
653 lange 5499
654     === [[usbboot]]Booting from USB stick
655    
656     Using the command `fai-cd(8)` you can also create a bootable USB
657 lange 5555 stick. First, format your stick with an ext2 file system (ext3 makes no
658 lange 5499 sense on flash memory devices). Then mount it. After that call:
659    
660     ----
661     faiserver# fai-cd -m /path/to/mirror -u /path/to/mounted/stick
662     ----
663    
664     Then unmount the USB stick. The USB stick must be formatted with an
665 lange 5555 ext2 file system. VFAT is not yet supported. Currently the file system
666 lange 5499 that will be written onto the stick is not compressed.
667    
668     === [[mac]]Collecting Ethernet addresses
669    
670     Now it's time to boot your install clients for the first time. They
671     will fail to boot completely, because no BOOTP or DHCP daemon is
672     running yet or recognizes the hosts. But you can use this first boot
673     attempt to easily collect all Ethernet addresses of the network cards.
674    
675     You have to collect all Ethernet (MAC) addresses of the install
676     clients and assign a host name and IP address to each client. To
677     collect all MAC addresses, now boot all your install clients. While
678     the install clients are booting, they send broadcast packets to the
679     LAN. You can log the MAC addresses of these hosts by running the
680     following command simultaneously on the server:
681    
682     ----
683     faiserver# tcpdump -qtel broadcast and port bootpc >/tmp/mac.list
684     ----
685    
686     After the hosts have been sent some broadcast packets (they will fail
687     to boot because `bootpd` isn't running or does not recognize the MAC
688     address yet) abort `tcpdump` by typing _ctrl-c_. You get a list of all
689     unique MAC addresses with these commands:
690    
691     ----
692 lange 5666 faiserver$ perl -ane 'print "\U$F[0]\n"' /tmp/mac.list|sort|uniq
693 lange 5499 ----
694    
695     After that, you only have to assign these MAC addresses to host names
696     and IP addresses ('/etc/ethers' and '/etc/hosts' or corresponding NIS
697 lange 5555 maps). With this information you can configure your `DHCP`
698     daemon (see the section <<bootdhcp>>). I recommend to write the MAC
699 lange 5499 addresses (last three bytes will suffice if you have network cards
700     from the same vendor) and the host name in the front of each chassis.
701    
702     === [[bootdhcp]]Configuration of the DHCP daemon
703    
704     An example for `dhcpd.conf(5)` is available in
705     '/usr/share/doc/fai-doc/examples/etc/dhcpd.conf', which is working
706     with version 3.x of the DHCP daemon. Start using this example and look
707     at all options used therein. The only FAI specific information inside
708 lange 5555 this configuration file is to set _filename_ to _fai/pxelinux.0_ and to
709 lange 5499 set _next-server_ and _server-name_. All other information is only
710     network related data, which is used in almost all DHCP configurations.
711    
712     If you make any changes to the DHCP daemon configuration, you must
713     restart the daemon.
714    
715 mika 6028 # /etc/init.d/isc-dhcp-server restart
716 lange 5499
717     By default, the DHCP daemon writes its log files to
718     '/var/log/daemon.log'. The command `fai-chboot(8)` is used for
719     creating a per host configuration for the pxelinux environment.
720    
721    
722     === [[bootmesg]]Boot messages
723    
724     When booting from network card with PXE you will see:
725    
726     include::includes/bootexample.txt[]
727    
728     When the copyright message of FAI is shown, the install client has
729     mounted the nfsroot footnote:['/srv/fai/nfsroot' from the install
730     server] to the clients' root directory. This is the whole file system
731     for the client at this moment.
732    
733     After _task_confdir_ is executed, the configuration space is mounted
734 lange 5555 via NFS.
735 lange 5499
736 lange 5555 Before the installation is started (+$FAI_ACTION=install+) the computer
737 lange 5499 beeps three times. So, be careful when you hear three beeps but you do
738     not want to perform an installation!
739    
740     ==== [[booterror]]Troubleshooting the boot messages
741    
742     This is the error message you will see, when your network card is
743     working, but the install server does not export the configuration
744     space directory to the install clients, mostly a problem of missing
745     permissions on the server side.
746    
747     ----
748     Begin: Mounting root file system... ...
749     eth0: link up
750    
751     BusyBox v1.10.2 (Debian 1:1.10.2-1) Built-in shell (ash)
752     Enter 'help' for a list of built-in commands.
753     /bin/sh: can't access tty: job control turned off
754     (initramfs)
755     ----
756    
757     You will get a shell prompt and can look at the log files, for
758 lange 5561 examples '/live.log' or '/tmp/net-eth0.conf'. You can also enter the
759     initramfs shell for debugging if you append the parameter 'break' to
760     the kernel command line.
761 lange 5499
762     Use the following command on the install server to see which directories are exported
763     from the install server (named faiserver):
764    
765     ----
766     $ showmount -e faiserver
767     ----
768    
769     The following error message indicates that your install client doesn't
770     get an answer from a DHCP server. Check your cables or start the
771     `dhcpd(8)` daemon with the debug flag enabled.
772    
773     ____
774     PXE-E51: No DHCP or BOOTP offers received
775     Network boot aborted
776     ____
777    
778     If you get the following error message, the install kernel could not
779     detect your network card, for example because of a missing driver:
780    
781     ____
782     Begin: Mounting root file system... ...
783     Kernel panic - not syncing: Attempted to kill init!
784     ____
785    
786     Check the initrd in the nfsroot if the kernel driver of your network
787     card is included there.
788    
789     === [[sysinfo]]Collecting other system information
790    
791 lange 5555 Now the clients have booted with +$FAI_ACTION+ set to _sysinfo_. Type
792 lange 5499 _ctrl-c_ to get a shell or use _Alt-F2_ or _Alt-F3_ and you will get
793 lange 5555 another console terminal, if you have added _createvt_ to +$FAI_FLAGS+.
794 lange 5499
795     Remote login is available via the secure shell if _sshd_ is added to
796 lange 5555 +$FAI_FLAGS+. The encrypted password is set with the variable
797     +$FAI_ROOTPW+ in 'make-fai-nfsroot.conf' and defaults to "fai". You can
798 lange 5499 create the encrypted password using `mkpasswd(1)` and use the
799     `crypt(3)` or md5 algorithm. This is only the root password during the
800     installation process, not for the new installed system. You can also
801 lange 5555 log in without a password when using +$SSH_IDENTITY+. To log in from
802 lange 5499 your server to the install client (named demohost in this example)
803     use:
804    
805     ----
806     $ ssh root@demohost
807     Warning: Permanently added 'demohost,134.95.9.200' to the list of known hosts.
808     root@demohost's password:
809     ----
810    
811     You now have a running Linux system on the install client without
812     using the local hard disk. Use this as a rescue system if your local
813     disk is damaged or the computer can't boot properly from hard
814     disk. You will get a shell and you can execute various commands
815     (`dmesg`, `lsmod`, `df`, `lspci`, ...). Look at the log file in
816     '/tmp/fai'. There you can find much information about the boot
817     process.
818    
819     All log files from '/tmp/fai' are also written to the +$LOGSERVER+ (if
820     not defined: the server defined by +$SERVER+ from _get-boot-info_)
821     into the directory _~fai/demohost/sysinfo/_.
822    
823     ////
824     More general:
825     _~$LOGUSER/$HOSTNAME/$FAI_ACTION/_.
826     ////
827    
828     Two additional symbolic links are created. The symlink 'last' points
829     to the log directory of the last fai action performed. The symlinks
830     'last-install' and 'last-sysinfo' point to the directory with of the
831     last corresponding action. Examples of the log files can be found on
832     the FAI homepage.
833    
834     ////
835     MT: I think it should be _~$LOGUSER/$HOSTNAME/$FAI_ACTION-\`DATE\`/_
836     ////
837    
838     FAI mounts all file systems it finds on the local disks read only. It
839     also tells you on which partition a file '/etc/fstab' exists. When
840     only one file system table is found, the partitions are mounted
841     according to this information. Here's an example:
842    
843     ----
844     demohost:~# df
845     Filesystem 1K-blocks Used Available Use% Mounted on
846     rootfs 4099064 414088 3645296 11% /
847     udev 10240 76 10164 1% /dev
848     192.168.1.250:/srv/fai/nfsroot
849     3905600 410976 3454944 11% /live/image
850     aufs 4099064 414088 3645296 11% /
851     tmpfs 193464 0 193416 0% /live
852     tmpfs 193464 3112 190352 2% /live/cow
853     faiserver:/srv/fai/config
854     3905600 410976 3454944 11% /var/lib/fai/config
855     /dev/sda1 241116 74519 154149 33% /target
856     /dev/sda9 4364212 139888 4179988 4% /target/home
857     /dev/sda7 553376 16840 536536 4% /target/tmp
858     /dev/sda8 2221628 275936 1832840 14% /target/usr
859     /dev/sda6 577096 172924 374856 32% /target/var
860     aufs 193464 2376 191243 2% /target/dev
861     ----
862    
863 lange 5626 *This method can be used as a rescue environment!* If you need a file
864     system with read-write access use the `rwmount` command:
865 lange 5499
866     ----
867     demohost# rwmount /target/home
868     ----
869    
870 lange 5555 === [[checkbootp]]Checking parameters from DHCP servers
871 lange 5499
872     If the install client boots with action _sysinfo_, you can also check
873 lange 5555 if all information from the DHCP daemon are received
874 lange 5499 correctly. The received information is written to
875     '/tmp/fai/boot.log'. An example of the result of a DHCP request can be
876 lange 5626 found in <<setuproutines>>.
877 lange 5499
878    
879     === [[reboot]]Rebooting the computer
880    
881     At any time you can reboot the computer using the command `faireboot`,
882     also if logged in from remote. If the installation hasn't finished,
883     use _faireboot -s_, so the log files are also copied to the install
884     server.
885    
886     == [[instprocess]]Overview of the installation sequence
887    
888     The following tasks are performed during an installation after the
889     Linux kernel has booted on the install clients.
890    
891 mika 6110 ____
892     confdir # get config space
893     setup # early part of initialization
894     defclass # define classes
895     defvar # define variables
896     action # evaluate FAI_ACTION
897     install # Do the initial installation
898     partition # partition the harddisks, create file systems
899     mountdisks # mount the file systems
900     extrbase # extract the minimal base.tgz
901     mirror # get a Debian mirror via NFS
902     debconf # do Debian preseeding
903     prepareapt # preapre some apt-related files in target directory
904     updatebase # Debian specific
905     HOOK instsoft.FAIBASE # fcopy kernel-img.conf
906     instsoft # install software packages
907     configure # call customization scripts
908     finish # do some cleanup, show installation time
909     tests # call tests if defined
910     chboot # call fai-chboot on the install server
911     HOOK savelog.LAST # grep for error messages in all log files
912     savelog # save log file to local dir and remote
913     faiend # reboot host, eject CD if needed
914     ____
915     ____
916 lange 5499
917 mika 6110 These are tasks, which are executed when a different action is performed
918    
919     dirinstal # install a chroot environment
920     softupdate # do a system configuration without the partitioning part
921     ____
922    
923    
924 lange 5499 You can also define additional programs or scripts which will be run
925     on particular occasions. They are called _hooks_. Hooks can add
926     additional functions to the installation process or replace the
927     default subtasks of FAI. So it's very easy to customize the whole
928     installation process. Hooks are explained in detail in <<hooks>>.
929    
930     The installation time is determined by the amount of software but also
931     by the speed of the processor and hard disk. Here are some sample
932     times. All install clients have a 100Mbit network card installed.
933     Using a 10 Mbit LAN does not decrease the installation time
934     considerably, so the network will not be the bottleneck when
935     installing several clients simultaneously.
936    
937     ____
938 lange 5555 Intel Core2 Duo , 2GB,SATA disk, 3 GB software 14 min
939     Athlon XP1600+ , 896MB,SCSI disk, 1 GB software 6 min
940     AMD-K7 500MHz , 320MB, IDE disk, 780 MB software 12 min
941     PentiumPro 200MHz , 128MB, IDE disk, 800 MB software 28 min
942     Pentium III 850MHz, 256MB, IDE disk, 820 MB software 10 min
943     Pentium III 850MHz, 256MB, IDE disk, 180 MB software 3 min
944 lange 5499 ____
945    
946    
947     === [[faimond]]Monitoring the installation
948    
949     You can monitor the installation of all install clients with the
950     command `faimond(8)`. All clients check if this daemon is running on
951     the install server (or the machine defined by the variable
952 lange 5666 +$monserver+). Then, a message is sent when a task starts and ends. The
953 lange 5499 fai monitor daemon prints this messages to standard output. There's
954 lange 5555 also a graphical frontend available, called `faimond-gui(1)`.
955 lange 5499
956    
957     === [[bootkernel]]Booting the kernel
958    
959     The install client receives and loads the kernel and initial RAM
960     disk. The kernel boots up and load the RAM disk. It does some hardware
961     detection and then tries to figure where the root file system is
962     located. When booting from network, this is determined by parameters
963     from additional kernel parameters (_root=/dev/nfs_ and
964     _nfsroot=/srv/fai/nfsroot_). When booting from CD-ROM or USB stick the
965     kernel and initial RAM disk probes removable devices and tries to
966     figure out where the root file system is located. This may also be a
967     compressed file system (using squashfs).
968    
969     After the root file system is mounted read only, it is made writable
970     by mounting a RAM disk via aufs (another unionfs) on top of it. So
971     it's possible for programms or daemons to write to files inside a read
972     only mounted file system. We are using the package
973     `live-initramfs(7)` to mount the nfsroot and to make this file system
974     writable using aufs. The package _live-initramfs_ is only needed
975     inside the nfsroot and adds some initramfs hooks.
976    
977    
978 lange 5626 === [[isetup]]Start and setup FAI
979 lange 5499
980     ////
981     MT: CVS, SVN missing
982     ////
983    
984     After the install client has booted, only the script '/usr/sbin/fai'
985     footnote:[Since the root file system on the clients is mounted via
986     NFS, `fai` is located in
987     '/srv/fai/nfsroot/live/filesystem.dir/usr/sbin' on the install
988     server.] is executed. This is the main script which controls the
989     sequence of tasks for FAI. No other scripts in '/etc/init.d/' are
990     executed.
991    
992 lange 5555 Additional parameters are received from the DHCP daemon and
993 lange 5499 the configuration space is made available via the configured method
994     (an NFS mount by default) from the install server to '$FAI'. The setup
995     is finished after additional virtual terminals are created and the
996     secure shell daemon for remote access is started on demand.
997    
998 lange 5626 The variable +$FAI_CONFIG_SRC+ is used to get the FAI
999     configuration space, which is very important, since FAI cannot proceed
1000     without the config space.
1001    
1002 lange 5499 === [[iclass]]Defining classes, variables and loading kernel modules
1003    
1004     Now the script `fai-class(1)` is used to define classes. Therefore
1005     several scripts in '$FAI/class/' are executed to define classes. All
1006     scripts matching _[0-9][0-9]*_ (they start with two digits) are
1007     executed in alphabetical order. Every word that these scripts print to
1008     the standard output are interpreted as class names. Scripts ending in
1009     _.source_ are sourced, so they can define new classes by adding these
1010 lange 5555 classes to the variable +$newclasses+.
1011 lange 5499
1012     The output of these scripts is ignored. These classes are defined for
1013     the install client. You can also say this client belongs to these
1014     classes. A class is defined or undefined and has no value. Only
1015     defined classes are of interest for an install client. The description
1016     of all classes can be found in
1017     '/usr/share/doc/fai-doc/classes_description.txt'. It is advisable to
1018     document the job a new class performs. Then, this documentation is the
1019     base for composing the whole configuration from classes. The scripts
1020     `20-hwdetect.source` loads kernel modules on demand. The complete
1021     description of all these scripts can be found in <<cscripts>>.
1022    
1023     After defining the classes, every file matching _*.var_ with a prefix
1024     which matches a defined class is executed to define variables. There,
1025 lange 5555 you should define the variable +$FAI_ACTION+ and others. By default,
1026     +$FAI_ACTION+ is defined via the command `fai-chboot(8)`.
1027 lange 5499
1028    
1029     === [[ipartition]]Partitioning local disks, creating file systems
1030    
1031     For disk partitioning exactly one disk configuration file from
1032     '$FAI/disk_config' is selected using classes. This file describes how
1033     all the local disks will be partitioned, where file systems should be
1034     created (and their types like ext2, ext3, reiserfs), and how they are
1035     mounted. It's also possible to preserve the disk layout or to preserve
1036     the data on certain partitions.
1037    
1038     The old tool for partitioning the hard disks is called
1039 lange 5596 `setup_harddisks`. This tool is deprecated. With FAI 3.2.8 the
1040 lange 5499 new partitioning tool called `setup-storage(8)` was added to FAI. It
1041     uses `parted(8)` for editing the partition table and now has support
1042     for software RAID and LVM. This tool uses a slightly different format
1043 lange 5596 for the configuration files in 'disk_config' than the old tool. Read
1044     the manual page for a detailed description of the new format. The variable
1045 lange 5499 _USE_SETUP_STORAGE_ now determines which tool to use. When set to 1 it
1046     uses the new tool which is now defined in 'FAIBASE.var' by default.
1047    
1048     During the installation process all local file systems are mounted
1049     relative to '/target'. For example '/target/home' will become '/home'
1050     in the new installed system.
1051    
1052     === [[ipackages]]Installing software packages
1053    
1054     When local file systems are created, they are all empty (except for
1055     preserved partitions). Now the Debian base system and all requested
1056 lange 5555 software packages are installed on the new file systems. First, the
1057 lange 5499 base archive is unpacked, then the command `install_packages(8)`
1058     installs all packages using `apt-get(8)` or `aptitude(1)` without any
1059     manual interaction needed. If a packages requires another package,
1060     both commands resolve this dependency by installing the required
1061     package.
1062    
1063     Classes are also used when selecting the configuration files in
1064     '$FAI/package_config/' for software installation. The format of the
1065     configuration files is described in <<packageconfig>>.
1066    
1067 lange 5555 === [[icscripts]]Site specific customization
1068 lange 5499
1069     After all requested software packages are installed, the system is
1070     nearly ready to go. But not all default configurations of the software
1071     packages will meet your site-specific needs. So you can call arbitrary
1072     scripts which adjust the system configuration. Therefore scripts which
1073     match a class name in '$FAI/scripts' will be executed. If
1074     '$FAI/scripts/'+classname/+ is a directory, all scripts that match
1075     _[0-9][0-9]*_ in this directory are executed. So it is possible to
1076     have several scripts of different types (shell, cfengine, ...) to be
1077     executed for one class. FAI comes with some examples for these
1078     scripts, but you can write your own Bourne, bash, Perl, cfengine or
1079     expect scripts.
1080    
1081     More information about these scripts are described in <<cscripts>>.
1082    
1083    
1084 lange 5555 === [[itests]]Automated tests
1085 lange 5499
1086     After the customization scripts are executed, FAI will execute some
1087     tests if available. Using these test, you can check for errors of the
1088     installation or of the softupdate. Test scripts are called via
1089     `fai-do-scripts(1)` and should append it's messages to
1090     _$LOGDIR/test.log_. A Perl module including some useful subroutines
1091     can be found in _Faitest.pm_. A test can also define a new class for
1092     executing another tests during next boot via the variable
1093 lange 5555 +$ADDCLASSES+.
1094 lange 5499
1095    
1096     === [[isavelog]]Save log files
1097    
1098     When all installation tasks are finished, the log files are written to
1099     _/var/log/fai/$HOSTNAME/install/_
1100     footnote:['/var/log/fai/localhost/install/' is a link to this
1101     directory.] on the new system and to the account on the install server
1102     if +$LOGUSER+ is defined in 'fai.conf'. It is also possible to specify
1103     another host as log saving destination through the variable
1104 lange 5555 +$LOGSERVER+. If +$LOGSERVER+ is not defined, FAI uses the variable
1105     +$SERVER+ which is only defined during an initial installation (by
1106     get-boot-info). Make sure to set +$LOGSERVER+ in a _class/*.var_ script
1107 lange 5499 if you are using the action _softupdate_.
1108    
1109     Additionally, two symlinks will be created to indicated the last
1110     directory written to. By default log files will be copied to the log
1111     server using scp.
1112    
1113     You can use other methods to save logs to the remote server. The
1114     currently selected method is defined by the +$FAI_LOGPROTO+ variable
1115     in file 'fai.conf':
1116    
1117    
1118     rsh::
1119     Use the rcp command to copy the log files to
1120     the log server.
1121    
1122     ftp::
1123     This option saves logs to the remote FTP server defined by the
1124     +$LOGSERVER+ variable (+$SERVER+ value is used if not set). Connection
1125     to the FTP server is done as user +$LOGUSER+ using password
1126     +$LOGPASSWD+. The FTP server log directory is defined in
1127     +$LOGREMOTEDIR+. These variables are also defined in file
1128     'fai.conf'. You need write access for the +$LOGREMOTEDIR+ on the FTP
1129     server.
1130    
1131     All files in the directory _/tmp/fai_ are copied to the
1132     FTP server following this example:
1133    
1134     ____
1135     ftp://$LOGUSER:$LOGPASSWD@$LOGSERVER/$LOGREMOTEDIR/
1136     ____
1137    
1138     none::
1139     Don't save the log file to the install server.
1140    
1141    
1142     === [[ireboot]]Reboot the new installed system
1143    
1144     At last the system is automatically rebooted if "reboot" was added to
1145 lange 5555 +$FAI_FLAGS+. Normally this should boot the new installed system from
1146 lange 5499 its second boot device, the local hard disk. To skip booting from
1147     network card, you can use the command `fai-chboot(8)` to enable
1148     localboot.
1149    
1150    
1151    
1152     == [[plan]]Plan your installation, and FAI installs your plans
1153    
1154     Before starting your installation, you should spend a lot of time in
1155     planning your installation. When you're happy with your installation
1156     concept, FAI can do all the boring, repetitive tasks to turn your
1157     plans into reality. FAI can't do good installations if your concept is
1158     imperfect or lacks some important details. Start planning the
1159     installation by answering the following questions:
1160    
1161    
1162     * Will I create a Beowulf cluster, or do I have to install some desktop machines?
1163     * What does my LAN topology look like?
1164     * Do I have uniform hardware? Will the hardware stay uniform in the future?
1165     * Does the hardware need a special kernel?
1166     * How should the hosts be named?
1167     * How should the local hard disks be partitioned?
1168     * Which applications will be run by the users?
1169     * Do the users need a queueing system?
1170     * What software should be installed?
1171     * Which daemons should be started, and what should the configuration for these look like?
1172     * Which remote file systems should be mounted?
1173     * How should backups be performed?
1174    
1175     You also have to think about user accounts, printers, a mail system,
1176     cron jobs, graphic cards, dual boot, NIS, NTP, timezone, keyboard
1177     layout, exporting and mounting directories via NFS and many other
1178     things. So, there's a lot to do before starting an installation. And
1179     remember that knowledge is power, and it's up to you to use
1180     it. Installation and administration is a process, not a product. FAI
1181     can't do things you don't tell it to do.
1182    
1183     But you need not start from scratch. Look at all files and scripts in
1184     the configuration space. There are a lot of things you can use for
1185 lange 5626 your own installation. A good paper called "Bootstrapping an
1186     Infrastructure" with more aspects of building an infrastructure is
1187     available at http://www.infrastructures.org/papers/bootstrap
1188 lange 5499
1189    
1190     == [[config]]Installation details
1191    
1192     === [[c3]]The configuration space
1193    
1194     The configuration is the collection of information about how exactly
1195     to install a computer. The central configuration space for all install
1196     clients is located on the install server in '/srv/fai/config' and its
1197     subdirectories. This will be mounted by the install clients to
1198     '/var/lib/fai/config'. It's also possible to receive all the
1199     configuration data from a `cvs(1)`, subversion (`svn(1)`) or Git
1200     (`git(1)`) repository. The following subdirectories are present and
1201     include several files:
1202    
1203     _class/_::
1204     Scripts and files to
1205     define classes and variables and to load kernel modules.
1206    
1207     _disk_config/_::
1208     Configuration files for disk partitioning and file system creation.
1209    
1210     _debconf/_::
1211     This directory holds all `debconf(8)` data. The format is the same
1212     that is used by `debconf-set-selections(8)`.
1213    
1214     _package_config/_::
1215 lange 5592 Files with class names contain lists of software packages to be
1216     installed or removed. Files named '*.asc' are added to the key list of
1217     apt.
1218 lange 5499
1219     _scripts/_::
1220     Script for local site
1221     customization.
1222    
1223     _files/_::
1224     Files used by customization scripts. Most files are located in a
1225     subtree structure which reflects the ordinary directory tree. For
1226     example, the templates for 'nsswitch.conf' are located in
1227     '$FAI/files/etc/nsswitch.conf' and are named according to the classes
1228     that they should match: '$FAI/files/etc/nsswitch.conf/NIS' is the
1229     version of '/etc/nsswitch.conf' to use for the NIS class. Note that
1230     the contents of the files directory are not automatically copied to
1231     the target machine, rather they must be explicitly copied by
1232     customization scripts using the `fcopy(8)` command.
1233    
1234     _basefiles/_::
1235     Normally the file '/var/tmp/base.tgz' is extracted on the install
1236     client after the new file systems are created and before package are
1237     installed. This is a minimal base image, created right after calling
1238     debootstrap during the make-fai-nfsroot process on the install
1239     server. If you want to install another distribution than the nfsroot
1240     is, you can put a tar file into the subdirectory 'basefiles/' and name
1241     it after a class. Then the command `ftar(8)` is used to extract the
1242     tar file based on the classes defined. This is done in task
1243     _extrbase_.
1244    
1245     _hooks/_::
1246     Hooks are user defined programs or scripts, which are called during
1247     the installation process. The can extend or replace the default tasks.
1248    
1249     The main installation command `fai(8)` uses all these subdirectories
1250     in the order listed except for hooks. The FAI package contains
1251     examples for all these configuration scripts and files in
1252     '/usr/share/doc/fai-doc/examples'. Copy the configuration examples to
1253     the configuration space and start an installation. These files need
1254     not belong to the root account. You can change their ownership and
1255     then edit the configuration with a normal user account.
1256    
1257     ----
1258     # cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config
1259     # chown -R fai /srv/fai/config
1260     ----
1261    
1262     These files contain simple configuration for some example
1263     hosts. Depending on the host name used, your computer will be
1264     configured as follows:
1265    
1266     demohost::
1267     A machine which needs only a small hard disk. This machine is
1268     configured with network (as DHCP client), and an account demo is
1269     created.
1270    
1271     gnomehost::
1272     A GNOME desktop is installed, and the account demo is created.
1273    
1274     other host names::
1275     Hosts with other host name will most notably use the classes FAIBASE,
1276     DHCPC and GRUB.
1277    
1278    
1279     Start looking at these examples and study them. Then change or add
1280     things to these examples. But don't forget to plan your own
1281     installation!
1282    
1283     === [[tasks]]The default tasks
1284    
1285     After the kernel has booted, it mounts the root file system via NFS
1286     from the install server and `init(8)` starts the script
1287     '/usr/sbin/fai'. This script controls the sequence of the
1288     installation. No other scripts in '/etc/init.d/' are used.
1289    
1290     The installation script uses many subroutines, which are defined in
1291 mika 6000 '/usr/lib/fai/subroutines'. All
1292 lange 5499 important tasks of the installation are called via the subroutine
1293     _task_ appended by the name of the task as an option
1294     (e.g. __task_instsoft__). The subroutine _task_ calls hooks with prefix
1295     *name* if available and then calls the default task (defined as
1296     __task_<name>__ in 'subroutines'). The default task and its hooks can be
1297     skipped on demand by using the subroutine _skiptask()_.
1298    
1299     Now follows the description of all default tasks, listed in the order
1300     they are executed.
1301    
1302    
1303     confdir::
1304     The kernel appended parameters define variables, the syslog and kernel
1305     log daemon are started. The list of network devices is stored in
1306 lange 5555 +$netdevices+. Then additional parameters are fetched from a DHCP
1307     server and also additional variables are defined. The DNS
1308 lange 5499 resolver configuration file is created.
1309     +
1310     The location of the configuration space is defined by the variable
1311     +$FAI_CONFIG_SRC+. You can use NFS, cvs, svn or git to access the
1312     configuration space. See section <<isetup>> for how to set the
1313     variable.
1314     +
1315     After that, the file '$FAI/hooks/subroutines' is sourced if it
1316     exists. Using this file, you can define your own subroutines or
1317     override the definition of FAI's subroutines.
1318    
1319     ////
1320     MT: there is no info about that at id="isetup"
1321     MT: config is also mounted/checked out in this task
1322     ////
1323    
1324    
1325    
1326     setup::
1327 lange 5555 This task sets the system time, all +$FAI_FLAGS+ are defined and two
1328 lange 5499 additional virtual terminals are opened on demand. A secure shell
1329     daemon is started on demand for remote logins.
1330    
1331     defclass::
1332     Calls `fai-class(1)` to define classes using scripts and files in
1333     '$FAI/class' and classes from '/tmp/fai/additional-classes' and the
1334 lange 5555 variable +$ADDCLASSES+.
1335 lange 5499
1336     defvar::
1337     Sources all files '$FAI/class/*.var' for every defined class. If a
1338     hook has written some variable definitions to the file
1339     '/tmp/fai/additional.var', this file is also sourced.
1340    
1341     action::
1342     Depending on the value of +$FAI_ACTION+ this subroutine decides which
1343     action FAI should perform. The default available actions are:
1344     _sysinfo_, _install_ and _softupdate_. If +$FAI_ACTION+ has another
1345     value, a user defined action is called if a file
1346     '$FAI/hooks/$FAI_ACTION' exists. So you can easily define your own
1347     actions.
1348    
1349    
1350     sysinfo::
1351     Called when no installation is performed but the action is
1352     _sysinfo_. It shows information about the detected hardware and mounts
1353     the local hard disks read only to '/target/+partitionname+' or with
1354     regard to a 'fstab' file found inside a partition. Log files are
1355     stored to the install server.
1356    
1357     install::
1358     This task controls the installation sequence. You will hear three
1359     beeps before the installation starts. The major work is to call other
1360     tasks and to save the output to '/tmp/fai/fai.log'. If you have any
1361     problems during installation, look at all files in '/tmp/fai/'. You
1362     can find examples of the log files for some hosts in the download
1363     directory of the FAI homepage.
1364    
1365     softupdate::
1366     This task, executed inside a running system via the `fai(8)` command
1367     line interface, performs a softupdate. See chapter <<softupdate>> for
1368     details.
1369    
1370     partition::
1371 lange 5596 Calls `setup-storage(8)` to partition the hard
1372 lange 5499 disks and to create file systems. The task writes variable definitions
1373     for the root and boot partition and device (+$ROOT_PARTITION,
1374     $BOOT_PARTITION, $BOOT_DEVICE+) to '/tmp/fai/disk_var.sh' and creates
1375     an 'fstab' file.
1376    
1377     mountdisks::
1378     Mounts the created partitions according to the created
1379     '/tmp/fai/fstab' file relative to +$FAI_ROOT+.
1380    
1381     extrbase::
1382     Extracts a minimal system after that a chroot can be made into it. By
1383     default the base tar file '/var/tmp/base.tgz' will be extracted. The
1384 lange 5555 command `ftar -1v -s $FAI/basefiles /` is used for unpacking a
1385 lange 5499 different tar file depending on classes defined. This can be used for
1386     installing different Linux distributions than the one used for
1387     creating the nfsroot. The default file 'base.tgz' is a snapshot of a
1388     basic Debian system created by `debootstrap(8)`
1389    
1390     mirror::
1391     If a local Debian mirror is accessed via NFS (when +$FAI_DEBMIRROR+ is
1392     defined), this directory will be mounted to +$MNTPOINT+.
1393    
1394     debconf::
1395     Calls `fai-debconf(8)` to set the values for the debconf database.
1396    
1397     prepareapt::
1398     Set up resolv.conf and some
1399     other files, for the next task updatebase.
1400    
1401     updatebase::
1402     Updates the base packages of the new system and updates the list of
1403     available packages. It also fakes some commands (called diversions)
1404 lange 5555 inside the new installed system using `dpkg-divert(8)`.
1405 lange 5499
1406     instsoft::
1407     Installs the desired software packages using class files in
1408     '$FAI/package_config/'.
1409    
1410     configure::
1411     Calls scripts in '$FAI/scripts/' and its subdirectories for every
1412     defined class.
1413    
1414 lange 5626 tests::
1415     Calls test scripts in '$FAI/tests/' and its subdirectories for every
1416     defined class.
1417    
1418 lange 5499 finish::
1419     Unmounts all file systems in the new installed system and removes
1420     diversions of files using the command `fai-divert`.
1421    
1422     chboot::
1423     Changes the PXE configuration for a host on the install server which
1424     indicates which kernel image to load on the next boot from network
1425     card via TFTP. Therefore the `fai-chboot(8)` command is executed
1426     remotely on the install server.
1427    
1428     savelog::
1429     Saves log files to local disk and to the account +$LOGUSER+ on
1430 lange 5627 +$LOGSERVER+ (defaults to the install server).
1431 lange 5499
1432     faiend::
1433     Wait for background jobs to finish (e.g. emacs compiling lisp files)
1434     and automatically reboots the install clients or waits for manual
1435     input before reboot.
1436    
1437    
1438    
1439 lange 5626 === [[setuproutines]]The setup routines of the install clients
1440    
1441 lange 5499 After the subroutine `fai_init` has done some basic initialization
1442     (create RAM disk, read 'fai.conf' and all subroutines definitions, set
1443     path, print copyright notice), the setup continues by calling the task
1444     _confdir_ and the task _setup_. The command `get-boot-info` is called
1445 lange 5555 to get all information from the DHCP server. This command
1446 lange 5499 writes the file '/tmp/fai/boot.log', which then is sourced to define
1447     the corresponding global variables. This is an example for this log
1448     file when using a DHCP server.
1449    
1450     include::includes/bootlog.txt[]
1451    
1452     Additional information is passed via the kernel command line or read
1453     from 'fai.conf'. When booting with PXE, command line parameters are
1454     created using `fai-chboot(8)`.
1455    
1456     If you do not boot from network card but from CD-ROM or USB stick, you
1457     may also give network parameters to the kernel via the kernel command
1458     line. Two interesting parameters are
1459    
1460     ----
1461     nfsroot=<server-ip>:]<root-dir>[,<nfs-options>]
1462    
1463     ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
1464     ----
1465    
1466     Those parameters are described in the documentation of the Linux
1467     kernel sources in '/usr/src/linux/Documentation/nfsroot.txt'.
1468    
1469 lange 5555
1470     ==== [[faiflags]]FAI flags
1471    
1472 lange 5499 The variable +$FAI_FLAGS+ contains a space separated list of
1473     flags. The following flags are known:
1474    
1475     verbose::
1476     Create verbose output during installation. This should always be the
1477     first flag, so consecutive definitions of flags will be verbosely
1478     displayed.
1479    
1480     debug::
1481     Create debug output. No unattended installation is performed. During
1482     package installation you have to answer all questions of the
1483     postinstall scripts on the client's console. A lot of debug
1484     information will be printed out. This flag is only useful for FAI
1485     developers.
1486    
1487     sshd::
1488     Start the ssh daemon to enable remote logins.
1489    
1490     createvt::
1491     Create two virtual terminals and execute a bash if _ctrl-c_ is typed
1492     in the console terminal. The additional terminals can be accessed by
1493     typing _Alt-F2_ or _Alt-F3_. Otherwise no terminals are available and
1494     typing _ctrl-c_ will reboot the install client. Setting this flag is
1495     useful for debugging. If you want an installation which should not be
1496     interruptible, do not set this flag.
1497    
1498     reboot::
1499     Reboot the install client after installation is finished without
1500     typing RETURN on the console. This is only useful if you can change
1501     the boot image or boot device automatically or your assembly robot can
1502     remove the boot floppy via remote control :-) Currently this should
1503     only be used when booting from network card.
1504    
1505 lange 5574 initial::
1506     Used by `setup-storage(8)`. Partitions marked with +preserve_reinstall+
1507 lange 5591 are preserved unless this flag ist set. Often, this flag is set in a
1508     file 'class/*.var' by using setting 'flag_initial=1'.
1509 lange 5499
1510 lange 5574
1511 lange 5499 === [[classc]]The class concept
1512    
1513     ////
1514     MT: as marked above, this section should be put in chapter 1
1515     ////
1516    
1517     Classes determine which configuration file to choose from a list of
1518     available templates. Classes are used in all further tasks of the
1519     installation. To determine which config file to use, an install client
1520     searches the list of defined classes and uses all configuration files
1521     that match a class name. It's also possible to use only the
1522     configuration file with the highest priority since the order of
1523     classes define the priority from low to high. There are some
1524     predefined classes (DEFAULT, LAST and the host name), but classes can
1525     also be listed in a file or defined dynamically by scripts. So it's
1526     easy to define a class depending on the subnet information or on some
1527     hardware that is available on the install client.
1528    
1529     The idea of using classes in general and using certain files matching
1530     a class name for a configuration is adopted from the installation
1531     scripts by Casper Dik for Solaris. This technique proved to be very
1532     useful for the SUN workstations, so I also use it for the fully
1533     automatic installation of Linux. One simple and very efficient feature
1534     of Casper's scripts is to call a command with all files (or on the
1535     first one) whose file names are also a class. The following loop
1536     implements this function in pseudo shell code:
1537    
1538     ----
1539     for class in $all_classes; do
1540     if [ -r $config_dir/$class ]; then
1541     your_command $config_dir/$class
1542     # exit if only the first matching file is needed
1543     fi
1544     done
1545     ----
1546    
1547     Therefore it is possible to add a new file to the configuration
1548     without changing the script. This is because the loop automatically
1549     detects new configuration files that should be used. Unfortunately
1550     cfengine does not support this nice feature, so all classes being used
1551     in cfengine also need to be specified inside the cfengine
1552     scripts. Classes are very important for the fully automatic
1553     installation. If a client belongs to class _A_, we say the class _A_
1554     is defined. A class has no value, it is just defined or
1555     undefined. Within scripts, the variable +$classes+ holds a space
1556     separated list with the names of all defined classes. Classes
1557     determine how the installation is performed. For example, an install
1558     client can be configured to become an FTP server by just adding the
1559     class _FTP_ to it.
1560    
1561     Mostly a configuration is created by only changing or appending the
1562     classes to which a client belongs, making the installation of a new
1563     client very easy. Thus no additional information needs to be added to
1564     the configuration files if the existing classes suffice for your
1565     needs. There are different possibilities to define classes:
1566    
1567     . Some default classes are defined for every host: DEFAULT, LAST and its host name.
1568     . Classes may be listed within a file.
1569     . Classes may be defined by scripts.
1570    
1571     The last option is a very nice feature, since these scripts will
1572     define classes automatically. For example, several classes are defined
1573     only if certain hardware is identified. We use Perl and shell scripts
1574     to define classes. All names of classes, except the host name, are
1575     written in uppercase. They must not contain a hyphen, a hash or a dot,
1576     but may contain underscores. A description of all classes can be found
1577     in '/usr/share/doc/fai-doc/classes_description.txt'.
1578    
1579     host names should rarely be used for the configuration files in the
1580     configuration space. Instead, a class should be defined and then added
1581     for a given host. This is because most of the time the configuration
1582     data is not specific for one host, but can be shared among several
1583     hosts.
1584    
1585     === [[s2]]Defining classes
1586    
1587     The task _defclass_ calls the script `fai-class(1)` to define
1588     classes. Therefore, scripts matching _[0-9][0-9]*_ in _$FAI/class_ are
1589     executed. Additionally, a file with the host name may contain a list
1590     of classes. For more information on defining class, read the manual
1591     pages for `fai-class(1)`.
1592    
1593     The list of all defined classes is stored in the variable +$classes+
1594     and saved to '/tmp/fai/FAI_CLASSES'. The list of all classes is
1595     transferred to `cfengine`, so it can use them too. The script
1596     '10-base-classes' (below is a stripped version) is used to define
1597 lange 5555 classes depending on the host name. First, this script defines the
1598 lange 5499 class with the name of the hardware architecture in uppercase letters.
1599    
1600     ----
1601     10-base-classes:
1602    
1603     # echo architecture and OS name in upper case. Do NOT remove these two lines
1604     uname -s | tr '[:lower:]' '[:upper:]'
1605     dpkg --print-architecture | tr /a-z/ /A-Z/
1606    
1607     [ -f /etc/RUNNING_FROM_FAICD ] && echo "FAICD"
1608    
1609     # use a list of classes for our demo machine
1610     case $HOSTNAME in
1611     demohost)
1612     echo "FAIBASE GRUB DHCPC DEMO" ;;
1613     gnomehost)
1614     echo "FAIBASE GRUB DHCPC DEMO XORG GNOME";;
1615     *)
1616     echo "FAIBASE GRUB DHCPC" ;;
1617     esac
1618     ----
1619    
1620     The script _20-hwdetect.source_ uses the default Debian commands to
1621     detect hardware and to load some kernel modules. If some specific
1622     hardware is found, it can also define a new class for it. You can
1623     find messages from modprobe in '/tmp/fai/kernel.log' and on the fourth
1624     console terminal by pressing _Alt-F4_.
1625    
1626     === [[classvariables]]Defining variables
1627    
1628     The task _defvar_ defines the variables for the install
1629     client. Variables are defined by scripts in _class/*.var_. All global
1630     variables can be set in 'DEFAULT.var'. For certain groups of hosts use
1631     a class file or for a single host use the file +$HOSTNAME+_.var_. Also
1632     here, it's useful to study all the examples.
1633    
1634     The following variables are used in the examples and may also be
1635     useful for your installation:
1636    
1637     FAI_ACTION::
1638     Set the action fai should perform. Normally this is done by
1639 lange 5555 `fai-chboot(8)`. If you can't use this command, define it in the
1640     script 'LAST.var'.
1641 lange 5499
1642 lange 5592 FAI_ALLOW_UNSIGNED::
1643     If set to 1, FAI allows the installation of packages from unsigned
1644     repositories.
1645    
1646 lange 5499 CONSOLEFONT::
1647     Is the font which is loaded during installation by `consolechars(8)`.
1648    
1649     KEYMAP::
1650     Defines the keyboard map files in '/usr/share/keymaps' and
1651     '$FAI/files'. You need not specify the complete path, since this file
1652     will be located automatically.
1653    
1654     ROOTPW::
1655     The encrypted root password for the new system. You can use `crypt(3)`
1656 mika 6012 or md5 encryption for the password. You can create the encrypted
1657     password using `mkpasswd(1)`. See <<hints,chapter various hints>> for
1658     more info.
1659 lange 5499
1660     UTC::
1661     Set hardware clock to UTC if _$UTC=yes_. Otherwise set clock to local
1662     time. See `clock(8)` for more information.
1663    
1664     TIMEZONE::
1665     Is the file relative to '/usr/share/zoneinfo/' which indicates your
1666     time zone.
1667    
1668     MODULESLIST:::
1669     Can be a multi line definition. List of modules (including kernel
1670     parameters) which are loaded during boot of the new system (written to
1671     /etc/modules).
1672    
1673     USE_SETUP_STORAGE::
1674     If set to one (the default when using the class _FAIBASE_ the new
1675     partitioning tool `setup-storage(8)` will be used. Otherwise the old
1676     `setup_harddisks` program is used.
1677    
1678    
1679 lange 5596 === [[diskconfig]]Hard disk configuration
1680 lange 5499
1681 lange 5596 Read the manual page of `setup-storage(8)` for a detailed description
1682     of the new format. This is used by default since FAI 3.2.8 or when
1683     setting the variable +$USE_SETUP_STORAGE+ to 1.
1684 lange 5499
1685    
1686     === [[packageconfig]]Software package configuration
1687    
1688     ////
1689     MT: This section is pretty much a chaos:
1690     which commands belong to which package tools
1691     you say something about PRELOADRM and PRELOAD commands, but give no example
1692     and don't list them otherwise
1693     ////
1694    
1695 lange 5592
1696     Before installing packages, fai will add the content of all files
1697     named _package_config/*.asc_ to the list of apt keys. If your local
1698     repository is signed by your keyid AB12CD34 you can easily add this key,
1699     so fai will use it during installation. Use this command for creating
1700     the '.asc' file:
1701    
1702     ----
1703     faiserver$ gpg -a --export AB12CD34 > /srv/fai/config/package_config/myrepo.asc
1704     ----
1705    
1706    
1707 lange 5499 The script `install_packages(8)` installs the selected software
1708     packages. It uses all configuration files in '$FAI/package_config'
1709     whose file name matches a defined class. The syntax is very simple.
1710    
1711     ----
1712     # an example package class
1713    
1714     PACKAGES taskinst
1715     german
1716    
1717     PACKAGES aptitude
1718     adduser netstd ae
1719     less passwd
1720    
1721     PACKAGES remove
1722     gpm xdm
1723    
1724     PACKAGES aptitude GRUB
1725     lilo- grub
1726    
1727     PACKAGES dselect-upgrade
1728     ddd install
1729     a2ps install
1730     ----
1731    
1732     Comments are starting with a hash (#) and are ending at the end of the
1733     line. Every command begins with the word _PACKAGES_ followed by a
1734     command name. The command defines which command will be used to
1735     install the packages named after this command. The list of all
1736     available commands can be listed using _install_packages -H_.
1737     Supported package tools are: _aptitude, apt-get, smart, y2pmsh, yast,
1738     yum, urpm, rpm_
1739    
1740     hold::
1741     Put a package on hold. This package will not be handled by dpkg, e.g
1742     not upgraded.
1743    
1744     install::
1745     Install all packages that are specified in the following lines. If a
1746     hyphen is appended to the package name (with no intervening space),
1747     the package will be removed, not installed. All package names are
1748     checked for misspellings. Any package which does not exist, will be
1749     removed from the list of packages to install. So be careful not to
1750     misspell any package names.
1751    
1752     remove::
1753     Remove all packages that are specified in the following lines. Append
1754     a + to the package name if the package should be installed.
1755    
1756     taskinst::
1757     Install all packages belonging to the tasks that are specified in the
1758     following lines using `tasksel(1)`. You can also use _aptitude_ for
1759     installing tasks.
1760    
1761     aptitude::
1762     Install all packages with the command `aptitude`. This will be the
1763     default in the future and may replace apt-get and taskinst. Aptitude
1764     can also install task packages.
1765    
1766     aptitude-r::
1767     Same as aptitude with option _--with-recommends_.
1768    
1769     unpack::
1770     Download package and unpack only. Do not configure the package.
1771    
1772     dselect-upgrade::
1773     Set package selections using the following lines and install or remove
1774     the packages specified. These lines are the output of the command
1775     _dpkg --get-selections_.
1776    
1777    
1778     Multiple lines with lists of space separated names of packages follow
1779     the PACKAGES lines. All dependencies are resolved. Packages with
1780     suffix _-_ (eg. _lilo-_) will be removed instead of installed. The
1781     order of the packages is of no matter. If you like to install
1782     packages from another release than the default, you can append the
1783     release name to the package name like in
1784     _openoffice.org/etch-backports_. You can also specify a certain
1785     version like _apt=0.3.1_. More information on these features are
1786     described in `aptitude(8)`.
1787    
1788     A line which contains the _PRELOADRM_ commands, downloads a file using
1789     `wget(1)` into a directory before installing the packages. Using the
1790     _file:_ URL, this file is copied from +$FAI_ROOT+ to the download
1791     directory. For example the package `realplayer` needs an archive to
1792     install the software, so this archive is downloaded to the directory
1793     '/root'. After installing the packages this file will be removed. If
1794     the file shouldn't be removed, use the command _PRELOAD_ instead.
1795    
1796     It's possible to append a list of class names after the command for
1797     apt-get. So this _PACKAGE_ command will only be executed when the
1798     corresponding class is defined. So you can combine many small files
1799     into the file DEFAULT. WARNING! Use this feature only in the file
1800     DEFAULT to keep everything simple. See this file for some examples.
1801    
1802     If you want to remove a package name from a certain class was part of
1803     this class before, you should not remove the package name from the
1804     class file, but instead append a dash (-) to it. This will make sure
1805     that the package is remove during a softupdate on hosts which were
1806     installed using the old class definition which included this package
1807     name.
1808    
1809     If you specify a package that does not exist this package will be
1810     removed from the installation list when the command _install_ is used.
1811    
1812 lange 5555 === [[cscripts]] Customization scripts in _$FAI/scripts_
1813 lange 5499
1814     The default set of scripts in '$FAI/scripts' is only an example. But
1815     they should do a reasonable job for your installation. You can edit
1816     them or add new scripts to match your local needs.
1817    
1818     The command `fai-do-scripts(1)` is called to execute all scripts in
1819     this directory. If a directory with a class name exists, all scripts
1820     matching '[0-9][0-9]*' are executed in alphabetical order. So it's
1821     possible to use scripts of different languages (shell, cfengine,
1822     Perl,..) for one class.
1823    
1824     ==== [[shell]]Shell scripts
1825    
1826     Most scripts are Bourne shell scripts. Shell scripts are useful if the
1827     configuration task only needs to call some shell commands or create a
1828     file from scratch. In order not to write many short scripts, it's
1829     possible to distinguish classes within a script using the command
1830     _ifclass_. For copying files with classes, use the command
1831     `fcopy(8)`. If you want to extract an archive using classes, use
1832     `ftar(8)`. But now have a look at the scripts and see what they are
1833     doing.
1834    
1835     ==== [[perl]]Perl scripts
1836     Currently no Perl script are used in the simple examples for modifying
1837     the system configuration.
1838    
1839     ==== [[expect]]Expect scripts
1840     Currently no expect scripts are used in the simple examples for
1841     modifying the system configuration.
1842    
1843     ==== [[cfengine]]Cfengine scripts
1844    
1845     Cfengine has a rich set of functions to edit existing configuration
1846     files, e.g _LocateLineMatching, ReplaceAll, InsertLine,
1847     AppendIfNoSuchLine, HashCommentLinesContaining_. But it can't handle
1848     variables which are undefined. If a variable is undefined, the whole
1849     cfengine script will abort. Study the examples that are included in
1850     the fai package.
1851    
1852     More information can be found in the manual page `cfengine(8)` or at
1853     the cfengine homepage http://www.cfengine.org.
1854    
1855    
1856     === [[changeboot]]Changing the boot device
1857    
1858     Changing the boot sequence is normally done in the BIOS setup. But you
1859     can't change the BIOS from a running Linux system as far as I know. If
1860     you know how to perform this, please send me an email. But there's
1861     another way of swapping the boot device of a running Linux system.
1862    
1863     ////
1864     MT: recently, there has been some discussion on linux-fai, add a link to the
1865     archives
1866     ////
1867    
1868     So, normally the boot sequence of the BIOS will remain unchanged and
1869     your computer should always boot first from its network card and the
1870     second boot device should be the local disk. Then, it will get an
1871     install kernel image from the install server, when an installation
1872     should be performed, or we can tell pxelinux to boot from local
1873     disk. This is done using `fai-chboot(8)`.
1874    
1875     Here is how to set up a 3Com network card as first boot device.
1876     Enable LAN as first boot device in the BIOS.
1877    
1878     Boot From LAN First: Enabled
1879     Boot Sequence : C only
1880    
1881     Then enter the MBA setup of the 3Com network card and change it as follows:
1882    
1883     Default Boot Local
1884     Local Boot Enabled
1885     Message Timeout 3 Seconds
1886     Boot Failure Prompt Wait for timeout
1887     Boot Failure Next boot device
1888    
1889     This will enable the first IDE hard disk as second boot device after
1890     the network card.
1891    
1892     === [[hooks]]Hooks
1893    
1894     Hooks let you specify functions or programs which are run at certain
1895     steps of the installation process. Before a default task is called,
1896     FAI searches for existing hooks for this task and executes them. As
1897     you might expect, classes are also used when calling hooks. Hooks are
1898     executed for every defined class. You only have to create the hook
1899     with the name for the desired class and it will be used. If several
1900     hooks for a task exists, they are called in the order defined by the
1901     classes. If _debug_ is included in +$FAI_FLAG+ the option _-d_ is
1902     passed to all hooks, so you can debug your own hooks. If some default
1903     tasks should be skipped, use the subroutine _skiptask_ and a list of
1904     default tasks as parameters. The example 'partition.DISKLESS' skips
1905     some default tasks.
1906    
1907     The directory '$FAI/hooks/' contains all hooks. The file name of a
1908     hook consists of a task name as a prefix and a class name, separated
1909     by a dot. The prefix describes the time when the hook is called, if
1910     the class is defined for the install client. For example, the hook
1911     'partition.DISKLESS' is called for every client belonging to the class
1912     _DISKLESS_ before the local disks would be partitioned. If it should
1913     become a diskless client, this hook can mount remote file systems via
1914     NFS and create a _/tmp/fai/fstab_. After that, the installation
1915     process will not try to partition and format a local hard disk,
1916     because a file '/tmp/fai/fstab' already exists.
1917    
1918     A hook of the form _hookprefix.classname_ can't define variables for
1919     the installation script, because it's a subprocess. But you can use
1920     any binary executable or any script you wrote. Hooks that have the
1921     suffix _.source_ (e.g. 'partition.DEFAULT.source') must be Bourne
1922     shell scripts and are sourced. So it's possible to redefine variables
1923     for the installation scripts.
1924    
1925     In the first part of FAI, all hooks with prefix _confdir_ are called.
1926     Since the configuration directory '$FAI' is mounted in the default
1927     task _confdir_, the hooks for this task are the only hooks located in
1928     +$nfsroot+'/$FAI/hooks' on the install server. All other hooks are
1929     found in '$FAI_CONFIGDIR/hooks' on the install server.
1930    
1931     ////
1932     MT: what about softupdate?
1933     ////
1934    
1935    
1936     All hooks that are called before classes are defined can only use the
1937     following classes: _DEFAULT $HOSTNAME LAST_. If a hook for class
1938     _DEFAULT_ should only be called if no hook for class +$HOSTNAME+ is
1939     available, insert these lines to the default hook:
1940    
1941     ----
1942     hookexample.DEFAULT:
1943    
1944     #! /bin/sh
1945    
1946     # skip DEFAULT hook if a hook for $HOSTNAME exists
1947     scriptname=$(basename $0 .DEFAULT)
1948     [-f $FAI/hooks/$scriptname.$HOSTNAME ] && exit
1949     # here follows the actions for class DEFAULT
1950     .
1951     .
1952     ----
1953    
1954     Some examples for what hooks could be used:
1955    
1956     - Use `ssh` in the very beginning to verify that you mounted the
1957     configuration from the correct server and not a possible spoofing
1958     host.
1959    
1960     - Do not mount the configuration directory, instead get a compressed
1961     archive via HTTP and extract it into a new RAM disk, then redefine
1962     +$FAI_LOCATION+.
1963    
1964     - Load kernel modules before classes are defined in '$FAI/class'.
1965    
1966     - Send an email to the administrator if the installation is finished.
1967    
1968     - Install a diskless client and skip local disk partitioning. See
1969     'hooks/partition.DISKLESS'.
1970    
1971    
1972     === [[errors]]Looking for errors
1973    
1974     If the client can't successfully boot from the network card, use
1975     `tcpdump(8)` to look for Ethernet packets between the install server
1976     and the client. Search also for entries in several log files made by
1977 lange 5555 `tftpd(8)` and `dhcpd3(8)` :
1978 lange 5499
1979     ----
1980 lange 5555 faiserver$ egrep "tftpd|dhcpd" /var/log/*
1981 lange 5499 ----
1982    
1983     Sometimes the installation seems to stop, but often there's only a
1984     postinstall script of a software package that requires manual input
1985     from the console. Change to another virtual terminal and look which
1986     process is running with tools like `top(1)` and `pstree(1)`. You can
1987     add _debug_ to _FAI_FLAGS_ to make the installation process show all
1988     output from the postinst scripts on the console and get its input also
1989     from the console. Don't hesitate to send an email to the mailing list
1990 mika 6107 or to mailto:fai@fai-project.org[] if you have any
1991 lange 5499 questions. Sample log files from successfully installed computers are
1992     available on the FAI homepage.
1993    
1994 lange 5555 === [[logfiles]]Log files
1995    
1996     FAI is creating several log files. During installation they are stored
1997     in '/tmp/fai' on the install client itself. At the end of the
1998     installation they will be copied to the install server (see
1999     <<isavelog>>). After the install client rebooted into his newly
2000     installed system, you can find the FAI logs in '/var/log/fai'.
2001     Log files are also created when doing the softupdate or dirinstall
2002     action.
2003    
2004     These a some log files which are created by FAI.
2005    
2006     FAI_CLASSES::
2007     Contains a list of all classes defined.
2008    
2009     dmesg.log::
2010     Output of the `dmesg` command. Contains useful messages of the kernel
2011     ring buffer.
2012    
2013     fai.log::
2014     The main log file. Contains all important information. You should
2015     always read this file.
2016    
2017     boot.log::
2018     A list of variables of network parameters, mostly defined by the DHCP daemon.
2019    
2020     format.log::
2021     Output of the partition tool `setup-storage(8)`.
2022    
2023     shell.log::
2024 lange 5666 Output of all shell scripts, that are used for customization.
2025 lange 5555
2026     variables.log::
2027     A list of all shell variables which are available during an
2028     installation.
2029    
2030     error.log::
2031     A summary of possible errors in all log files.
2032    
2033     If the installation process finishes, the hook 'savelog.LAST.source'
2034     searches all log files for common errors and writes them to the file
2035     'error.log'. So, you should first look into this file for errors. Also
2036     the file 'status.log' give you the exit code of the last command
2037     executed in a script. To be sure, you should look for more details in
2038     all log files.
2039    
2040    
2041 lange 5499 == [[beowulf]]How to build a Beowulf cluster using FAI
2042    
2043     This chapter describes the details about building a Beowulf cluster
2044     using Debian/GNU Linux and FAI. This chapter was written for FAI
2045     version 2.x for Debian woody and was not yet updated. The example
2046     configuration files were removed from the fai packages after FAI
2047     2.8.4.
2048    
2049     For more information about the Beowulf concept look at
2050     http://www.beowulf.org.
2051    
2052     === [[beoplan]]Planning the Beowulf setup
2053    
2054     The example of a Beowulf cluster consists of one master node and 25
2055     clients. A big rack was assembled which all the cases were put into. A
2056     keyboard and a monitor, which are connected to the master server most
2057     of the time, were also put into the rack. But since we have very long
2058     cables for a monitor and a keyboard, they can also be connected to all
2059     nodes if something has to be changed in the BIOS, or when looking for
2060     errors when a node does not boot. Power supply is another topic you
2061     have to think about. Don't connect many nodes to one power cord and
2062     one outlet. Distribute them among several breakout boxes and outlets.
2063     And what about the heat emission? A dozen nodes in a small room can
2064     create too much heat, so you will need an air conditioner. Will the
2065     power supplies of each node go to stand-by mode or are all nodes
2066     turned on simultaneously after a power failure?
2067    
2068     All computers in this example are connected to a Fast Ethernet
2069     switch. The master node (or master server) is called _nucleus_. It has
2070     two network cards. One for the connection to the external Internet,
2071     one for the connection to the internal cluster network. If connected
2072     from the external Internet, it's called _nucleus_, but the cluster
2073     nodes access the master node with the name _atom00_, which is a name
2074     for the second network interface. The master server is also the
2075     install server for the computing nodes. A local Debian mirror will be
2076     installed on the local hard disk. The home directories of all user
2077     accounts are also located on the master server. It will be exported
2078     via NFS to all computing nodes. NIS will be used to distribute
2079     account, host, and printer information to all nodes.
2080    
2081     All client nodes _atom01_ to _atom25_ are connected via the switch
2082     with the second interface card of the master node. They can only
2083     connect to the other nodes or the master, but can't communicate to any
2084     host outside their cluster network. So, all services (NTP, DNS, NIS,
2085     NFS, ...) must be available on the master server. I chose the class C
2086     network address _192.168.42.0_ for building the local Beowulf cluster
2087     network. You can replace the subnet 42 with any other number you
2088     like. If you have more than 253 computing nodes, choose a class A
2089     network address (10.X.X.X).
2090    
2091     In the phase of preparing the installation, you have to boot the first
2092     install client many times, until there's no fault in your
2093     configuration scripts. Therefore you should have physical access to
2094     the master server and one client node. So, connect both computers to a
2095     switch box, so one keyboard and monitor can be shared among both.
2096    
2097    
2098     === [[master]]Set up the master server
2099    
2100     The master server will be installed by hand if it is your first
2101     computer installed with Debian. If you already have a host running
2102     Debian, you can also install the master server via FAI. Create a
2103     partition on '/files/scratch/debmirror' for the local Debian mirror
2104 lange 5549 with more than {mirrorsize} GB space available.
2105 lange 5499
2106     ==== [[beonetworkmaster]]Set up the network
2107    
2108     Add the following lines for the second network card to
2109     '/etc/network/interfaces':
2110    
2111     ----
2112     # Beowulf cluster connection
2113     auto eth1
2114     iface eth1 inet static
2115     address 192.168.42.250
2116     netmask 255.255.255.0
2117     broadcast 192.168.42.255
2118     ----
2119    
2120     Add the IP addresses for the client nodes. The FAI package has an
2121     example for this '/etc/hosts' file:
2122    
2123     ----
2124     # create these entries with the Perl one liner
2125     # perl -e 'for (1..25) {printf "192.168.42.%s atom%02s\n",$_,$_;}'
2126    
2127     # Beowulf nodes
2128     # atom00 is the master server
2129     192.168.42.250 atom00
2130     192.168.42.1 atom01
2131     192.168.42.2 atom02
2132     ----
2133    
2134     You can give the internal Beowulf network a name when you add this
2135     line to '/etc/networks':
2136    
2137     beowcluster 192.168.42.0
2138    
2139    
2140     Activate the second network interface with: _/etc/init.d/networking start_.
2141    
2142     ==== [[beonis]]Setting up NIS
2143    
2144     Add a normal user account +tom+ which is the person who edits
2145     the configuration space and manages the local Debian mirror:
2146    
2147     # adduser tom
2148     # addgroup linuxadmin
2149    
2150     This user should also be in the group +linuxadmin+.
2151    
2152     # adduser tom linuxadmin
2153    
2154 lange 5555 First, set the NIS domainname name by creating the file
2155 lange 5499 '/etc/defaultdomain' and call `domainname(8)`. To initialize the
2156     master server as NIS server call _/usr/lib/yp/ypinit -m_. Also edit
2157     '/etc/default/nis' so the host becomes a NIS master server. Then,
2158     copy the file 'netgroup' from the examples directory to '/etc' and
2159     edit other files there. Adjust access to the NIS service.
2160    
2161     ----
2162     /etc/ypserv.securenets:
2163    
2164     # Always allow access for localhost
2165     255.0.0.0 127.0.0.0
2166     # This line gives access to the Beowulf cluster
2167     255.255.255.0 192.168.42.0
2168     ----
2169    
2170     Rebuild the NIS maps:
2171    
2172     ----
2173     master# cd /var/yp; make
2174     ----
2175    
2176     You will find much more information about NIS in the
2177     'NIS-HOWTO' document.
2178    
2179     ==== [[beomirror]]Create a local Debian mirror
2180    
2181     Now the user +tom+ can create a local Debian mirror on
2182     '/files/scratch/debmirror' using `mkdebmirror`. You can add the option
2183     _--debug_ to see which files are received. This will need about 250 GB
2184     disk space for Debian 3.0 (aka woody). Export this directory to the
2185     netgroup _@faiclients_ read only. Here's the line for '/etc/exports':
2186    
2187     /files/scratch/debmirror *(ro)
2188    
2189     ==== [[fai1]]Install FAI package on the master server
2190    
2191     Add the following packages to the install server:
2192    
2193     ----
2194     nucleus:/# apt-get install ntp tftpd-hpa dhcp3-server \
2195     nfs-kernel-server etherwake fai
2196     nucleus:/# tasksel -q -n install dns-server
2197     nucleus:/# apt-get dselect-upgrade
2198     ----
2199    
2200     Configure NTP so that the master server will have the correct system time.
2201    
2202    
2203     It's very important to use the internal network name +atom00+ for the
2204     master server (not the external name +nucleus+) in
2205     '/etc/dhcp3/dhcpd.conf' and 'make-fai-nfsroot.conf'. Replace the
2206     strings FAISERVER with _atom00_ and uncomment the following line in
2207     'make-fai-nfsroot.conf' so the Beowulf nodes can use the name for
2208     connecting to their master server.
2209    
2210     ----
2211     NFSROOT_ETC_HOSTS="192.168.42.250 atom00"
2212     ----
2213    
2214     ==== [[bootp1]]Prepare network booting
2215    
2216     Set up the install server daemon as described in <<pxeboot>>. If you
2217     will have many cluster nodes (more than about 10) and you will use
2218     _rsh_ in 'fai.conf' raise the number of connects per minute to some
2219     services in 'inetd.conf':
2220    
2221     ----
2222     shell stream tcp nowait.300 root /usr/sbin/tcpd /usr/sbin/in.rshd
2223     login stream tcp nowait.300 root /usr/sbin/tcpd /usr/sbin/in.rlogind
2224     ----
2225    
2226     The user +tom+ should have permission to create the
2227     symlinks for booting via network card, so change the group and add
2228     some utilities.
2229    
2230    
2231     ----
2232     # chgrp -R linuxadmin /srv/tftp/fai; chmod -R g+rwx /srv/tftp/fai
2233     # cp /usr/share/doc/fai-doc/examples/utils/* /usr/local/bin
2234     ----
2235    
2236     Now, the user +tom+ sets the boot image for the first beowulf
2237     node.
2238    
2239     ----
2240     $ fai-chboot -IFv atom01
2241     ----
2242    
2243     Now boot the first client node for the first time. Then start to
2244     adjust the configuration for your client nodes.
2245    
2246     === [[beotools]]Tools for Beowulf clusters
2247    
2248     The following tools are useful for a Beowulf cluster:
2249    
2250     all_hosts::
2251     Print a list of all hosts, print only the hosts which respond to a
2252     ping or the hosts which do not respond. The complete list of hosts is
2253     defined by the netgroup _allhosts_. Look at
2254     '/usr/share/doc/fai-doc/examples/etc/netgroup' for an example.
2255    
2256     rshall::
2257     Execute a command on all hosts which are up via rsh. Uses `all_hosts`
2258     to get the list of all hosts up. You can also use the `dsh(1)` command
2259     (dancer's shell, or distributed shell).
2260    
2261     rup::
2262     The command `rup(1)` shows briefly the CPU load of every host.
2263    
2264     clusterssh::
2265     The package clusterssh allows you to control multiple ssh or rsh
2266     sessions at the same time.
2267    
2268     These are some common tools for a cluster environment:
2269    
2270     rgang::
2271     For a huge cluster try `rgang`. It's is a tool which executes commands
2272     on or distributes files to many nodes. It uses an algorithm to build a
2273     tree-like structure to allow the distribution processing time to scale
2274     very well to 1000 or more nodes (available at
2275     http://fermitools.fnal.gov/abstracts/rgang/abstract.html).
2276    
2277     jmon::
2278     For observing the resources of all clients (CPU, memory, swap,...)
2279     you can use `jmon(1)` which installs a simple daemon on every cluster
2280     node.
2281    
2282     ganglia::
2283     This toolkit is very good for monitoring your cluster with a nice web
2284     frontend. Available at http://ganglia.sourceforge.net
2285    
2286     === [[wol]]Wake on LAN with 3Com network cards
2287    
2288     Wake on LAN is a very nice feature to power on a computer without
2289     having physical access to it. By sending a special ethernet packet to
2290     the network card, the computer will be turned on. The following things
2291     have to be done, to use the wake on LAN (WOL) feature.
2292    
2293     . Connect the network card to the Wake-On-LAN connector on the
2294     motherboard using a 3 pin cable.
2295     . My ASUS K7M motherboard has a jumper called
2296     _Vaux (3VSBSLT)_ which allows to select the voltage supplied to add-in
2297     PCI cards. Set it to _Add 3VSB_ (3 Volt stand by).
2298     . Turn on the wake on LAN feature in BIOS
2299     . For a 3Com card using the 3c59x driver you must enable the
2300     WOL feature using the kernel module option _enable_wol_.
2301    
2302     To wake up a computer use the command `etherwake(8)`.
2303    
2304 lange 5555 == [[arch]]FAI on other architectures
2305 lange 5499 If you want to use FAI on other architectures than i386 or amd64 you
2306     might need to take care of some things yourself.
2307    
2308     These are things that may have to be changed on other architectures:
2309    
2310     Boot loader::
2311     There are scripts for setting up `lilo(8)` and `grub(8)`. Here you may
2312     add support for your specific boot loader.
2313    
2314     If you want to serve multiple nfsroot directories on one FAI server,
2315     you need to create specific config directories in '/etc' for fai, like
2316     '/etc/fai-sarge' and '/etc/fai-etch'. Then you need to set the
2317 lange 5555 +$NFSROOT+ variables to different directories and run
2318 lange 5499
2319     ----
2320     faiserver#make-fai-nfsroot -c /etc/fai-sarge
2321     ----
2322    
2323 lange 5590 === [[archcross]]How to install i386 systems from an amd64 system
2324    
2325     To install a computer with a 32bit i386 system, you need an i386 nfsroot.
2326     Creating this 32bit nfsroot on an install server runnning amd64 is
2327     quiet simple. Install and setup the fai packages. Then copy your fai
2328     config files to a new subdirectory.
2329    
2330     ----
2331     faiserver# cp -a /etc/fai /etc/fai-i386
2332     ----
2333    
2334     Edit the variable +$FAI_DEBOOTSTRAP_OPTS+ in
2335     '/etc/fai-i386/make-fai-nfsroot.conf' and add the option +--arch
2336     i386+. Also choose a different directory for your new nfsroot. Here
2337     are the two lines after editing.
2338    
2339     ----
2340     NFSROOT=/srv/fai/nfsroot-i386
2341     FAI_DEBOOTSTRAP_OPTS="--arch i386 --exclude=info"
2342     ----
2343    
2344     Now call make-fai-nfsroot which creates the 32bit i386 nfsroot in
2345     '/srv/fai/nfsroot-i386'
2346    
2347     ----
2348     faiserver# make-fai-nfsroot -v -C/etc/fai-i386
2349     ----
2350    
2351     Creating a partitial mirror using `fai-mirror(1)` that is needed for
2352     a bootable CD or USB stick is also possible on a different architecture.
2353     Due to a bug in apt-move (#441231), you have to specify the
2354     architecture when calling fai-mirror.
2355    
2356     ----
2357     $ export MAXPACKAGES=800
2358     $ fai-mirror -a i386 -v -cDEFAULT,FAIBASE,I386 /srv/mirror-i386
2359     ----
2360    
2361     That's all!
2362    
2363    
2364 lange 5499 === [[powerpc]]FAI on PowerPC
2365     There's some stuff on http://www.layer-acht.org/fai. Most notably
2366     there are hooks for partitioning and config-files to setup bootloaders
2367     for oldworld and newworld.
2368    
2369     === [[ia64]]FAI on IA64
2370     There's one big IA64 Beowulf cluster running which was installed with
2371     FAI. Only the partitioning part has to be replaced by a short script,
2372     since sfdisk is not available on IA64. This should not be need any
2373     more since the patitioning tool `setup-storage(8)` works on all
2374     architectures, were parted is supported.
2375    
2376 lange 5555
2377     === [[otherbase]]Installing other distributions using a Debian nfsroot
2378    
2379     You can install all sorts of Linux distributions from a single Debian
2380     nfsroot. Therefore you have to create a base.tgz of the distribution
2381     you like to install and place it info the `basefiles` directory. Then
2382     name it UBUNTU910.tar.gz for example. An install client which belongs
2383     to the class UBUNTU910 then extracts this base file into its empty
2384     file system. Additionally you have to adjust the 'sources.list' or
2385     similar configuration files which are needed for specifying the
2386     location of the package repository.
2387    
2388     ////
2389     rpmstrap
2390     mach (make a chroot)
2391     ////
2392    
2393    
2394 lange 5499 === [[odists]]FAI for Ubuntu, Suse, Redhat and Gentoo
2395     All FAI packages are available in Ubuntu and are used by a large
2396     number of people since many version.
2397    
2398     Many people are interested in FAI for other (mostly RPM based) Linux
2399     distributions. I made some research and it should not be much work to
2400     implement it. But I need more help to implement it. If you are
2401     interested and would like to help me, please send an email to
2402 mika 6107 mailto:fai@fai-project.org[].
2403 lange 5499
2404     A brief description how to install SLES9 with FAI is available at
2405     http://www.sourcecode.de/install_sles_with_fai.
2406    
2407     There are also some information in the faiwiki.
2408    
2409     === [[sparc]]FAI on SUN SPARC hardware running Linux
2410    
2411     Although FAI is architecture independent, there are some packages
2412     which are only available for certain architectures (e.g. silo,
2413     sparc-utils).
2414    
2415     SUN SPARC computers can boot from their boot prompt. To boot a SUN
2416     use:
2417    
2418     boot net:dhcp - ip=::::::dhcp
2419    
2420    
2421     You have to convert the kernel image from ELF format to a.out
2422     format. Use the program `elftoaout` (mentioned in the FAQ). The
2423     symlink to the kernel image to be booted is not the host name.
2424    
2425     A success report as of 2001 is available at http://www.opossum.ch/fai/.
2426    
2427     === [[solaris]]FAI for Solaris
2428    
2429     FAI has also been ported for use with SUN Solaris OS installations in
2430     cooperation with Solaris jumpstart. This was done using FAI 2.8.4 and
2431     Solaris 9. Get the FAI sources from FAI 2.8.4 and change to the
2432     'sunos' directory. There you can call _make_ which creates the tarball
2433     '/tmp/fai-solaris.tar.gz'. You have to read the file 'README.sunos'
2434     and have some knowledge about Solaris jumpstart. The Solaris support
2435     was removed in FAI 2.9.
2436    
2437     The file format of the configuration files in 'disk_config' and
2438     'package_config' are different than those for Linux.
2439    
2440     == [[advanced]]Advanced FAI
2441    
2442 lange 5555 === [[dirinstall]]Creating chroot and virtualization environments
2443 lange 5499
2444     If you have some chroot environments to install, or a virtualization
2445     environment where you neither can nor want to run a normal Debian
2446     Installer in to get to a working system (for example, Xen guest
2447     domains), there is the FAI action _dirinstall_.
2448     By calling
2449    
2450     ----
2451     faiserver# fai <options> dirinstall <target-directory>
2452     ----
2453    
2454     and using either the option _-c <classes>_ or _-N_ you get a FAI
2455     installation, without the partitioning action, right into the target
2456     directory. The host name for the target installation can be specified
2457     using _-u <host-name>_
2458    
2459     This, for example, can be used to combine FAI with the tool
2460     _xen-tools_, which helps you to build Xen guest domains. _xen-tools_
2461     are very nice for generating configuration files and block devices for
2462     new guests based on simple commands and/or configuration files, but
2463     they can only assign one role per installation for customization.
2464     FAI-users need and want more, as they are used to have the class
2465     system. They get them even in xen-tools installations, by using the
2466     following code as a xen-tools role script:
2467    
2468     ----
2469     #!/bin/sh
2470     TARGET=$1
2471     CMD="fai -N -v -u ${hostname} dirinstall $TARGET"
2472     echo running $CMD
2473     $CMD
2474     ----
2475    
2476     Then, you will want to set the variable _install=0_ the xen-tools
2477     config for that host (in previous versions of xen-tools, this was
2478     _no-install=1_).
2479    
2480     === [[softupdate]]Using FAI for updates
2481     FAI is even usable for system updates, using the same configuration as
2482     if initially installing. System update means updating the running
2483     system without doing a re-installation. An updated client will almost
2484     look like a newly installed machine, though all local data is
2485     preserved (except of course newer configuration files introduced in
2486     the FAI config).
2487    
2488     ==== [[aboutsoftupdate]]How does a softupdate work?
2489    
2490     Softupdate use the same configuration files as a new FAI
2491     installation. They even use the default FAI commands, so they behave
2492     _nearly_ in the same way as an installation, though some things are
2493     different:
2494    
2495     * By default the old list of classes (created during the initial
2496     installation) is used, so `fai-class` is not called to define a new
2497     list of classes. This can be changed by calling _fai -N softupdate_.
2498    
2499     * No partitioning and file system creation is performed.
2500     * The basesytem isn't bootstrapped.
2501     * FAI skips tasks only useful when installing, such as setting up
2502     a keymap or starting special daemons.
2503     * FAI doesn't prevent software packages to (re-)start daemons.
2504     * FAI doesn't reboot at the end of a softupdate.
2505    
2506     Except these changes, things are the same as when installing a new computer:
2507    
2508     . Define classes (by default use old list) and variables.
2509     . Update the installed packages.
2510     . Install new software.
2511     . Call configuration scripts.
2512     . Save the logfiles.
2513    
2514     ==== [[runsoftupdate]]How to run a softupdate
2515    
2516     As softupdate use the same infrastructure as a FAI installation, you
2517     even start them by using the same command `fai(8)` which is used for
2518     installation:
2519    
2520     ----
2521 lange 5555 # fai -v softupdate
2522 lange 5499 ----
2523    
2524     starts a softupdate.
2525 lange 5555 Make sure to set the variable +$LOGSERVER+ (done in a _class/*.var_
2526 lange 5499 file) if fai should save the log files to a remote machine.
2527    
2528     ===== How to do mass softupdates
2529     Probably you don't want to run to each client and start a softupdate
2530     there locally, so a mechanism to start an update there has to be
2531     thought of.
2532    
2533     ===== Cron
2534     One possible solution is to use crontab entries on the clients to
2535     start an update, but in big installations you have to consider
2536     including a random-delay mechanism, because too many updates at the
2537     same time may produce too much traffic on your network.
2538    
2539     ===== Starting a softupdate remotely
2540     If you want more control when exactly a softupdate is run on the
2541     clients and maybe want to monitor it while it is running, you can
2542     install remote root login mechanisms on your clients, preferably using
2543     ssh in connection with a authorized key for root logins.
2544    
2545     Tools like _clusterssh_ allow you to login onto a group of clients at
2546     once and run _fai softupdate_ there, while the results can be seen
2547     immediately in the terminals started for each host.
2548    
2549    
2550     ==== [[confsoftupdate]]How to write a configuration suitable for softupdate
2551     When you want to do softupdate, you have to be even more careful when
2552     writing your configuration: it has to be *idempotent*, i.e. running
2553     all the scripts twice should result in the same system configuration
2554     as running them once. Some things to keep an eye on:
2555    
2556    
2557     - *Never* blindly append to files:
2558    
2559     $ echo $SOMETHING >> /etc/fstab
2560    
2561     is almost certainly wrong. Either check manually if the line already
2562     exists *before* appending or use the command `ainsl(1)`. This has a
2563     similar function to cfengine's _AppendIfNoSuchLine_ statement
2564    
2565     - Make use of FAI's environment variables to determine what to do in
2566     your configuration scripts! Some of the most important ones:
2567    
2568    
2569 lange 5555 +$FAI_CONFIG_SRC+::
2570 lange 5499 is the URI of the configuration space.
2571    
2572 lange 5555 +$FAI_ROOT+::
2573     points to the client's rootdir. In case of softupdate it's the root
2574     directory _/_
2575 lange 5499
2576 lange 5555 +$ROOTCMD+::
2577 lange 5499 contains a command for _chrooting_
2578     into the client. This is empty when doing
2579     softupdate (as _/_ is already our root...).
2580    
2581 lange 5555 +$FAI_ACTION+::
2582 lange 5499 contains the currently executed action:
2583     * _install_ when installing.
2584     * _softupdate_ when updating
2585    
2586 lange 5555 - Restart daemons if needed: most daemons only read their
2587 lange 5499 configuration when starting; if you modify it, you need to
2588     make them reload it using
2589    
2590     ....
2591     $ROOTCMD invoke-rc.d $somedaemon reload
2592     ....
2593     or even restart them
2594    
2595     ....
2596     $ROOTCMD invoke-rc.d $somedaemon restart
2597     ....
2598     when the configuration for _$somedaemon_ has been changed
2599     footnote:[You can for example use `fcopy(8)`'s _postinst_ script
2600     support for doing this; if other things than _fcopy_ modify your
2601     conffiles, you have to keep track of the changes yourself.]
2602    
2603     - Other things like scheduling a reboot if a new kernel is installed
2604    
2605     ==== [[localconfsoftupdate]]What if there are locally changed config files?
2606    
2607     *Short: there shouldn't be any!*
2608    
2609     *Long:* _if_ you are using FAI _softupdate_ to update client's
2610     configuration, you shouldn't do any local changes on the install
2611     clients, because they may be lost while updating. Backup copies are
2612     done by fcopy only on the local disk. By default, they are written to
2613     the same directory as the original file, with _.pre_fcopy_ appended.
2614     If you want to save them together with the logfiles,
2615     add following line to your _class/DEFAULT.var_:
2616     ....
2617     FAI_BACKUPDIR=$LOGDIR/backup
2618     ....
2619    
2620     ==== [[detectlocalchanges]]How to detect locally changed files?
2621    
2622     If you are playing with local configuration changes _despite all the
2623     warnings contained in this section_, there must be a way to check what
2624     has been changed locally. A simple approach would be to use _debsums
2625     -e_, but this method fails miserably if you modify conffiles in your
2626     FAI scripts, because it only checks against the version contained in
2627     the Debian package. A better proposal is to setup/abuse `tripwire(8)` or
2628     `integrit(1)` to scan for local changes and notify you about them.
2629    
2630    
2631     == [[hints]]Various hints
2632    
2633     This chapter has various hints which may not always be explained in great
2634     detail.
2635    
2636 lange 5555 - To generate a md5 hash for the password use this
2637 lange 5499 _echo "yoursecrectpassword" | mkpasswd -Hmd5 -s_
2638    
2639 lange 5555 - When using HTTP access to a Debian mirror, the local _/var_ partition
2640 lange 5499 on all install clients must be big enough to keep the downloaded
2641     Debian packages. Do not try with less than 250 Mbytes unless you know
2642     why. You can limit the number of packages installed at a time with the
2643     variable +$MAXPACKAGES+.
2644    
2645 lange 5556 - You can remove the red logo on the install client by simply calling
2646     `reset` once. If will also not appear if you create a file using this
2647     command on the install server:
2648    
2649     ----
2650     touch /srv/fai/nfsroot/live/filesystem.dir/.nocolorlogo
2651     ----
2652    
2653 lange 5555 - You can shorten some scripts by using one single fcopy
2654 lange 5499 command _fcopy -r /_.
2655    
2656 lange 5555 - If you rebuild the nfsroot, you will create a new ssh host key inside
2657 lange 5499 the nfsroot. Then logging in to an install client may fail, because
2658     the host key changes. You can use this:
2659    
2660     ----
2661     $ ssh -o StrictHostKeyChecking=no root@installclient
2662     ----
2663    
2664 lange 5555 - You can also delete the host entry on your install client in your
2665 lange 5666 _~/.ssh/known_hosts_ file by using the _ssh-keygen -R_ command.
2666 lange 5499
2667 lange 5555 - In the tasks chboot and savelog, a connection using secure shell is
2668 lange 5499 opened to the FAI server (see <<isavelog>>). To ensure that this works
2669     non-interactively, a proper entry in 'NFSROOT/root/.ssh/known_hosts'
2670     must be created. When using fai-setup, this is done automatically, but
2671     it may require manual editing in case the name of your FAI server was
2672     not determined correctly. If you stumble over ssh connections that
2673     require typing "yes" to accept the host key during installation,
2674     please check the contents of your 'NFSROOT/root/.ssh/known_hosts file'
2675    
2676 lange 5555 - You can calculate the IP subnet address by using the
2677 lange 5499 nice tool ipcalc. Following example gives you the notation for a class
2678 lange 5666 C network (24) when the server network interface has the IP address
2679 lange 5499 123.45.6.123
2680    
2681     ----
2682 lange 5666 $ ipcalc -nb 123.45.6.123 24|grep Network:
2683 lange 5499 ----
2684    
2685 lange 5555 - You can merge two directories which contain configuration information,
2686 lange 5499 if one is a global one, and the other a local one. We use it to merge
2687     the templates from the FAI package, and our local configuration, which
2688     contains encrypted passwords and other information that should not be
2689     readable by others. If you remove a file in your local configuration,
2690     do not forget to remove this file also in the configuration space,
2691     otherwise it will still be used.
2692    
2693 lange 5732 - After calling `set_disk_info`, a list of all local hard disks is
2694     stored in +$disklist+.
2695 lange 5499
2696 lange 5555 - Use `fai-divert -a` if a postinst script calls a configuration
2697 lange 5499 program, e.g. the postinst script for package apache calls
2698     apacheconfig, which needs manual input. You can fake the configuration
2699     program so the installation can be fully automatic. But don't forget
2700     to use `fai-divert -R` to remove all faked scripts.
2701    
2702 lange 5555 - During the installation you can execute commands inside the newly
2703 lange 5499 installed system in a chroot environment by using _chroot /target_ or
2704     just _$ROOTCMD_ followed by the command you want to call; for example
2705     _$ROOTCMD dpkg -l_ shows the packages installed on the new system.
2706    
2707 lange 5549 ////
2708 lange 5499
2709     MT: has been said already The only task which has to be done manually
2710     for new hardware is to assign the MAC address to a host name and to an
2711     IP address, and to define classes for this host if the existing
2712     configuration files are not generic enough to deal with this new host.
2713    
2714     There's a tradeoff between writing a few large configuration scripts,
2715     or many short scripts, one for each class. Large scripts can
2716     distinguish classes by using case statements, the _ifclass_ test or
2717     with class mechanisms for _cfengine_ scripts.
2718    
2719     ////
2720    
2721 lange 5555 - If your computer can't boot from the network card, you do not always
2722 lange 5499 need to boot from floppy. Add the class _FAI\_BOOTPART_ and FAI will
2723     automatically create a lilo or grub entry for booting the FAI
2724     bootfloppy from this partition. So you can start the re-installation
2725     without a boot floppy. This will also make the test phase shorter,
2726     since booting from hard disk is much faster than booting from
2727     floppy. You can also set a password for this boot menu.
2728    
2729 lange 5555 - How can I define classes on the kernel command line?
2730     +
2731 lange 5499 Read the man page of `fai-class(8)`
2732    
2733 lange 5599 - How to use a custom kernel inside the nfsroot?
2734     +
2735     Build your customized kernel by building a kernel package using
2736     `make-kpkg(8)` and use the option `--initrd`. Copy this Debian package
2737     to a local repository and add it to /etc/fai/sources.list. Add the
2738     name of your package to /etc/fai/NFSROOT. Then rebuild the nfsroot.
2739    
2740 lange 5555 - On http://www.layer-acht.org/fai you will find an example how to fully
2741 lange 5499 automatically install a system using the Debian Installer (d-i) in
2742     conjunction with FAI's softupdate (see <<softupdate>>).
2743 lange 5599
2744    

  ViewVC Help
Powered by ViewVC 1.1.5