Just yesterday, the habrayuser
Arceny told us about
installing a debian with USB-flash . In the article, he mentioned the possibility of installing "With the help of network boot (
PXE boot)", so I finally decided to write material on the creation of the pxe boot server.
The narration will be conducted on the example of the same OS - Debian (so your paths and commands may differ).
For a start, we will
install a tftp server. See available options (
apt-cache search tftp | fgrep server ):
- atftpd
- dnsmasq
- tftpd
- tftpd-hpa
At first I put tftpd-hpa, because I was told about it in the
manual with which I started creating the server. Then I switched to atftpd, because I needed logging. Consider both options:
- tftpd-hpa:
Install the package, edit the file / etc / default / tftpd-hpa , so that the demon knows that he should live:
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"
Create the necessary directory: mkdir / var / lib / tftpboot , and start the service invoke-rc.d tftpd-hpa start
- atftpd:
After installation we find out that by default this service works through inetd. For some reason, I am not a fan of this method, so first of all I commented out the corresponding line in /etc/inetd.conf . Then edit / etc / default / atftpd :
')
USE_INETD=false
OPTIONS="--daemon --tftpd-timeout 1500 --no-multicast --retry-timeout 20 --logfile /var/log/atftpd.log --maxthread 100 --verbose=5 /var/lib/tftpboot"
- tftpd-timeout - the lifetime of the stream, in the absence of requests
--retry-timeout - file upload timeout
I have big timeouts, because the service is broadcast to the city local network, which periodically bends from the abundance of subscribers, and does not cope with the flow of requests.
Well, as in the previous paragraph, we create the necessary directory: mkdir / var / lib / tftpboot , and start the service invoke-rc.d atftpd start
Now we have a tftp server. One step we did :)
Next - configure dhcp:
- dhcp3:
Add the boot information to the /etc/dhcp3/dhcpd.conf configuration file:
filename "pxelinux.0";
next-server <tftp-server-ip>;
If tftpd is installed on the same server as dhcpd, the next-server directive can be omitted. And restart dhcp3-server: invoke-rc.d dhcp3-server restart
- dnsmasq:
In the config /etc/dnsmasq.conf we add:
dhcp-boot=pxelinux.0,<tftp-server-hostname>,<tftp-server-ip>
Again, if the tftp and dhcp servers match, the last 2 attributes can be left blank. Restart: invoke-rc.d dnsmasq restart
Step two is completed. Further - directly setup pxe-boot.
Go to
ftp.debian.org , select the
installer- * directory corresponding to the required architecture. Then go to the directory
current / images / netboot inside we find the files
netboot.tar.gz and
gtk / netboot.tar.gz - these are text and graphic installation files, respectively. Choose the one you like, download it and unpack it in
/ var / lib / tftpboot .
It remains to make sure that access to the 69 UDP port is forbidden, and you can use the charms of a network installation.
As a bonus, I am attaching a menu that came out of me as a result of several days of bullying:
In the current configuration, it is possible to install multiple OSes (Debian installation is possible both in text and in graphical mode), boot xUbuntu (via nfs), SystemRescueCD (via http-boot), memtest86 (via tftp). Installation of all operating systems is possible for 2 architectures - x86 and x64. Because I have an intranet mirror of the repositories Ubuntu 8.10 and Debian 5.0, then the installers do not offer a choice of repository, but automatically merge everything from it.
Screenshots:
the start screen ,
after clicking the button , the
distribution selection menu , the
second part of the distribution selection menu ,
the installation of Ubuntu ,
Debian ,
Fedora ,
SuSE is selected .
The / var / lib / tftpboot archive (almost 200 MB), as well as the
configuration files for the Ubuntu and Debian installers: they contain repositories + Ubuntu is split into Ubuntu, kUbuntu, xUbuntu, edUbuntu.
In this configuration, there is one big drawback, which I am too lazy to fix: when you open the menu, about 70 files are loaded, most of which are not needed by the user. To get rid of this - the display of the submenu needs to be transferred from the connection of the menu by inclusions to their call through the kernel
vesamenu.c32 , which comes with pxeboot. Also, it doesn’t hurt to clear duplicates of menu directories - most configs for the x64 and x86 menus are the same.