Wheezy step-by-step howto

From FAIWiki
Revision as of 12:23, 19 June 2014 by DenisChapligin (talk | contribs) (Initial edition)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

When i started (again) with FAI on Debian Wheezy i suddenly realized, that official documentation is not that good and relevant, as i expected. So running a FAI server for a newbie could be problematic, due to some nonintuitive problems and undocumented issues.

0. Upgrade to the latest FAI (Optional step)

FAI version in Debian Wheezy is 4.0.8, but latest FAI version at the time of writing this guide were 4.2 and it is available from unstable. I would recommend to backport it from unstable to wheezy and that is not hard.

First of all, retrieve FAI sources from unstable:

echo "deb-src http://ftp.XX.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/Unstable.sources.list 
apt-get update
apt-get source fai-client

You also have to dowload all build dependencies:

apt-get build-dep fai-client

And, may be, build toolchain and utilities:

apt-get install build-essential

Finally, build the beast:

cd fai-4.2; dpkg-buildpackage -rfakeroot

Then install buil packages as usual and proceed. Issues of packages signing, installation, publication etc., are obviously outside of the scope of this guide.

1. Install FAI

Just

apt-get install fai-quicksetup

It will install FAI packages, tftp and dhcp servers.

2. Server configuration

Edit /etc/fai/fai.conf

 # Account for saving log files and calling fai-chboot.
 LOGUSER=fai
 # URL to access the fai config space
 FAI_CONFIG_SRC=nfs://fai.example.net/srv/fai/config

For some reason dracut doesn't works reliably with root on http server, so you may want to enable live boot. Replace

 dracut-network live-boot- live-boot-initramfs-tools-

with

 dracut-network live-boot live-boot-initramfs-tools

Finally run

 fai-setup -v

It will take some time and may broke your existing dhcp/tftp configuration.

When it (successfully) finished, copy default configuration into $FAI_CONFIG_SRC

 cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config

And check exports file (/etc/exports), it should look like this:

 /srv/fai/config (async,ro,no_subtree_check)
 /srv/fai/nfsroot (async,ro,no_subtree_check,no_root_squash)

It may optionally include access control lists for exported dirs, depending on your network configuration. The only problem with that kind of exports file, that it will not work, due to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676883#10 To apply a workaround you need to create an empty directory and add it to the exports file:

 echo "/srv/nfs4       (fsid=0,ro,no_subtree_check)" >> /etc/exports
 mkdir /srv/nfs4

Restart your NFS server after that:

 # /etc/init.d/nfs-kernel-server restart
 [ ok ] Stopping NFS kernel daemon: mountd nfsd.
 [ ok ] Unexporting directories for NFS kernel daemon....
 [ ok ] Exporting directories for NFS kernel daemon....
 [ ok ] Starting NFS kernel daemon: nfsd mountd.

Last thing, you should prepare is DHCP server. Edit /etc/dhcp/dhcpd.conf and add configuration for your subnet:

 subnet  192.168.0.0 netmask 255.255.255.0 {
  option routers 192.168.0.1;
  option domain-name "example.org";
  option domain-name-servers 192.168.0.1;
  option ntp-servers pool.ntp.org;
  server-name fai.example.org;
  next-server fai.example.org;
  filename "fai/pxelinux.0";
  allow booting;
  allow bootp;
 }

At this example i assume, that your network is 192.168.0.0/24, and the fai server on 192.168.0.1 also acts as gateway and DNS server. I also assume that you have operational DNS. Don't forget to restart DHCP server.

3. Adding additional installation target. (Optional)

Well, sometimes it is required to install different Debian releases or different hardware architectures. In this section we will prepare two different Debian 7 installation targets for i686 and amd64 architectures.

Earlier we ended with preparation of some flavour of Debian, in my case that was amd64. Let's make some changes:

 mv /etc/fai /etc/fai-amd64
 mv /srv/fai/nfsroot /srv/fai/nfsroot-amd64

Don't forget to edit /etc/exports:

 /srv/fai/config *(async,ro,no_subtree_check)
 /srv/fai/nfsroot-amd64 *(async,ro,no_subtree_check,no_root_squash)
 /srv/nfs4       *(fsid=0,ro,no_subtree_check)

and /etc/fai-amd64/nfsroot.conf (just change the path).

Now, prepare FAI server for i686:

 cp -a /etc/fai-amd64/ /etc/fai-i686

Modify /etc/fai-i686/nfsroot.conf:

 NFSROOT=/srv/fai/nfsroot-i686
 FAI_DEBOOTSTRAP_OPTS="--arch i386 --exclude=info"

and generate new nfsroot:

  make-fai-nfsroot -v -C/etc/fai-i686