Skip to content

Instantly share code, notes, and snippets.

@dzlab
Last active June 8, 2018 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dzlab/986a2b79ecabe725d324 to your computer and use it in GitHub Desktop.
Save dzlab/986a2b79ecabe725d324 to your computer and use it in GitHub Desktop.
CloudFoundry Bosh Lite installer script
#!/usr/bin/env bash
##
## This script install prerequisites: git, virtualbox, vagrant, ruby/rubygems.
## Then, it boots up bosh-lite in a local Vagrant/Virtualbox VM,
## then uploads and deploys Cloud Foundry into it.
## Finally, it logs into Cloud Foundry as an admin user,
## creates an initial organization and space,
## then deploys an example application.
##
USERNAME=`whoami`
echo "Installing prerequisites ..."
## install git
sudo apt-get install -y git
## install go
wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.4.2.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile
## install virtual box
## sudo echo "deb http://download.virtualbox.org/virtualbox/debian precise contrib" >> /etc/apt/sources.list
## or
echo "deb http://download.virtualbox.org/virtualbox/debian precise contrib" >> virtualbox.list
sudo mv virtualbox.list /etc/apt/sources.list.d/
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y virtualbox-4.3
sudo apt-get install -y dkms
## install vagrant
wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.3_x86_64.deb
sudo dpkg -i vagrant_1.6.3_x86_64.deb
## install rvm
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable
source /home/$USERNAME/.rvm/scripts/rvm
## install ruby
rvm install 1.9.3-p551
## install bosh cli
sudo apt-get install -y build-essential libxml2-dev libsqlite3-dev libxslt1-dev libpq-dev libmysqlclient-dev
gem install bosh_cli
gem install bosh_cli
## boot Bosh Lite VM
git clone https://github.com/cloudfoundry/bosh-lite
cd bosh-lite
vagrant up --provider=virtualbox
## target Bosh Lite Director
cd ..
yes admin | bosh target 192.168.50.4 lite
cd bosh-lite
./bin/add-route
## install spiff
cd ..
sudo apt-get install -y unzip
wget https://github.com/cloudfoundry-incubator/spiff/releases/download/v1.0/spiff_linux_amd64.zip
unzip spiff_linux_amd64.zip
sudo mv spiff /usr/local/bin
## setup cloud foundry
# Upload latest stemcells
wget http://bosh-jenkins-artifacts.s3.amazonaws.com/bosh-stemcell/warden/latest-bosh-stemcell-warden.tgz
bosh upload stemcell latest-bosh-stemcell-warden.tgz
bosh stemcells
# upload release
echo "export CF_RELEASE_DIR=$PWD/cf-release" >> $HOME/.profile
git clone --recursive https://github.com/cloudfoundry/cf-release
bosh upload release $CF_RELEASE_DIR/releases/cf-200.yml
## generate manifest
cd bosh-lite
./bin/make_manifest_spiff
## deploy to CF
bosh deploy
## or ./bin/cf_provision
# install Cloud Foundry CLI
wget http://go-cli.s3-website-us-east-1.amazonaws.com/releases/v6.10.0/cf-linux-amd64.tgz
tar xvf cf-linux-amd64.tgz
sudo mv cf /usr/local/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment