Installing Fedora Linux via PXE
Niels Basjes, 11 December 2007
The overall final setup is a 100% network based install of Fedora by using PXE in combination with a HTTP installation.
I've been using this setup for a very long time (since Fedora Core 3) so I know it works .... for me. ;)
This howto was written during the installation of my brand new PC (based on a 64bit Intel Core 2 Quad Q6600 CPU) with Fedora 8. So you'll see x86_64 everywhere. I have done this before with my other computers and it works 99% the same for i686 computers (that 1% is that you must change the name of some of the paths).
Important remarks
The system I'm using as my central server at home is a Pentium II at 350Mhz which is happily running Fedora Core 3. Yes, I know this is an ancient version but for my purposes this is good enough. I assume you have a different version so your mileage may vary. One effect of using this old version is that some of the config files I describe will most likely have changed name, place, format over time. Be prepared to adapt to these differences.
Overview
Let's start by giving an overview on what the final installation procedure will look like (this is what we're going to build here).
- The client boots from the NIC which supports PXE.
- The NIC sends out a DHCP request with a special 'PXE' flag.
- The DHCP server responds with IP information AND information which image this client must load via TFTP. The image that is specified is pxelinux on our TFTP server.
- The client configures the specified IP address.
- The client retrieves the specified image (pxelinux.0) from the TFTP server and starts it.
- The pxelinux software automatically retrieves the configuration with the available list of kernels, images and command line parameters from the TFTP server specific for this system.
- Either automatically or manually a selection is made which image to boot (I have a long list of options here with various Linux distributions and even memtest86).
- The specified Linux kernel (vmlinuz) and initial file system (initrd.img) are downloaded and booted with the specified command line parameters (which ks.cfg must be used !!).
- This base Linux system automatically starts Anaconda which is the Fedora installer.
- One of the command line parameters given to the Linux kernel indicates the location of the ks.cfg configuration file which is used by Anaconda as a configuration what it must do (i.e. what to install from where).
- Anaconda retrieves the next stages of the installation from the specified location (this will be our http server) and starts this software.
- Fedora 8 is now installed either manually or if you wish automatically (as specified in the ks.cfg).
TIPS
- My most important tip is to try, test and install this by using VMware Server as the carrier for your test client. It's free, works on both Linux and Windows, and most importantly it supports PXE to boot the system from the network.
- Under the assumption that most networks already have a production DHCP server that your not allowed to change during development you can create two virtual machines within your PC and create a completely isolated host only network with only those two Virtual Machines. In such a way you can have a fully isolated test environment to try this out befor you migrate it to a production situation.
- After you have completed the first system by manually selecting the packages you want; the installer writes a ks.cfg file in the home directory of the root user of that system. You can use this new file as the basis for installing multiple ' identical' systems by copying those settings to the ks.cfg used during installation.
One step at a time
We're building this setup one step at a time.
- Download Fedora 8.
- Setup HTTP for HTTP based installation.
- Test the HTTP based installation by booting from CDROM image.
- Setup PXE/TFTP to bootstrap the installation over the network.
- Test the PXE/HTTP based installation by booting from PXE.
- Install your systems.
Assumptions
I'm basing this on a few specific assumptions
Client
-
The client is an Intel/AMD kind of computer. I've been doing this on Pentium II/III/IV/D/Core 2 Quad computers and also in VMware "computers". It works on those systems.
- The network card of the client that is to be installed supports the Preboot eXecution Environment (PXE). PXE is simply support for booting a computer over the network where it receives the information on 'what to boot from where' from the DHCP server. If your NIC doesn't support that then remember that the RIS feature in Windows Server is also based on PXE .... and includes a bootdisk (which is essentially a software based PXE) that allows PXE on systems where the hardware does not support PXE .
Server
- You have the ISC DHCP server in your LAN to boot from. Any DHCP that allows special boot options should work.
- On the SAME SYSTEM as the DHCP server you have a TFTP server. This SAME system is because a lot of older PXE clients (including some of the versions of the mentioned RIS diskette) cannot handle having a different server for the DHCP part and the TFTP part.
- A system with an Apache HTTP server which has enough storage and capacity to serve the entire distribution.
Download Fedora 8
Which one ?
Now you can do one of two things:
- You download 'Everything' which contains ALL available RPMs for Fedora 8 entails about 12GB of data.
- You download 'Fedora' which is contains the normal set of RPMs for Fedora 8 entails about 4GB of data.
You choose, I always use 'the big one' because it makes live easier in the long run.
The first this you need to do is mirror the right part of the Fedora 8 distribution.
First of all you go to https://mirrors.fedoraproject.org/ and select the mirror site that is best for your situation.
Now the right part is the directory which is under releases/8/Everything/x86_64/os/
I rsync it all to:
/opt/deploy/install/fedora/releases/8/Everything/x86_64/os
The strange thing is that 'Everything' does not have the PXE images .... So I also rsync releases/8/Fedora/x86_64/os/images
/opt/deploy/install/fedora/releases/8/Fedora/x86_64/os/images
Now before we continue we must copy the entire images directory from 'Fedora' to 'Everything' ( I've reported this issue in the Fedora Bugzilla as issue 419351 )
So I copy the
/opt/deploy/install/fedora/releases/8/Fedora/x86_64/os/images
to the new place
/opt/deploy/install/fedora/releases/8/Everything/x86_64/os/images
HTTP installation
DNS
I chose to create an additional hostname in my DNS with the name
'install'. So I can simply specify http://install/.... as the download
path in the Fedora installer anaconda.
It depends on your DNS server how you configure this.
Setup HTTP server for HTTP based installation
The first thing we need to do is make the stuff we just downloaded available via HTTP.
This is simply done by configuring the webserver in such a way that these files have a URL under which they can be found.
My /etc/httpd/conf.d/install.conf looks like this:
<Directory /opt/deploy/install > AllowOverride All AcceptPathInfo On #Options Indexes FollowSymLinks Options Indexes SymLinksIfOwnerMatch FollowSymLinks </Directory> <VirtualHost *:80> DocumentRoot /opt/deploy/install/ ServerName install UseCanonicalName on </VirtualHost>
Testing the HTTP setup
First try to open this URL in your browser:
http://install/fedora/releases/8/Everything/x86_64/os/RELEASE-NOTES-en_US.html
This should provide you with the release notes on your screen.
Now startup a VMware with the boot.iso ( located in /opt/deploy/install/fedora/releases/8/Fedora/x86_64/os/images ) as the CDROM image.
Choose installation method HTTP
Website: install
Fedora directory: fedora/releases/8/Fedora/x86_64/os
Now when you continue the graphical installer should load.
If it does then this part works.
PXE installation bootstrap
Configure the TFTP server
I'm using tftp-server-0.39-1
My config file is called /etc/xinetd.d/tftp and contains this:
service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /opt/deploy/install -v -v disable = no per_source = 11 cps = 100 2 flags = IPv4 }
Setup PXELinux
I downloaded the latest version from http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.53.tar.gz and installed the pxelinux.0 in there under my Fedora tree.
cp pxelinux.0 /opt/deploy/install/fedora/releases/8/Everything/x86_64/
IMPORTANT
If traversing the path /opt/deploy/install/fedora/releases/8/Everything/x86_64/ to find pxelinux.0 contains a symbolic link then the TFTP server will simply not be able to send the provided file. This fact may be specific to the TFTP server version I'm using but then again , it may be the same in current versions.
Now my config file
/opt/deploy/install/fedora/releases/8/Everything/x86_64/pxelinux.cfg/default
looks like this:
DEFAULT fedora8 TIMEOUT 0 PROMPT 0 LABEL fedora8 KERNEL os/images/pxeboot/vmlinuz kssendmac APPEND initrd=os/images/pxeboot/initrd.img ks=http://install/fedora/releases/8/Everything/x86_64/ks.cf
As you can see we refer to the ks.cfg under the specified URL.
The paths to the kernel and images are relative to the directory where pxelinux.0 is located.
Create a ks.cfg to install from HTTP
The ks.cfg file is the config file that anaconda uses to automate specific selections in the install process. You can fully automate the installation using the ks.cfg
I prefer for my situation to simply let the system figure out where the installation files are located (on my http://install/ server).
So this file /opt/deploy/install/fedora/releases/8/Everything/x86_64/ks.cfg simply contains:
url --url http://install/fedora/releases/8/Everything/x86_64/os/
Check using your normal browser if you can download http://install/fedora/releases/8/Everything/x86_64/ks.cfg
Now my personal setup uses the DHCP LDAP configuration feature created by Brian Masney
This is much too much overkill for most situations so I'm describing the 'normal setup'.
Check the Official pxelinux page because they have a lot of examples on this topic.
The relevant bit is that you have the following parameters for the systems your going to install:
next-server "install" filename "/fedora/releases/8/Everything/x86_64/pxelinux.0"
Note that this path is relative to the root specified for the tftp server
Testing the PXE/HTTP setup
Now start your VMware machine again and press F12 during the BIOS phase.
The Virtual Machine will boot from the network and should load the information from the server.
And show stage 1 of the installation procedure.
After selecting language and keyboard it should load images/stage2.img
and show the graphical installer.