Bebop: Difference between revisions

From Wiki-Fou
 
(14 intermediate revisions by the same user not shown)
Line 4: Line 4:


== What is? ==
== What is? ==
'''Bebop''' is our [//en.wikipedia.org/wiki/Preboot_Execution_Environment PXE] (read as in "pixie") system. We use it for install new machines over the network. If you want to install [//en.wikipedia.org/wiki/Linux Linux] on your box, you're welcome anytime to come, visit us and, of course, install [//en.wikipedia.org/wiki/Linux Linux].
'''Bebop''' is our [//en.wikipedia.org/wiki/Preboot_Execution_Environment PXE] (read as in "pixie") system. We use it to install new machines over the network. If you want to install [//en.wikipedia.org/wiki/Linux Linux] on your box, you're welcome anytime to come, visit us and, of course, install [//en.wikipedia.org/wiki/Linux Linux].


== How does it work? ==
== How does it work? ==
We have an [//en.wikipedia.org/wiki/OpenWrt OpenWRT]<ref> [https://openwrt.org OpenWRT Home Page] </ref> router offering [//en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol DHCP] 'round the network and a local server where the boot images are hosted. The images are mounted on the router via [//en.wikipedia.org/wiki/Network_File_System NFS] and voilà. That's all!
We have an [//en.wikipedia.org/wiki/OpenWrt OpenWRT]<ref> [https://openwrt.org OpenWRT Home Page] </ref> router offering [//en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol DHCP] 'round the network and a local server where the boot images are hosted. The images are mounted on the router via [//en.wikipedia.org/wiki/Network_File_System NFS] and served through [//en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol TFTP]. That's all!


== How can i reproduce Bebop in my local network? ==
== How can i reproduce Bebop in my local network? ==
Line 13: Line 13:
=== Prepare a folder on your local server ===
=== Prepare a folder on your local server ===


==== Assumptions: ====
==== Assumptions ====
* You're running Debian on your local server. If not, please refer to the documentation of your distro.
* You're running [//en.wikipedia.org/wiki/Debian Debian]<ref> [https://www.debian.org Debian Home Page] </ref> on your local server. If not, please refer to the documentation of your distro.
==== Steps: ====
==== Steps ====
* SSH to your local server with proper credentials:
* SSH to your local server with proper credentials:
     $ ssh user@server
     $ ssh user@server
* Gain root privileges:
* Gain root privileges:
     $ sudo -i
     $ sudo -i
* Install NFS, if not installed:
    $ apt-get install nfs-kernel-server nfs-common
* Create a directory wherever you want to store the boot images:
* Create a directory wherever you want to store the boot images:
     $ mkdir /path/to/optimal/place
     $ mkdir /path/to/optimal/place
* Make the directory accesible through NFS:
* Make the directory accesible through NFS:
     $ echo "/path/to/optimal/place"   *(ro,no_subtree_check)" >> /etc/exports
     $ echo "/path/to/optimal/place    *(ro,no_subtree_check)" >> /etc/exports
* Logout form the server:
* Logout form the server:
     Ctrl-D # exit from sudo
     Ctrl-D # exit from sudo
     Ctrl-D # exit from ssh login
     Ctrl-D # exit from ssh login


=== Prepare your router to serve the files through tftpboot ===
=== Prepare your router to serve the files through tftp ===
 
==== Assumptions ====
* You already have a configured router with OpenWRT
 
==== Steps ====
* SSH to your router with proper credentials:
* SSH to your router with proper credentials:
     $ ssh root@myrouter
     $ ssh root@myrouter
Line 35: Line 42:
* Install the folowing packages to enable nfs features:
* Install the folowing packages to enable nfs features:
     $ opkg install nfs-utils kmod-fs-nfs kmod-fs-nfs-common
     $ opkg install nfs-utils kmod-fs-nfs kmod-fs-nfs-common
* Edit /etc/config/dhcp. It should look like:
* Edit fstab to automatically mount the nfs directory at boot time:
    $ vi /etc/config/fstab
    # add the folowing entry
    config 'mount'
        option 'target' '/mnt/pxe'
        option 'device' 'YOUR.LOCAL.SERVER.IP:/path/to/optimal/place/'
        option 'fstype' 'nfs'
        option 'options' 'nolock'
        option 'enabled' 1
* If the automount does not work, you can manually boot with:
    $ mount -t nfs MY.LOCAL.SERVER.IP:/path/to/optimal/place /mnt/tftpboot -o nolock
* Edit /etc/config/dhcp to enable tftp. It should look like:
     $ vi /etc/config/dhcp
     $ vi /etc/config/dhcp
      
      
Line 45: Line 63:
      
      
     config boot 'linux'
     config boot 'linux'
option filename 'pxelinux.0'
        option filename 'pxelinux.0'
option serveraddress 'MY.ROUTER.IP.ADDRESS'
        option serveraddress 'YOUR.ROUTER.IP.ADDRESS'
option servername 'router'
        option servername 'router'
* Reboot your router
    $ reboot
 
=== Create a custom PXE menu ===
 
==== Preparation steps ====
* SSH into your local server:
    $ ssh user@localserver
* Acquire root privileges:
    $ sudo -i
* Go to the tftp directory:
    $ cd /path/to/optimal/place
* Create basic folder structure:
    $ mkdir pxelinux.cfg
* Download, untar and locate usefull syslinux files:
    $ mkdir syslinux
    $ cd syslinux
    $ wget --no-check-certificate https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.02.tar.gz
    $ tar -xvzf syslinux-6.02.tar.gz
    $ cd syslinux-6.02/bios
    # let's copy all that we need in one line:
    $ cp core/pxelinux.0 com32/elflink/ldlinux/ldlinux.c32 com32/menu/vesamenu.c32
      com32/lib/libcom32.c32 com32/libutil/libutil.c32 /path/to/optimal/place
    # let's remove innecesary files
    $ cd /path/to/optimal/place
    $ rm -r syslinux
 
==== Custom menu ====
* Try to write your own menu based on whatever netboot image of debian! :D


== Notes ==
== Notes ==
<references />
<references />

Latest revision as of 13:42, 26 August 2015


What is?

Bebop is our PXE (read as in "pixie") system. We use it to install new machines over the network. If you want to install Linux on your box, you're welcome anytime to come, visit us and, of course, install Linux.

How does it work?

We have an OpenWRT[1] router offering DHCP 'round the network and a local server where the boot images are hosted. The images are mounted on the router via NFS and served through TFTP. That's all!

How can i reproduce Bebop in my local network?

Prepare a folder on your local server

Assumptions

  • You're running Debian[2] on your local server. If not, please refer to the documentation of your distro.

Steps

  • SSH to your local server with proper credentials:
   $ ssh user@server
  • Gain root privileges:
   $ sudo -i
  • Install NFS, if not installed:
   $ apt-get install nfs-kernel-server nfs-common
  • Create a directory wherever you want to store the boot images:
   $ mkdir /path/to/optimal/place
  • Make the directory accesible through NFS:
   $ echo "/path/to/optimal/place    *(ro,no_subtree_check)" >> /etc/exports
  • Logout form the server:
   Ctrl-D # exit from sudo
   Ctrl-D # exit from ssh login

Prepare your router to serve the files through tftp

Assumptions

  • You already have a configured router with OpenWRT

Steps

  • SSH to your router with proper credentials:
   $ ssh root@myrouter
  • Create a directory for mounting the files over the network:
   $ mkdir /mnt/tftpboot
  • Install the folowing packages to enable nfs features:
   $ opkg install nfs-utils kmod-fs-nfs kmod-fs-nfs-common
  • Edit fstab to automatically mount the nfs directory at boot time:
   $ vi /etc/config/fstab
   # add the folowing entry
   config 'mount'
       option 'target' '/mnt/pxe'
       option 'device' 'YOUR.LOCAL.SERVER.IP:/path/to/optimal/place/'
       option 'fstype' 'nfs'
       option 'options' 'nolock'
       option 'enabled' 1
  • If the automount does not work, you can manually boot with:
   $ mount -t nfs MY.LOCAL.SERVER.IP:/path/to/optimal/place /mnt/tftpboot -o nolock
  • Edit /etc/config/dhcp to enable tftp. It should look like:
   $ vi /etc/config/dhcp
   
   config dnsmasq
       ... a lot of config done before...
       option enable_tftp '1'
       option tftp_root '/mnt/tftpboot'
       ... a lot more config
   
   config boot 'linux'
       option filename 'pxelinux.0'
       option serveraddress 'YOUR.ROUTER.IP.ADDRESS'
       option servername 'router'
  • Reboot your router
   $ reboot

Create a custom PXE menu

Preparation steps

  • SSH into your local server:
   $ ssh user@localserver
  • Acquire root privileges:
   $ sudo -i
  • Go to the tftp directory:
   $ cd /path/to/optimal/place
  • Create basic folder structure:
   $ mkdir pxelinux.cfg
  • Download, untar and locate usefull syslinux files:
   $ mkdir syslinux
   $ cd syslinux
   $ wget --no-check-certificate https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.02.tar.gz
   $ tar -xvzf syslinux-6.02.tar.gz
   $ cd syslinux-6.02/bios
   # let's copy all that we need in one line:
   $ cp core/pxelinux.0 com32/elflink/ldlinux/ldlinux.c32 com32/menu/vesamenu.c32 
     com32/lib/libcom32.c32 com32/libutil/libutil.c32 /path/to/optimal/place
   # let's remove innecesary files
   $ cd /path/to/optimal/place
   $ rm -r syslinux

Custom menu

  • Try to write your own menu based on whatever netboot image of debian! :D

Notes