If you do not have a BOSH-Lite installed with bosh2 locally on your VirtualBox yet, you can follow Bootstrap BOSH on VirtualBox with BOSH 2.0 to do so. If you already have BOSH-Lite installed, make sure you are logged into your director as admin user. Also make sure your are using bosh cli v2. In this blog we are assuming that the BOSH-Lite is using IP 192.168.50.6 and the alias is vbox.

bosh2 CLI

If you've installed the bosh2 CLI, then for the sake of future proofing this article, we will alias it to bosh (which will be its future name):

alias bosh=bosh2  

Target BOSH2

If you followed one of our previous articles on Bootstrapping BOSH2, you can login to your BOSH2 director using environment variables:

cd path/to/bosh-deployment  
export BOSH_CLIENT=admin  
export BOSH_CLIENT_SECRET=`bosh int ./creds.yml --path /admin_password`  
cd -  

Deploy Cloud Foundry

First clone the cf-deployment repo and cd into the directory.

git clone https://github.com/cloudfoundry/cf-deployment  
cd cf-deployment  

Upload a base server image (called a "stemcell"):

bosh -e vbox upload-stemcell https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-trusty-go_agent  

Configure your VirtualBox BOSH with appropriate networking/vm type information (called "cloud-config"):

bosh -e vbox update-cloud-config bosh-lite/cloud-config.yml  

Deploy CF by running the follow command:

bosh -e vbox -d cf deploy cf-deployment.yml \  
  -o operations/bosh-lite.yml \
  --vars-store deployment-vars.yml \
  -v system_domain=bosh-lite.com

Run bosh -e vbox -d cf instances and you will see:

Deployment 'cf'

Instance                                            Process State  AZ  IPs  
api/20a3fa6f-9f5a-4de2-a8ca-768b2f4386ba            running        z1  10.244.0.134  
blobstore/c2758b58-dea0-45a3-911c-9701273b623b      running        z1  10.244.0.133  
cc-bridge/c4c1d381-6b62-49e7-ba2f-be7de97a039d      running        z1  10.244.0.140  
cc-clock/f300ac6d-a93c-418e-9f93-9b6e9845b191       running        z1  10.244.0.139  
consul/843f1048-2dfa-4767-8bc9-ed68d52e5103         running        z1  10.244.0.128  
diego-bbs/cc2c41df-ffa3-4081-9aee-d507dbff0b7f      running        z1  10.244.0.135  
diego-brain/bd5a5843-b7ea-4c15-aa10-0599bc4472e8    running        z1  10.244.0.136  
diego-cell/f1eb8bc4-a0f8-4430-9eef-21616b443f9d     running        z1  10.244.0.137  
doppler/8b6ccc50-fe95-449b-8e75-d28de9a4477b        running        z1  10.244.0.141  
etcd/0da55d0e-acb3-40f4-9800-c69e1dbb1932           running        z1  10.244.0.130  
log-api/b3d30ac5-822d-4b26-931e-055d8d64f04c        running        z1  10.244.0.142  
nats/1f680c67-51b0-41d8-9475-1fbfe0e5f5a0           running        z1  10.244.0.129  
postgres/f00865c7-1a1a-42eb-9b63-5c1559e8123e       running        z1  10.244.0.131  
route-emitter/76a97ceb-d930-4085-be8c-f050bd635843  running        z1  10.244.0.138  
router/e9fed71a-7f51-4a58-9151-790c98be1c11         running        z1  10.244.0.34  
smoke-tests/fb636f19-f2e3-4ab3-9795-5c495a8f3f9e    -              z1  -  
uaa/9d015e66-47d2-4c73-9d8e-742dfc9fa281            running        z1  10.244.0.132

17 instances  

Logging into the CF API

Add the following route so you will be able to reach the CF API and also bosh ssh to the instances you deployed.

Adding route:

sudo route add -net 10.244.0.0/16    192.168.50.6 # Mac OS X  
sudo route add -net 10.244.0.0/16 gw 192.168.50.6 # Linux  
route add           10.244.0.0/16    192.168.50.6 # Windows  

Set up CF api and login as admin. If you do not have cf cli installed yet, you can follow Install CF CLI.

cf api https://api.bosh-lite.com --skip-ssl-validation  
export CF_ADMIN_PASSWORD=$(bosh2 int ./deployment-vars.yml --path /cf_admin_password)  
cf auth admin $CF_ADMIN_PASSWORD  

bosh ssh to CF

When you run bosh ssh, there is no list of instances anymore, so you have to specify your specific instance otherwise it will complain Running SSH:Interactive SSH only works for a single host at a time.

For example, you can run bosh -e vbox -d cf ssh uaa/0 to access the container of uaa/0 in cf deployment on your BOSH-Lite Director.

Congratulations! Your CF is ready to go!