2014-01-13

Installing a PXE Server on unRAID



Examples of things you can do:

openELEC - You can network boot a machine into openELEC without a hard drive using your PXE Server. Each machine has it's own configuration that is also store / kept / maintained on the unRAID Server by default.

Linux Live CDs - You can network boot straight into Ubuntu, Linux Mint, Fedora, etc.

Clonezilla - You can network boot into Clonezilla and back up your PCs via NFS or Samba to your unRAID Server.





1. SSH into your unRAID Server.

2. Create the following directory if it doesn't exist already:
Code: [Select]
mkdir  /boot/config/custom
3. Change to that directory
Code: [Select]
cd /boot/config/custom
4. Download dnsmasq-2.57-i486-1.txz
Code: [Select]
wget http://ftp.slackware.com/pub/slackware/slackware-13.37/slackware/n/dnsmasq-2.57-i486-1.txz
5. Edit your go file
Code: [Select]
nano /boot/config/go
Add the following lines before it starts emhttp
Code: [Select]
installpkg /boot/config/custom/dnsmasq-2.57-i486-1.txz
cp /boot/config/custom/dnsmasq.conf /etc
chmod +x /etc/rc.d/rc.dnsmasq
/etc/rc.d/rc.dnsmasq start

6. Create the following file
Code: [Select]
nano /boot/config/custom/dnsmasq.conf
Add the following to it and customize it for your Network and where you want to put your tftp folder. I used my cache drive.
Code: [Select]
port=0
log-dhcp
enable-tftp
tftp-root=/mnt/cache/tftp # <--- Place where your menus, cfgs, etc. will go
dhcp-range=192.168.1.0,proxy # <--- Enter the correct IP for your network
pxe-service=X86PC,"Booting...",pxelinux

7. Using the unRAID webGUI create a share called tftp on your cache drive (I made mine cache only).

8. Download and copy the following file into the root of your cache drive (/mnt/cache)

Customizable PXE Server Menu <--- Download Link

9. untar tftp.tar
Code: [Select]
tar xvf tftp.tar
10. Start the PXE Server by rebooting your unRAID Server or cut and paste the commands in the go file from step 5 above. 

Important Notes...

You will need to use your brain and use the menu examples and learn the menu structure. I included this as a guide of how to PXE Boot into all kinds of things from openELEC, Linux Mint, Arch Linux, Clonezilla, etc.

I did not include the files and images. You will need to add those yourself. For example, go download Clonezilla and add the correct files to the images directory in a Clonezilla folder.

You can boot PXE Boot ISOs files. For an example of how to do this... Look at my Arch Linux Menu to see how. 

Again... YOU have to think for yourself and Use the menus I included as a guide so you can configure your PXE Server to work with you. Feel free to delete the menu options you do not want or need.

Things you need to know

The default Main Menu is located in /mnt/cache/tftp/pxelinux.cfg and it's called default.

You can create a default menu based on machines MAC Address. To learn more / how to do this... PXELINUX

The Main Menu takes you to various other menus. The other menus are located in /mnt/cache/tftp/menus.

If you want to change the name, background image, change the menu resolution, etc. edit /mnt/cache/tftp/pxe.conf

When you boot into the PXE Server... It's root is /mnt/cache/tftp/

If you are using ESXi, Xen, KVM, VMWare... Your VMs can boot into the PXE Server and you can install VMs this way instead of using ISOs.

pfSense or routers might need to be configured for tftp to work. Simply point tftp to your unRAID Server.

There are a ton of websites that have various menus, examples, etc. Also, most Linux Distros have guides on how to boot a Live CD or Netinstall and even Full Installs that working 100% over the network using NFS and PXE (no hard drive needed). 

Example of an openELEC menu by MAC Address so it directly boots into it (MAC Address in this example is: 00:26:2d:ab:9d:2e

1. Create the following file in /mnt/cache/tftpd/pxeconfig.cfg/

NOTE: You have to add 01 before using the rest of the MAC Address. <--- 01-xx-xx-xx-xx-xx-xx
Code: [Select]
nano /mnt/cache/tftpd/pxeconfig.cfg/01-00-26-2d-ab-9d-2e
Add the following...
Code: [Select]
DEFAULT openELEC Bedroom
PROMPT 0
LABEL openELEC Bedroom
KERNEL images/openelec/KERNEL
APPEND ip=dhcp boot=NFS=192.168.1.2:/mnt/user/tftp/images/openELEC disk=NFS=192.168.1.2:/mnt/user/tftp/images/openELEC/storage overlay quiet

NOTE: Set the IP Address and path according to your system. I also share my tftp via NFS which is why it shows /mnt/user/tftp.... instead of /mnt/cache/tftp in the example above. 

2. Set Permissions
Code: [Select]
chown nobody:users /mnt/cache/tftpd/pxeconfig.cfg/01-00-26-2d-ab-9d-2e && chmod 777 /mnt/cache/tftpd/pxeconfig.cfg/01-00-26-2d-ab-9d-2e
3. Start your openELEC PC and it should directly boot into openELEC
« Last Edit: Today at 03:10:29 PM by grumpybutfun »
Have got Clonezilla working.

That is great to hear.
but am stumped on CentOS. Could you possibly share a little more about how you had your server configured - in terms of share/file/folder structure? 

For example in the CentOS menu file you kindly provided I believe it references an NFS share - what is this share used for? As I'm able to get the installer to start but it says it's unable to find to installation files - finding it a little confusing since I thought the installer was already running! I'm guessing this NFS share plays a role that isn't required for Clonezilla, as I see no mention of it in the corresponding menu file.

Let's have a look below at /mnt/cache/tftp/menus/CentOS.menu... 
Code: [Select]
LABEL 2
        MENU LABEL CentOS 6.4(64-bit)
        KERNEL images/CentOS/x86_64/vmlinuz
        APPEND initrd=images/CentOS/x86_64/initrd.img ramdisk_size=100000 ip=dhcp METHOD=nfs:192.168.1.2:/mnt/user/tftp/images/CentOS/x86_65/install.img repo=http://mirror.centos.org/centos/6.4/os/x86_64/ lang=us keymap=us ip=dhcp ksdevice=eth0 noipv6
        TEXT HELP
        Install CentOS 6.4(64-bit)
        ENDTEXT

1. Copy initrd.img and install.img to the following folder: 
Code: [Select]
/mnt/user/tftp/images/CentOS/x86_64/
2. Correct the IP Address of your unRAID and fix the typo I made (I will fix later tonight). You will see I have x86_65 and not x86_64 for the install.img.

3. Again I created a share in unRAID and told it to use only the cache drive. I also have it shared using NFS. Because of this, you have a "share" which to unRAID is /mnt/user/tftp. That is why you will see a lot of menus using /mnt/user/tftp instead of /mnt/cache/tftp.



2 comments:

  1. Hi,

    The file in step 8 is no longer available, are you able to re-host it please?

    Cheers,

    ReplyDelete
  2. I'm not able to; unraid has changed a lot since those posts; you could just install a pxe os now very easily

    ReplyDelete