Here’s Part 1 of the Ubuntu PXE Server series of tutorial. Look for links at the bottom of this post as future parts come up.
Before we can boot systems over PXE ( pixie ), we need to have a tftp server to serve as a host for the boot files. In this part, we’re going to focus on the initial setup. The next part we will talk about setting up the ftp/http server for the installation files, and in part 3 we’ll come back to the tftp server to set up the menus and boot files. Why am I doing it in that order, and not doing the mirror ( install files ) first? Because that’s how I did it. Don’t worry about that right now, it’s not super important. What is important is that we’ll be using Ubuntu as our platform because it has loads of documentation, and it’s easy to start from. The good news is that these instructions also work for Debian if you prefer. Besides, we’re not going to be done with setting up tftp and ftp mirrors of all the files, we need to set up a DHCP server as well to tell your network where your tftp server is. Most home routers don’t do that. If you got a router that does support that, good for you, but this series is going to assume that you don’t.
For those of you who prefer Fedora, Slackware, RedHat/CentOS, don’t worry, I’ll be doing those up later. On with the show!
First install Ubuntu:
- Set a static IPv4 address. The installer defaults to DHCP.
- If you’re doing the Linux AD Server project later, use the username ladmin for your first user. If you’re not going to setup ActiveDirectory or LDAP, it doesn’t matter.
- Leave all other install options default
Next install tftp-hpa:
Run the following commands to update your server and install tftp-hpa
sudo apt update sudo apt full-upgrade sudo apt install tftp-hpa
If you’re running your server as a VM, now is a good time to install any VM guest programs your server requires.
Reboot the server, because you almost certainly got some kernel updates during that process and we want to make sure everything still boots okay. We chose LTS because it’s rock stable, so you shouldn’t have any issues, but it’s just a good idea to reboot after any kernel updates anyway.
Configure the server:
First, let’s create our tftp path, where all our PXE files will go when we get to that part of the tutorial:
sudo mkdir /tftp sudo chown tftpd:tftpd /tftp
Next, open our config file:
sudo nano /etc/default/tftpd-hpa
Edit it to look as such:
# /etc/default/tftpd-hpa TFTP_USERNAME="tftp" TFTP_DIRECTORY="/tftp" TFTP_ADDRESS=":69" TFTP_OPTIONS="--secure"
- TFTP_USERNAME=”tftp” – tftp is the username of our process
- TFTP_DIRECTORY=”/tftp” – The directory for the files we’re hosting
- TFTP_ADDRESS=”:69″ – Listen on port 69 ( get your mind out of the gutter, pervert )
- TFTP_OPTIONS=”–secure” – This makes all paths relative to /tftp and makes it so the user can’t request files from other parts of the system. Given that tftp is anonymous, this is probably a good thing. Do not put –create, otherwise people will be able to add files to your tftp server. Those should be added using a secure connection like scp.
Restart the tftp server:
sudo systemctl restart tftpd-hpa
That’s it, you’ve set up a tftp server! Stay tuned for the next installment. I promise to come back to the TFTP server later to set up a boot menu and all the files to get your systems booting over the network!