-
-
Save ap1kenobi/b77027c2043729f425c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is mostly based on jcpowermac's https://gist.github.com/e8e72c1b6a551f75c5cf.git | |
# | |
#!/usr/bin/env bash | |
set -e | |
sudo apt-get update | |
sudo apt-get install -y git | |
sudo apt-get install -y make | |
sudo apt-get install -y mongodb | |
sudo apt-get install -y openjdk-7-jre-headless | |
sudo apt-get install -y g++ | |
sudo apt-get install -y isc-dhcp-server | |
sudo apt-get install -y ipxe | |
sudo apt-get install -y tftp | |
sudo apt-get install -y tftpd | |
#Configure tftpd | |
sudo mkdir /tftpboot | |
sudo chmod -R 777 /tftpboot | |
sudo chown -R nobody /tftpboot | |
#Copy ipxe files to tftpboot | |
cp -r /usr/lib/ipxe/* /tftpboot | |
#Create TFTP server configuration | |
cat > /etc/xinetd.d/tftp <<EOF | |
service tftp | |
{ | |
protocol = udp | |
port = 69 | |
socket_type = dgram | |
wait = yes | |
user = nobody | |
server = /usr/sbin/in.tftpd | |
server_args = /tftpboot | |
disable = no | |
} | |
EOF | |
service xinetd reload | |
# Install pxelinux | |
wget https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.02.tar.gz | |
tar -zxvf syslinux-6.02.tar.gz --strip-components 3 -C /tftpboot syslinux-6.02/bios/core/pxelinux.0 | |
tar -zxvf syslinux-6.02.tar.gz --strip-components 4 -C /tftpboot syslinux-6.02/bios/com32/menu/menu.c32 | |
mkdir /tftpboot/pxelinux.cfg | |
cat > /tftpboot/pxelinux.cfg/default <<EOF | |
default menu.c32 | |
prompt 0 | |
menu title Hanlon Boot Menu | |
timeout 50 | |
f1 help.txt | |
f2 version.txt | |
label hanlon-boot | |
menu label Automatic hanlon Node Boot | |
kernel ipxe.lkrn | |
append initrd=hanlon.ipxe | |
label boot-else | |
menu label Bypass hanlon | |
localboot 1 | |
EOF | |
#Configure DHCPd, remember to change based on your specific network... | |
cat > /etc/dhcp/dhcpd.conf <<EOF | |
ddns-update-style none; | |
default-lease-time 600; | |
max-lease-time 7200; | |
log-facility local7; | |
authorative; | |
option space ipxe; | |
option ipxe-encap-opts code 175 = encapsulate ipxe; | |
option ipxe.priority code 1 = signed integer 8; | |
option ipxe.keep-san code 8 = unsigned integer 8; | |
option ipxe.skip-san-boot code 9 = unsigned integer 8; | |
option ipxe.syslogs code 85 = string; | |
option ipxe.cert code 91 = string; | |
option ipxe.privkey code 92 = string; | |
option ipxe.crosscert code 93 = string; | |
option ipxe.no-pxedhcp code 176 = unsigned integer 8; | |
option ipxe.bus-id code 177 = string; | |
option ipxe.bios-drive code 189 = unsigned integer 8; | |
option ipxe.username code 190 = string; | |
option ipxe.password code 191 = string; | |
option ipxe.reverse-username code 192 = string; | |
option ipxe.reverse-password code 193 = string; | |
option ipxe.version code 235 = string; | |
option iscsi-initiator-iqn code 203 = string; | |
option ipxe.pxeext code 16 = unsigned integer 8; | |
option ipxe.iscsi code 17 = unsigned integer 8; | |
option ipxe.aoe code 18 = unsigned integer 8; | |
option ipxe.http code 19 = unsigned integer 8; | |
option ipxe.https code 20 = unsigned integer 8; | |
option ipxe.tftp code 21 = unsigned integer 8; | |
option ipxe.ftp code 22 = unsigned integer 8; | |
option ipxe.dns code 23 = unsigned integer 8; | |
option ipxe.bzimage code 24 = unsigned integer 8; | |
option ipxe.multiboot code 25 = unsigned integer 8; | |
option ipxe.slam code 26 = unsigned integer 8; | |
option ipxe.srp code 27 = unsigned integer 8; | |
option ipxe.nbi code 32 = unsigned integer 8; | |
option ipxe.pxe code 33 = unsigned integer 8; | |
option ipxe.elf code 34 = unsigned integer 8; | |
option ipxe.comboot code 35 = unsigned integer 8; | |
option ipxe.efi code 36 = unsigned integer 8; | |
option ipxe.fcoe code 37 = unsigned integer 8; | |
option ipxe.vlan code 38 = unsigned integer 8; | |
option ipxe.menu code 39 = unsigned integer 8; | |
option ipxe.sdi code 40 = unsigned integer 8; | |
option ipxe.nfs code 41 = unsigned integer 8; | |
option ipxe.no-pxedhcp 1; | |
option hanlon_server code 224 = ip-address; | |
option hanlon_port code 225 = unsigned integer 16; | |
option hanlon_base_uri code 226 = text; | |
subnet 192.168.33.0 netmask 255.255.255.0 { | |
range 192.168.33.200 192.168.33.210; | |
option domain-name "virtomation.com"; | |
option routers 192.168.33.1; | |
next-server 192.168.33.254; | |
option tftp-server-name "192.168.33.254"; | |
option domain-name-servers 192.168.33.1; | |
default-lease-time 600; | |
max-lease-time 7200; | |
option hanlon_server 192.168.33.254; | |
option hanlon_port 8036; | |
option hanlon_base_uri "/hanlon/v1"; | |
if exists user-class and option user-class = "iPXE" { | |
filename "hanlon.ipxe"; | |
} else { | |
filename "undionly.kpxe"; | |
} | |
} | |
EOF | |
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile | |
source ~/.bash_profile | |
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
rbenv install 1.9.3-p547 | |
rbenv install jruby-1.7.12 | |
rbenv global 1.9.3-p547 | |
rbenv rehash | |
gem install bundler trinidad bson_ext | |
sudo mkdir /opt/hanlon/ | |
sudo chmod -R 777 /opt/hanlon/ | |
sudo chown -R nobody /opt/hanlon/ | |
cd /opt/hanlon/ | |
git clone https://github.com/csc/Hanlon.git . | |
bundle install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment