Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - General > Member Success Stories
User Name
Password Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.


  Search this Thread
Old 11-27-2004, 05:35 PM   #1
Registered: Nov 2002
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Talking General PXE install server


Below is a out line of what I did you get a PXE boot / install server up and running. With this server
you should be able to load any Linux distro that loads via a ramdisk or create your own. Plus you should be able to install almost any OS that can be installed via a image or install script.

Sources for information and software: - provides SYSLinux and PXELinux software puts lots of documentation. - provides lots of links and documentation.

Under Kernel source ../Documentation/initrd.txt
- Provides a GREAT deal of documentation with regards to the initrd.img process, ramdisk.

Steps ...

1. Install distro of choice on PC, with HDD space for images and serveral distro's install packages / sources.

Required packages:
DHCP Server - used to provide dynamic or static IP's to server along with PXE boot file location
SYSLinux (should contain PXELinux software as well) - provides pxelinux.0 (zero) file
NFS Server - used to provide access to images / sources (HTTP,FTP could be used instead)
TFTP Server - used to provide boot file for PXE booting
INET Server - used to start TFTP server, I didn't want a TFTP server running all the time.

FTP server (Not required)- I used this to upload new images and sources which could be copied over via NFS or download from the distro's site as well.

CVS server (Not required) - I want to be able to save a lot of config scripts and modifications in CVS, that's all.

2. Create a user to limit required root access

I created a group called cvspxe and then a used called slammer. Under slammers home directory I created the following directories:
~/tftpboot #Used to chroot tftp server to plus it holds any required boot up files
~/tftpboot/pxelinux.cfg #Used to hold the linux config file, not sure what you would called it. It is a copy of the isolinux.cfg file.
~/tftpboot/kernels #Used to hold kernels to load

~/sources/images #Where I store drive images (W2k images, compress slackware images)
~/sources/distro #Where I store all my Linux distro's plus there source for install. (Example slackware-10 directory)

~/configs #Where I store a global config file and a per server / server type config file. This would contain hostnames, IP's plus any other information. (Required packages ....)

~/scripts #Scripts need to perform installs or any other taks

~/ramdisk #Files and initrd.img files for my customer initrd ramdisk
~/ramdisk/initrd #Mount point for ramdisk so I can make changes.

The directory structure is flexible but you will see what I created it soon enough.

3. Setup a DHCP server ... this can be an easy and difficult task, for me this was the first time I setup a DHCP server so I found it a little tricky.

Here is a copy of my DHCP config file:
ddns-update-style interim;
ignore client-updates;

subnet netmask {

default-lease-time 86400;
max-lease-time 86400;

option routers;
option ip-forwarding off;
option broadcast-address;
option subnet-mask;
option domain-name-servers;

filename "/pxelinux.0"; ## Must provide full path relative to tftp server root if NOT Chrooting TFTP server


The above server will work ... except for one small issue ... every machine on the network that boots up via the PXE option will get a install image. This may not be what is desired, you can move the next-server and filename option under it's own group if you like and add PC's to the group by their MAC address.

4. Once you have install the SYSLinux package there should be a file called pxelinux.0 on your system. Mine was in /usr/share/syslinux/pxelinux.0. Copy this file the tftpboot directory (mine is /home/slammer/tftpboot/). This is the file that the PXE client will download and run.

5. INET Server ... install and configure a INET to run the tftp server - consult your distro's documentation on how to do this.

6. Uncomment the tftp config line in your inetd.conf and add in the following:
tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s /home/slammer/tftpboot -r blksize

The -s path is used to set a chroot directory.

7. NFS server - I am using a NFS share to export the images,sources,configs and scripts directorys to all the clients. File system privileges set to read-only and export privileges set to read-only, you could use a http or ftp server but NFS is the easest.

At his point we are almost done now we need to populate the tftpboot directory with the required files.

#Output from cd /home/slammer/tftpboot ; find .

./kernels/bare.i/bzImage #Standard slackware bare.i bzImage kernel image
./kernels/bare.i/config #Bare.i kernel config file
./message.txt # Message to display at startup
./initrd.img #Ramdisk image (tested using slackware's standard initrd.img file from CD)
./pxelinux.cfg/default #config file used to load / pick kernel

Example of default
default linux
prompt 1
timeout 1200
display message.txt
label linux
kernel kernels/bare.i/bzImage
append initrd=initrd.img load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=102400 rw root=/dev/ram

That is about it ... now once you have got to this point you can start customizing things.


1. RAMDISK .. you will notice that in my default file I specify a ramdisk size of 102400, this is 100MB. This is because I created a custom initrd.img file to run a full file system.

To create one simple:
dd if=/dev/zero of=initrdfile bs=1024 count=100 # This should create 100MB file
losetup /dev/loop0 initrdfile #Sets up / attaches initrdfile to loop back device
mkfs.ext2 /dev/loop0 # Creates file system on /dev/loop0 (initrdfile). Use EXT2 -- This is only a ramdisk so journaling is not needed.

mount -t ext2 -o loop /dev/loop0 initrd

Now simple install any Linux distro onto this initrd directory. I choose to install a fully functional slackware file system. Using installpkg -root /home/slammer/ramdisk/initrd /path/to/packages/packname.tgz I installed all the required packages to have a fully bootable and workable system plus some extra's.

I used about 79 MB's.

umount initrd.
gzip -c -9 initrd > initrd.img #This compresses the 100BM file system image to about a 25-30MB file. Do a `man gzip` to find out what -c and -9 do.

On the file system you create ... you NEED TO HAVE A linuxrc file. This is explained in the kernelsource/Documentation/initrd.txt file. In sort .. the kernel loads using the initrd.img file ... then takes the initrd.img file and mounts it as the file system. But it needs to use the commands and devices from the initrd.img file before hand ... it is tricky ... read the initrd.txt file.

Mine looks like this:

mkdir /newroot ## Create new root mount point
mount /dev/ram /newroot #mount the initrd image file system

cd /newroot
mkdir initrd #Make directory for initrd file system to go to
pivot_root . initrd ## I believe this moves the current root file system to the local directory and puts the old one under the newly created initrd directory.

exec chroot . /sbin/init <dev/console >dev/console 2>&1
# Start init (process 1) under the new root mount point

umount initrd
blockdev --flushbufs /dev/ram
# Umount of the old root, since it is no longer needed and free of the memory

Now you see you can create any kind of initrd image you want and load it or any one by simple adding enteries to the default file. You could have a debian option, a slackware option .. even redhat.

2. PXE customization ... you can also pick which file each machine loads ... under the tftpboot/pxelinux.cfg directory is a file called default. But if you place other files, with the names of the MAC addresses of system then that file would be used. More information is available at (

As you can see from above ... once the initrd.img (ramdisk file system) of choice is loaded you can install any distro you want. For example you could install slackware packages onto the mount hard drive, or redhat rpms and you can ever create window 2000 boxes by using dd commands.

Old 10-12-2005, 09:53 PM   #2
LQ Newbie
Registered: Oct 2005
Location: Seattle, WA
Distribution: Slackware
Posts: 2

Rep: Reputation: 0
Re: General PXE install server

Originally posted by Bluesuperman
dd if=/dev/zero of=initrdfile bs=1024 count=100 # This should create 100MB file
There is actually an error there, you must append K to the end of bs=1024, otherwise it just makes a 100K file since it defaults to bytes.

Should look like this:
dd if=/dev/zero of=initrdfile bs=1024K count=100

This was a great post and it is lots of help, just wanted to point that out. =)
Old 10-13-2005, 02:58 PM   #3
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 471Reputation: 471Reputation: 471Reputation: 471Reputation: 471
This may well fit better in our Tutorial section. Would you consider posting it there?
Old 11-08-2005, 01:00 PM   #4
LQ Newbie
Registered: Nov 2005
Posts: 1

Rep: Reputation: 0
So I'm currently trying to setup a PXE server at work and am having nothing but problems. I've set up the tftp server correctly and placed the pxelinux.0 file in the root folder, and created the pxelinux.cfg with the default file inside. I've setup my DHCP server with the following snippet:

group {
filename "/tftpboot/pxelinux.0";

host test {
hardware ethernet 00:11:85:80:A1:96;

When my client boots up, it gets the IP address that I've assigned it, but ALWAYS comes back with the error: ProxyDHCP service did not reply to request on port 4011. I'm confused because I thought that the pxe server listened on port 4011 and I thought that you didn't necessarily need a pxe server? You should really only need a dhcp and tftp server right? So why does my pxe client keep looking for info on 4011? What am I doing wrong? Thanks so much for your help!
Old 07-25-2007, 05:51 PM   #5
Registered: Aug 2005
Distribution: Debian
Posts: 355

Rep: Reputation: 30
any examples how i load a windowsxp image using dd?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pxe Server Stopped Working! cstovall Linux - Networking 1 10-13-2005 01:52 PM
arch linux install over pxe paha Arch 1 12-14-2004 11:23 AM
trying linux install over pxe paha Linux - General 0 12-14-2004 07:09 AM
PXE install a box w/ an unsupported HD Toshi3 Linux - Hardware 0 09-13-2004 11:33 PM
PXE Server t420 Linux - Software 0 03-19-2003 01:42 PM > Forums > Linux Forums > Linux - General > Member Success Stories

All times are GMT -5. The time now is 11:25 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration