Last active
November 1, 2018 16:10
-
-
Save simbalinux/f3703dc900e33aca038fe9e3e5009c3e to your computer and use it in GitHub Desktop.
pcfdev setup
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
#!/usr/bin/env bash | |
set -e | |
source config | |
sleep 10 | |
export PIVNET_TOKEN="$token" | |
export LOCAL_FILE_NAME=pcfdev-v0.30.0+PCF1.11.0-linux.zip | |
export DOWNLOAD_URL=https://network.pivotal.io/api/v2/products/pcfdev/releases/88478/product_files/125612/download | |
#export OPSMGR_HOST=localhost | |
export OPSMGR_USER="$useraccount" | |
export OPSMGR_PASSWORD="$password" | |
echo "Attempting download of $LOCAL_FILE_NAME from $DOWNLOAD_URL" | |
wget -O "$LOCAL_FILE_NAME" --post-data="" --header="Authorization: Token $PIVNET_TOKEN" $DOWNLOAD_URL | |
# USE THIS FOR UPLOADING PURPOSES | |
#echo "Attempting to upload of $LOCAL_FILE_NAME to $OPSMGR_HOST" | |
#curl "https://${OPSMGR_HOST}/api/products" -F "product[file]=@${LOCAL_FILE_NAME}" -X POST -u ${OPSMGR_USER}:${OPSMGR_PASSWORD} -k | |
#echo "$LOCAL_FILE_NAME finished uploading to Ops Manager" | |
~ |
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
#!/usr/bin/env bash | |
token="pcftoken_here" | |
useraccount="[email protected]" | |
password="pcfpassword_here" |
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
#!/usr/bin/env bash | |
set -x | |
local_user="local_user" | |
local_dir="/home/local_user" | |
################################ | |
# ensure that "secure boot" is disabled in BIOS otherwise you get the following error: (see below) | |
# "vboxdrv.sh: failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why." | |
################################ | |
# Use to toggle status to install/remove packages w/ yum | |
state="install" | |
# update & upgrade system do on minimal install | |
yum -y update && yum -y upgrade | |
# install tools for sys admin | |
yum -y "$state" curl wget vim tree unzip git | |
# install repo for VirtualBox-* | |
wget -c https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -P /etc/yum.repos.d | |
# install vbox requirements | |
yum -y "$state" kernel-devel kernel-headers make patch gcc rsync | |
# install VirtualBox* package | |
yum -y "$state" VirtualBox-5.2 | |
# download vbox guest additions | |
wget -c https://download.virtualbox.org/virtualbox/5.2.20/Oracle_VM_VirtualBox_Extension_Pack-5.2.20.vbox-extpack | |
# check if guest additions returns 1 ( 1 means not installed) | |
guest_additions=$(vboxmanage list extpacks |wc -l) | |
# install guest additions if returns 1 else continue | |
if (( "$guest_additions" == 1 )); then | |
echo "y" | VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.20.vbox-extpack | |
fi | |
# download latest vagrant and "yum -y install vagrant*.rpm" | |
wget -c https://releases.hashicorp.com/vagrant/2.2.0/vagrant_2.2.0_x86_64.rpm | |
yum -y "$state" vagrant*.rpm | |
# repos for "cf cli" if ! exist | |
wget -c https://packages.cloudfoundry.org/fedora/cloudfoundry-cli.repo -P /etc/yum.repos.d | |
yum -y "$state" cf-cli | |
# download the pcfdev.zip file from pivotal via API include file "./api_download" | |
source api_download | |
unzip -n pcfdev-v0.30.0+PCF1.11.0-linux.zip | |
su -c "./pcfdev-v0.30.0+PCF1.11.0-linux" "$local_user" | |
# accept license && install jdk8 | |
wget -c --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.rpm" | |
if [ ! $(command -v java) ]; then | |
yum -y "$state" jdk-8u191-linux-x64.rpm | |
fi | |
# export JAVA_HOME from .bashrc as substitute user directory | |
grep -q -F 'export JAVA_HOME=/usr/java/jdk1.8.0_191-amd64' "$local_dir"/.bashrc || echo 'export JAVA_HOME=/usr/java/jdk1.8.0_191-amd64' >> "$local_dir"/.bashrc | |
grep -q -F 'export PATH=$PATH:$JAVA_HOME/bin' "$local_dir"/.bashrc || echo 'export PATH=$PATH:$JAVA_HOME/bin' >> "$local_dir"/.bashrc | |
# import web apps using subsititute user | |
su -c "git clone https://github.com/Pivotal-Field-Engineering/pcf-ers-demo" "$local_user" | |
su -c "git clone https://github.com/cloudfoundry-samples/spring-music" "$local_user" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment