jueves, 5 de mayo de 2016

Ubuntu server 14.04.4 PXE Installation

Ubuntu server 14.04.4  PXE Installation or Ubuntu installation via Network


PXEInstallServer

 Introduction



This will guide you through running an Ubuntu server as PXE install server. You'll need to run a DHCP server on your network, not necessarily this server but you do need one.

Installing needed packages

You'll need to install the following packages inetutils-inetd  and tftpd-hpa.

If this is also going to be your DHCP server, install dhcp server contained in the follwing package:  isc-dhcp-server




Configure tftpd-hpa

You'll need to tell tftpd-hpa to start its daemon (which it doesn't by default). To do this, edit the /etc/default/tftpd-hpa file, and make sure that it looks something like this:

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"


Stop the service:

#service tftpd-hpa stop


tftpd-hpa is called from inetd. The options passed to tftpd-hpa when it starts are thus found in /etc/inetd.conf

The defaults are fine for us, your /etc/inetd.conf should have an entry like this


tftp    dgram   udp    wait    root    /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot


 Configure dhcpd


#vi /etc/dhcp/dhcpd.conf

And make sure that it looks something like this:

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.2  192.168.0.3;
option routers 192.168.0.1;
option broadcast-address 192.168.0.255;
default-lease-time 600;
max-lease-time 7200;
}

allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
next-server 192.168.0.1;
filename "pxelinux.0";



NOTE: This server is  192.168.0.1





Ubuntu download iso and needed files:


Download .iso from ubuntu, and mount the iso file:

#mount -o loop ubuntu.iso /mnt

Now we'll copy the needed files from the Ubuntu CD:

 #cp -r /mnt/install/netboot/* /var/lib/tftpboot/

 NOTE: If your dhcp server issues correct network info and your pxe clients will have network access, then at this point you will be able to do an Ubuntu install using internet repositories.






Install apache2 service: 

#apt-get install apache2


Copying Ubuntu files to apache2 DocumentRoot:

#mkdir /var/www/ubuntu
#cp -r /mnt/* /var/www/ubuntu/




Customising the install with kickstart files:


#vi /var/www/html/ubuntu/ks.cfg

and, And make sure that it looks something like this:

install
url --url http://192.168.0.1/ubuntu/




In order for your network Ubuntu install to use your kickstart file, you have to tell it where to find it.

 Edit /var/lib/tftpboot/pxelinux.cfg/default and make sure that it looks something like this:

include ubuntu-installer/amd64/boot-screens/menu.cfg
default ubuntu-installer/amd64/boot-screens/vesamenu.c32
prompt 0
timeout 0
label linux
        kernel ubuntu-installer/amd64/linux
        append ks=http://192.168.0.1/ubuntu/ks.cfg vga=normal initrd=ubuntu-installer/amd64/initrd.gz ramdisk_size=16432 root=/dev/rd/0 rw  --





then ... Boot and install ....