GuestbookSign our guestbook ContactGet in touch with the authors ArchiveAll unixwerk articles since 2003
January 04, 2011

Setting up a Netinstall Server under Fedora

This article is based on the article »Setting up a Netinstall Server under Slackware«. It explains how to setup a netinstall server on Fedora that can be used to install Slackware over the network, i.e. the server is running on Fedora but the setup is intended to install Slackware on a network client (what reflects my setup at home).

Contents

  1. Introduction
  2. Requirements
  3. Setting up DHCP
  4. Setting up TFTP
  5. Setting up NFS
  6. Installing Linux on a Client from the Netinstall Server

1. Introduction

Installing clients over the network rather than from CD/DVD is a common method in professional environments. For private use there never was a great benefit over installing from a physical media. But since netbooks become more and more popular booting and installing over network is an interesting option even for private use. That's because these computers often lack an integrated optical drive. On the other hand a network card is always there. This article shows how to create a netinstall server on a Fedora box so you can install your netbook with Slackware or just boot a rescue linux image over the network.

2. Requirements

In order to build a Netinstall Server suitable for installing Linux over the network you need to setup three services:

3. Setting up DHCP

First we have to configure a basic /etc/dhcpd.conf:

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#

authoritative;
ddns-update-style none;
allow bootp;

# Point to the TFTP server:
next-server 192.168.1.44;

# Default lease is 1 week (604800 sec.)
default-lease-time 604800;
# Max lease is 4 weeks (2419200 sec.)
max-lease-time 2419200;

subnet 192.168.1.0 netmask 255.255.255.0 {
    option domain-name "somedomain.net";
    option broadcast-address 192.168.1.255;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 192.168.1.44;
    option routers 192.168.1.1;
    range dynamic-bootp 192.168.1.224 192.168.1.254;
    use-host-decl-names on;
    if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
      filename "/slackware-13.1/pxelinux.0";
    }
}

The above configuration is an example taken from my computer. It's for a network 192.168.1.0/24, a netinstall server with the IP 192.168.1.44, and a default gateway 192.168.1.1. The DHCP range is configured from 192.168.1.224 to 192.168.1.254. Adapt these values to your network and needs. The filename /slackware-13.1/pxelinux.0 is used for the TFTP server configuration below. Adapt it to your needs if you want.

Basically that's it for the DHCP server. It's likely that the server is disabled on your system (or even not installed). Install it with:

instserver# yum install dhcp

Check if it is enabled:


instserver# chkconfig --list dhcpd
dhcpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off

and start it if needed:

instserver# /etc/init.d/dhcpd start
Starting dhcpd:                                            [  OK  ]

For regular use you could enable it at boottime:

instserver# chkconfig dhcpd on

4. Setting up TFTP

First we have to install the TFTP server (if not already there):

instserver# yum install tftp tftp-server

Second we have to create a directory structure under /tftpboot

instserver# mkdir /var/lib/tftpboot
instserver# mkdir /var/lib/tftpboot/slackware-13.1
instserver# mkdir /var/lib/tftpboot/slackware-13.1/pxelinux.cfg

Then we have to populate the directories with files from the Slackware CD. Assuming the Slackware CD is mounted under /media/cdrom we copy the following files to /var/lib/tftpboot:

instserver# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/slackware-13.1
instserver# cp /media/cdrom/isolinux/message.txt /var/lib/tftpboot/slackware-13.1
instserver# cp /media/cdrom/isolinux/f2.txt /var/lib/tftpboot/slackware-13.1
instserver# cp -a /media/cdrom/kernels /var/lib/tftpboot/slackware-13.1
instserver# cp /media/cdrom/usb-and-pxe-installers/pxelinux.cfg_default /var/lib/tftpboot/slackware-13.1/pxelinux.cfg/default
instserver# cp /media/cdrom/isolinux/initrd.img /var/lib/tftpboot/slackware-13.1 

Now that we have everything in place we can start the TFTP server. Since the TFTP server is started from the Internet Superdaemon, we create the a file tftp (or tftp-dgram) under /etc/xinetd:

instserver# vi /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

and start the service by restarting xinetd

instserver# /etc/init.d/xinetd restart

Please note: If you ever configured the hosts access files hosts.deny and hosts.allow the TFTP daemon might refuse any connection. You can see this when you watch the file /var/log/syslog. If you see lines like

Sep  3 18:43:01 instserver in.tftpd[4507]: connection refused from 0.0.0.0
Sep  3 18:43:03 instserver in.tftpd[4509]: connection refused from 192.168.1.43
Sep  3 18:43:07 instserver in.tftpd[4510]: connection refused from 192.168.1.43
Sep  3 18:43:13 instserver in.tftpd[4511]: connection refused from 192.168.1.43
Sep  3 18:43:21 instserver in.tftpd[4512]: connection refused from 192.168.1.43
Sep  3 18:43:31 instserver in.tftpd[4513]: connection refused from 192.168.1.43
Sep  3 18:44:07 instserver in.tftpd[4516]: connection refused from 192.168.1.43
Sep  3 18:45:19 instserver in.tftpd[4607]: connection refused from 192.168.1.43
Sep  3 18:47:07 instserver in.tftpd[4669]: connection refused from 192.168.1.43

then probably your access rules prevent your client from connecting. To solve this add a line

in.tftpd: ALL

to /etc/hosts.allow.

5. Setting up NFS

First we have to find a place where we want to put the Slackware installation files, e.g. /export/slackware.13.1. We copy the installation files there (still assuming that the Slackware CD is mounted under /media/cdrom):

instserver# mkdir /export/slackware.13.1
instserver# cd /media/cdrom
instserver# cp -a * /export/slackware.13.1

Then we have to export the installation files to our client(s). So we add a line

/export/slackware.13.1       *(ro,sync,no_root_squash,subtree_check,insecure)

to /etc/exports and run exportfs to actually export it ²

instserver# exportfs -a


² If you don't use nfs yet run /etc/init.d/nfs start instead -- and chkconfig nfs on if you want to enable nfs at boottime

6. Installing Linux on a Client from the Netinstall Server

In order to boot over network you have to make sure that your PXE boot capable network interface is the first boot device. Check the BIOS settings. Then just start your client computer. It should boot straight into the Slackware installer.

Login as root and start the Slackware installer as usual:

# setup

Map your keyboard, add your swap partition and set up your target partitions as if you would have booted from CD or DVD. When it comes to select your source media choose option

The installer tries to configure your network card via DHCP (what should succeed since we just configured the DHCP server). Then you have to answer some questions:

From now on there is no difference to a normal CD/DVD installation.