Cyclone Server Configuration
- 1 Configuring the server
- 1.1 Server Specs
- 1.2 Applications needed
- 1.3 Server structure
- 1.4 PHP5
- 1.5 Lighttpd (any webserver)
- 1.6 DNSmasq
- 1.7 SQLite3
- 1.8 Syslinux/PXElinux
- 1.9 iPXE (gPXE)
- 1.10 Server backup
Configuring the server
Anything will do! This system is designed to be as device agnostic as possible with the most minimal specifications of hardware needed.
I am currently using a simple 32 bit desktop Ubuntu install, with PAE enabled. I would suggest using a 64bit OS though as the more memory present the more images can be cached.
Anything is suitable, the only thing that really matters is the net card (gigabit ideally) and the memory (=>8Gb), purely because the system can then cache images then rather than read them off hdd. There is no reason you couldn't run it from an old laptop if you wanted something portable.
- Web server (lightppd)
- Database (Sqlite3)
- DHCP (server/proxy)/PXE server (dnsmasq)
- Syslinux/Pxelinux (PXE booting)
These are all from the Ubuntu ppa's, no special config needed.
FIXME need to work out what needed from standard install
#basic build tools sudo apt-get install make gcc binutils git #programs sudo apt-get install lightppd php5 sqlite3 dnsmasq syslinux
This server is solely for Cyclone, security isn't a major concern so the structure is really for simplicity.
- Note web server paths are both links from the /www root
|/cyclone||<system>||Cyclone system contained here|
|/pxe||<system>||PXE boot files/system|
|/pxe||/pxelinux.cfg||/default||PXE boot config file|
|/www||pxe -> /pxe||soft link from www root to /pxe|
|/www||cyclone -> /cyclone||soft link from www root to /cyclone|
This structure lets you use the web server for other things if you wish without removing it from a default configuration. This also lets you extends the PXE boot system ('splashtop') for other useful things
Nothing needs changing from default
Lighttpd (any webserver)
Few mods to basic install from apt. Leave root as /www and then use soft links (ln -s) to get to correct place.
- Note wget doesnt cope with compressed files, even adding --header="Accept-Encoding: gzip" results in ending up with gzipped files saves locally. I have included the compress bits in case you would prefer to use cURL which can handle this.
- Note put the mimetype.assign after 'include_shell "/usr/share/lighttpd/create-mime.assign.pl"' and use '+=' not just '='
Ignore this if not PXE booting.
I am piggybacking DHCP off the main server running ISCBIND, hence the use of dnsmasq in proxy mode - DNSMasq isn't vital, any DNS/PXE server would do. Get this using apt for your distro. You only need a few config lines at the bottom of the /etc/dnsmasq.conf
#enable TFTP server enable-tftp #listen on a specific subnet, in proxy mode dhcp-range=xxx.xxx.xx.0,proxy #tftp root tftp-root=/pxe #set it to load ipxe.0 pxe-service=x86PC, "Splashtop by richud.com", ipxe
- Note dnsmasq only serves TFTP requests it knows about, i.e. it will only server ipxe.0/gpxelinux.0, and will not service general tftp requests.
- Note .0 is appended automatically
- Note If using proxy mode you cannot append DHCP options 209/210 for pxelinux, hence use script with gPXE/iPXE (below)
Use standard apt package, whole system uses one database, nominally
Suggest using 'SQLiteman' or 'SQLite database browser' to alter it (both available in Ubuntu software centre). The both have their own merits.
- Note If making lots of changes it is probably easier to export existing DB tables as CSV, edit in (Libre/Open)Office and then save out, and reimport.
- Note SQLite and SQLite3 are different, dont try and mix and match.
This drives the menu system on screen - the general configuration menus are hand made, the Cyclone sub menus are generated from the PHP (from the DB)
The default config file loaded resides in /pxe/pxelinux.cfg/default (confusingly and legacy to pxelinux, pxelinux.cfg is a directory, default is a file)
- Note pxelinux.cfg/ is relative to the root (so real path is /pxe/pxelinux.cfg/)
MENU TITLE Splashtop by richud.com MENU BACKGROUND pxelinux.cfg/splashtop.png DEFAULT pxelinux.cfg/vesamenu.c32 TIMEOUT 0 MENU COLOR border 30;44 #00000000 #00000000 none MENU WIDTH 80 MENU MARGIN 5 MENU ROWS 16 MENU TABMSGROW 21 MENU CMDLINEROW 17 MENU ENDROW 25 MENU SEPARATOR #Cyclone Label -> CYCLONE Win 7 - FAST Imaging KERNEL /rmdc/isolinux/vesamenu.c32 APPEND /cyclone/php/cyclone.php?cfg=1&menu=w7 TEXT HELP Win 7 - FAST Imaging ENDTEXT #Cyclone Label -> CYCLONE WinXP - FAST Imaging KERNEL /rmdc/isolinux/vesamenu.c32 APPEND /cyclone/php/cyclone.php?cfg=1&menu=xp TEXT HELP WinXP - FAST Imaging ENDTEXT #Cyclone Label -> CYCLONE - All Options KERNEL /rmdc/isolinux/vesamenu.c32 APPEND /cyclone/php/cyclone.php?cfgmenu=1 TEXT HELP CYCLONE - All Options ENDTEXT
- Note you could generate this menu from PHP too, but because (in my setup) it is doing other things as well as Cyclone, it makes it easier keeping it as text.
Ignore this if not PXE booting.
You will end up creating ipxe.0 which will reside in the pxe folder root, /pxe/ipxe.0
This awesome bit of program lets all but the first tiny data xfer of the initial ipxe.0 all run over HTTP instead of TFTP, at massive speed.
Download the git
iPXE has taken over from gPXE and has scripting abilities if you need them.
cd /tmp git clone git://git.ipxe.org/ipxe.git
(If you want to update, cd /tmp/ipxe && git pull)
Make the ipxe configuration script
Replace your servers IP/hostname, save it as anything, in this example /tmp/ipxe/src/script
Option 209 path needs to start at the end of option 210 , i.e. folders structure ....<webroot>/pxe/pxelinux.cfg/default, so test by doing a request to make sure you can get http://xxx.xxx.xx.xx/pxe/pxelinux.cfg/default - note this and everything after it is going via http not tftp!
- Note you can use soft links to get your path structure to match
#!ipxe set use-cached 1 dhcp set 209:string pxelinux.cfg/default set 210:string http://xxx.xxx.xx.xx/pxe/ boot pxelinux.0
This basically uses the cached DHCP response from PXE boot, and overrides DHCP option 209 and 210 (options specifically for pxe/syslinux) telling it where to go next (instead of using next-server, option 066). It then boots the embedded pxelinux.0 that takes over command, but now everything pxe/syslinux does goes via http and not slow tftp!
Now compile it, embedding the script you made and pxelinux.0 from syslinux. This can be the one from the latest Syslinux you downloaded (e.g. /home/xxxx/Downloads/syslinux-4.05/core/pxelinux.0) or from your systems distribution (in Ubuntu 11.10, /usr/lib/syslinux/pxelinux.0).
- Note You want to keep the rest of the syslinux files at the same version level otheriwse you can run into problems with them not working with each other! You dont have to compile pxelinux.0 in which can get around having to redo this when syslinux version changes, but it makes the booting alot quicker if it doesn't have to fetch it as an extra step.
This builds undionly.kkpxe (ipxe.0) (which your dhcp/tftp server serves up), embedding the script and pxelinux.0
cd /tmp/ipxe/src make ARCH=i386 CC="gcc -m32" CXX="g++ -m32" bin/undionly.kkpxe EMBED=script,/home/xxxx/Downloads/syslinux-4.05/core/pxelinux.0 cp bin/undionly.kkpxe /pxe/ipxe.0
- Note undionly means its not building any drivers in, its using the UNDI driver from the client pc PXE bios
- kkpxe means it keeps the UNDI and pxe stack after exiting.
I keep all the config files etc. cloud synced on Ubuntu One, which seems to be good for this purpose. I dont have a backup of the images <eep!> I have other servers backed up using fsarchiver which does hot backups (can backup entire filesystem while powered on) and not had any issues.