HOWTO: Boot Linux from network using PXE and DNSMASQ proxy (Ubuntu 14.04)

Posted on luglio 25, 2014

This an adaptation from this guide to fit to Ubuntu 14.04 LTS environment:
http://danielboca.blogspot.it/2012/02/boot-linux-from-network-using-pxe-and.html?m=1

The parts in italic are added or modified by me.

I will assume you have an Ubuntu running installation and you know its IP addess.
My IP address is 192.168.0.1: modify the menus to suit yours.
The ISO images I used are ubuntu-12.04.4-desktop-i386.iso for 12.04 and ubuntu-14.04-server-i386.iso for 14.04 (alternate DVD does not exist anymore).
Both are 32 bit, because my test box doesn’t allow 64 bit virtualization, but the process is identical: search and replace “i386” with “amd64”.

ATTENTION! With this article I could get a working PXE server and correctly install Ubuntu 12.04.
Ubuntu 14.04 installation boots kernel and initrd, but gets stuck after that!!! Any help will be greatly appreciated.

This tutorial allows to boot and install Linux from network using PXE and DNSMASQ.

DNSMASQ is a very light implementation of TFTPD,DHCPD and NAMED.

In most of the cases there is already a DHPCD server on the network and starting a new DHCPD server would not work.
Therefore we are going to configure DNSMASQ as a PROXY DHCPD for the existing server and specify what PXE service to use.

The example provides a menu that can install Ubuntu 12.04, Ubuntu 14.04 and also can start the Memtest utility from the network.

Configure SYSLINUX

Become superuser
sudo -i

Install syslinux
aptitude install syslinux

Create a folder for TFTP server with the following (similar) structure
mkdir -p /tftpboot/pxelinux.cfg
mkdir -p /tftpboot/images/ubuntu/12.04/i386
mkdir -p /tftpboot/images/ubuntu/14.04/i386

Copy the necessary files from syslinux
cp /usr/lib/syslinux/vesamenu.c32 /tftpboot
cp /usr/lib/syslinux/pxelinux.0 /tftpboot

Now, let’s assume that the original ISOs have been copied/mounted in /iso/ubuntu12.04 and /iso/ubuntu14.04.

Copy initrd and linux kernel from the original ISOs
cp /iso/ubuntu12.04/install/netboot/ubuntu-installer/i386/initrd.gz /tftpboot/images/ubuntu/12.04/i386
cp /iso/ubuntu12.04/install/netboot/ubuntu-installer/i386/linux /tftpboot/images/ubuntu/12.04/i386

cp /iso/ubuntu14.04/install/netboot/ubuntu-installer/i386/initrd.gz /tftpboot/images/ubuntu/14.04/i386
cp /iso/ubuntu14.04/install/netboot/ubuntu-installer/i386/linux /tftpboot/images/ubuntu/14.04/i386

Download and copy memtest from memtest.org
wget http://www.memtest.org/download/5.01/memtest86+-5.01.bin.gz
gzip -d ./memtest86+-5.01.bin.gz
cp ./memtest86+-5.01.bin /tftpboot/memtest

Create and edit /tftpboot/pxelinux.cfg/default file
The IP 192.168.0.1 can be changed to reflect the path to your installation files
default vesamenu.c32
prompt 0

menu title PXE Boot Menu

label ubuntu-12.04-i386
menu label ubuntu-12.04-i386
kernel images/ubuntu/12.04/i386/linux
append initrd=images/ubuntu/12.04/i386/initrd.gz method=nfs:192.168.0.1:/iso/ubuntu12.04 lang=us keymap=us ip=dhcp noipv6

label ubuntu-14.04-i386
menu label ubuntu-14.04-i386
kernel images/ubuntu/14.04/i386/linux
append initrd=images/ubuntu/14.04/i386/initrd.gz method=nfs:192.168.0.1:/iso/ubuntu14.04 lang=us keymap=us ip=dhcp noipv6

label memtest86
menul label memtest86
kernel memtest
append -

If you like a simpler text mode menu, change vesamenu.c32 with menu.c32 (after you have copied it from /usr/share/syslinux).

Configure DNSMASQ

Install dnsmasq
aptitude install dnsmasq

Create and edit /etc/dnsmasq.d/pxe.conf with the following content
The IP 192.168.0.1 should be the IP of the machine that runs DNSMASQ

tftp-root=/tftpboot
enable-tftp
dhcp-boot=pxelinux.0
dhcp-option=vendor:PXEClient,6,2b
dhcp-no-override
pxe-prompt="Press F8 for boot menu", 3
pxe-service=X86PC, "Boot from network", pxelinux
pxe-service=X86PC, "Boot from local hard disk", 0
dhcp-range=192.168.0.1,proxy

Edit /etc/dnsmasq.conf and check you have a line at the of the file similar to this:
conf-dir=/etc/dnsmasq.d

(Re)start dnsmask
sudo service dnsmasq restart

Boot a machine using the network option from BIOS and install your system or run memtest!

Relax-and-Recover – Linux Disaster Recovery

Posted on luglio 10, 2014

http://relax-and-recover.org/

SARDU – Multi Boot USB pendrive e CD o DVD Builder

Posted on luglio 01, 2014

http://www.sarducd.it/it/index.html

XBOOT

Posted on luglio 01, 2014

https://sites.google.com/site/shamurxboot/

Tastiera italiana in appliance Turnkey

Posted on giugno 05, 2014

Thanks avallac_h for the script: I just adapted it to italian (original script was for russian layout).

# Disable purging italian locales
cat >> /etc/locale.nopurge < it
it_IT
it_IT.UTF-8
END

# Reinstall coreutils (separately, to avoid cyclic dependencies)
apt-get --reinstall install coreutils

# Get a list of packages that lack locale files
# I use `sed` to do the following things:
# 1) remove arch substring: "somepkg:i386" "somepkg:amd64" -> "smth"
# 2) remove commas: "somepkg1, somepkg2" -> "somepkg1 somepkg2"
# 3) remove coreutils from list (cyclic dependencies)
LOCALES=$(dpkg -S /usr/share/locale/ | sed -e 's/:.*$//;s/,//g;s/coreutils//')
I18N=$(dpkg -S /usr/share/i18n/ | sed -e 's/:.*$//;s/,//g;s/coreutils//')

apt-get --reinstall install $LOCALES
apt-get --reinstall install $I18N

# (Re-)Install some packages
apt-get --reinstall install \
console-setup kbd keyboard-configuration \
locales xkb-data

# Correcting "/etc/default/locale" file
echo '# File generated by update-locale' > /etc/default/locale
echo >> /etc/default/locale <

# Reconfigure all that stuff
dpkg-reconfigure locales
dpkg-reconfigure console-setup
dpkg-reconfigure keyboard-configuration

Source:
http://www.turnkeylinux.org/forum/support/20130222/adding-locales-and-language-support-turnkey-lamp-stack