-
-
Save gcgists/6693644 to your computer and use it in GitHub Desktop.
wget setup to the right file
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
# Put your download key here: | |
export GC_KEY=xxxxxxxxxxxxxxxxxxxxxx | |
wget -O setup.sh https://gist.github.com/gcgists/6693644/raw/setup.sh | |
chmod a+x setup.sh | |
sudo ./setup.sh $GC_KEY |
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
# Put your download key here: | |
export GC_KEY=xxxxxxxxxxxxxxxxxxxxxx | |
wget -O setup.sh https://gist.github.com/gcgists/6693644/raw/setup.sh | |
chmod a+x setup.sh | |
# (default) All-in-one installation (API, compute, Horizon, and client) | |
sudo ./setup.sh $GC_KEY full | |
# API and compute service | |
sudo ./setup.sh $GC_KEY no-horizon | |
# Only the compute service | |
sudo ./setup.sh $GC_KEY compute-only | |
# Only the API | |
sudo ./setup.sh $GC_KEY api-only | |
# API and dashboard service (API, Horizon, and client) | |
sudo ./setup.sh $GC_KEY api-horizon |
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
#!/bin/bash | |
function err { echo -e "error.\n$1" && exit 1; } | |
function usage { | |
echo "usage: sudo ./setup.sh <key> [full | no-horizon | compute-only]" | |
echo | |
echo "Required arguments:" | |
echo " <key> Gridcentric repository key" | |
echo | |
echo "Optional arguments:" | |
echo " full (Default) All in one installation" | |
echo " no-horizon Install all but the horizon dashboard extensions" | |
echo " compute-only Only install compute node services" | |
echo " api-only Only install API node services" | |
echo " api-horizon Only install API and Horizon services" | |
echo | |
[ "$1" ] && echo "Error: $1" && exit 1 || exit 0 | |
} | |
# Parse parameters | |
[ "$1" == "help" ] && usage | |
[ $# -gt 2 ] && usage "too many arguments" | |
[ -z "$1" ] && usage "please provide your vms download key" | |
[ $EUID != 0 ] && usage "script must be run as root" | |
case "$2" in | |
"" | "full" ) API=true; COMPUTE=true; HORIZON=true; CLIENT=true;; | |
"no-horizon" ) API=true; COMPUTE=true;; | |
"compute-only" ) COMPUTE=true;; | |
"api-only" ) API=true;; | |
"api-horizon" ) API=true; HORIZON=true; CLIENT=true;; | |
*) usage "invalid option: $2";; | |
esac | |
GC_KEY=$1 | |
# Validate key | |
echo -n "Validating key .. " | |
curl -s --head http://downloads.gridcentriclabs.com/packages/$GC_KEY/ | head -n 1 | grep "HTTP/1.[01] [23].." > /dev/null | |
if [ $? -ne 0 ]; then err "Invalid key"; fi; | |
echo "[OK]" | |
# Detect environment settings | |
echo -n "Auto-detecting settings .. " | |
# Determine apt or yum distro | |
PKG_MANAGER=$( command -v yum || command -v apt-get ) || err "Could not find package manager apt-get or yum." | |
PKG_MANAGER=`basename $PKG_MANAGER` | |
# Auto determine openstack version | |
VERSION=`nova-manage version` 2> /dev/null | |
if [[ "$VERSION" == 2012\.2* ]]; then | |
if [[ "$PKG_MANAGER" == "yum" ]]; then | |
err "Openstack folsom unsupported on yum-based systems"; | |
fi | |
REPO_TEXT="folsom" | |
[ $COMPUTE ] && PACKAGES="nova-compute-gridcentric" | |
[ $API ] && PACKAGES="$PACKAGES nova-api-gridcentric" | |
[ $HORIZON ] && PACKAGES="$PACKAGES horizon-gridcentric" | |
elif [[ "$VERSION" == 2013\.1* ]]; then | |
REPO_TEXT="grizzly" | |
[ $COMPUTE ] && PACKAGES="cobalt-compute" | |
[ $API ] && PACKAGES="$PACKAGES cobalt-api" | |
[ $HORIZON ] && PACKAGES="$PACKAGES cobalt-horizon" | |
elif [ -z "$VERSION" ]; then | |
err "Could not find openstack on machine" | |
else | |
err "Unsupported version of openstack: $VERSION"; | |
fi | |
[ $CLIENT ] && PACKAGES="$PACKAGES cobalt-novaclient" | |
[ $COMPUTE ] && PACKAGES="$PACKAGES vms vms-kvm vms-libvirt vms-mcdist vmsfs vms-rados" | |
echo "[OK]" | |
echo "Environment: `uname -s` `uname -r`, $PKG_MANAGER, openstack $REPO_TEXT" | |
[ $PKG_MANAGER == "yum" ] && echo "Ensure system has been rebooted after running packstack" | |
# Installation. Ask for confirm only if in interactive terminal | |
[ -t 0 ] && read -p "Press [Enter] to begin installation" | |
if [ $PKG_MANAGER == "apt-get" ]; then | |
wget -O - http://downloads.gridcentriclabs.com/packages/gridcentric.key | sudo apt-key add - | |
echo deb http://downloads.gridcentriclabs.com/packages/cobaltclient/$REPO_TEXT/ubuntu/ gridcentric multiverse >> /etc/apt/sources.list.d/gridcentric.list | |
echo deb http://downloads.gridcentriclabs.com/packages/cobalt/$REPO_TEXT/ubuntu/ gridcentric multiverse >> /etc/apt/sources.list.d/gridcentric.list | |
echo deb http://downloads.gridcentriclabs.com/packages/$GC_KEY/vms/ubuntu/ gridcentric multiverse >> /etc/apt/sources.list.d/gridcentric.list | |
apt-get update | |
[ $COMPUTE ] && apt-get install -y linux-headers-`uname -r` vms-apparmor | |
apt-get install -y $PACKAGES | |
elif [ $PKG_MANAGER == "yum" ]; then | |
if ! rpm -qa | grep -q epel-release; then | |
echo "Installing required EPEL repository..." | |
OS_VER=`cat /etc/redhat-release 2> /dev/null | awk '{print $3}'` | |
[ "$OS_VER" ] || OS_VER=`cat /etc/centos-release 2> /dev/null | awk '{print $3}'` | |
if [[ $OS_VER == 6* ]]; then | |
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/`uname -m`/epel-release-6-8.noarch.rpm | |
rpm --import https://fedoraproject.org/static/0608B895.txt | |
elif [[ $OS_VER == 5* ]]; then | |
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/`uname -m`/epel-release-5-4.noarch.rpm | |
rpm --import https://fedoraproject.org/static/217521F6.txt | |
fi | |
if ! rpm -qa | grep -q epel-release; then | |
err "Please manually enable the EPEL repository." | |
fi | |
echo "Continuing vms installation..." | |
fi | |
rpm --import http://downloads.gridcentriclabs.com/packages/gridcentric.key | |
echo "\ | |
[gridcentric-cobaltclient] | |
name=Cobalt Extension for novaclient | |
baseurl=http://downloads.gridcentriclabs.com/packages/cobaltclient/$REPO_TEXT/centos/ | |
gpgcheck=1 | |
enabled=1 | |
[gridcentric-cobalt] | |
name=Gridcentric Openstack Extensions | |
baseurl=http://downloads.gridcentriclabs.com/packages/cobalt/$REPO_TEXT/centos/ | |
gpgcheck=1 | |
enabled=1 | |
[gridcentric-vms] | |
name=Gridcentric Virtual Memory Streaming | |
baseurl=http://downloads.gridcentriclabs.com/packages/$GC_KEY/vms/centos/ | |
gpgcheck=1 | |
enabled=1 | |
" >> /etc/yum.repos.d/gridcentric.repo | |
[ $COMPUTE ] && yum install -y kernel-devel-`uname -r` | |
PACKAGES="$PACKAGES vms-selinux" | |
yum install -y $PACKAGES | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment