Skip to content

Instantly share code, notes, and snippets.

@jcpowermac
Created June 20, 2014 13:59
Show Gist options
  • Select an option

  • Save jcpowermac/a4da2a5b3df31c89964d to your computer and use it in GitHub Desktop.

Select an option

Save jcpowermac/a4da2a5b3df31c89964d to your computer and use it in GitHub Desktop.
cat > /etc/yum.repos.d/epel.repo << EOF
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
EOF
cat > /etc/yum.repos.d/mongodb.repo << EOF
> name=MongoDB Repository
> baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
> gpgcheck=0
> enabled=1
> EOF
yum makecache -q
yum update -y -q
yum install -y git java-1.7.0-openjdk patch mongodb-org make gcc-c++ gcc tftp-server tftp curl binutils perl syslinux genisoimage bison libffi-devel libtool readline-devel libyaml-devel openssl-devel krb5-devel keyutils-libs-devel libcom_err-devel zlib-devel libyaml ncurses-devel libselinux-devel libsepol-devel automake autoconf dhcp
sed -i 's/disable\t\t\t= yes/disable\t\t\t= no/g' /etc/xinetd.d/tftp
service xinetd restart
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.66.0 netmask 255.255.255.0 {
range 192.168.66.200 192.168.66.210;
option domain-name "virtomation.com";
option routers 192.168.66.1;
next-server 192.168.66.254;
option tftp-server-name "192.168.66.254";
option domain-name-servers 192.168.66.1;
default-lease-time 600;
max-lease-time 7200;
option hanlon_server 192.168.66.254;
option hanlon_port 8026;
option hanlon_base_uri "/hanlon/api/v1";
if exists user-class and option user-class = "iPXE" {
filename "hanlon.ipxe";
} else {
filename "undionly.kpxe";
}
}
EOF
git clone https://github.com/ipxe/ipxe.git
curl -O https://gist.githubusercontent.com/jcpowermac/7cc13ce51816ce5222f4/raw/4384911a921a732e0b85d28ff3485fe18c092ffd/image_comboot.patch
patch -p0 < image_comboot.patch
cd ipxe/src
make
cp ipxe/src/bin/undionly.kpxe /var/lib/tftpboot/undionly.kpxe
cp ipxe/src/bin/ipxe.pxe /var/lib/tftpboot/ipxe.kpxe
cp ipxe/src/bin/ipxe.iso /var/lib/tftpboot/ipxe.iso
curl -O 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 /var/lib/tftpboot syslinux-6.02/bios/core/pxelinux.0
tar -zxvf syslinux-6.02.tar.gz --strip-components 4 -C /var/lib/tftpboot syslinux-6.02/bios/com32/menu/menu.c32
mkdir /var/lib/tftpboot/pxelinux.cfg
cat > /var/lib/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
\curl -sSL https://get.rvm.io | bash -s stable --ruby=jruby
mkdir -p /opt/hanlon
cd /opt/hanlon
git clone https://github.com/csc/Hanlon.git .
rvm use jruby
bundle install
gem install trinidad
service mongod start
rvm use 1.9.3
bundle install
./cli/hanlon config ipxe > /var/lib/tftpboot/hanlon.ipxe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment