Skip to content

Instantly share code, notes, and snippets.

@Gateswong
Last active August 29, 2015 14:07
Show Gist options
  • Save Gateswong/7e9a7535473e650a0be8 to your computer and use it in GitHub Desktop.
Save Gateswong/7e9a7535473e650a0be8 to your computer and use it in GitHub Desktop.
CS553 Support Files
#!/bin/sh
# This script will init the swift on given machine.
# prepare directories we need
cd ~
mkdir -p ~/app
mkdir -p ~/build
mkdir -p ~/work
sudo mkdir /mnt/cs553-data
sudo chown ubuntu:ubuntu /mnt/cs553-data
ln -s /mnt/cs553-data data
# install softwares we need basically
cd ~/build
sudo apt-get update
sudo apt-get -y install default-jdk git libopenmpi-dev
wget "https://bootstrap.pypa.io/get-pip.py"
sudo python get-pip.py
rm get-pip.py
sudo pip install apache-libcloud
export JAVA_HOME=/usr/lib/jvm/default-java >> ~/.bashrc
echo export JAVA_HOME=/usr/lib/jvm/default-java >> ~/.bashrc
# download credentials
cd ~/work/
wget "http://apus.2syu.me/fs/cs553_hw2/aws.csv"
wget "http://apus.2syu.me/fs/cs553_hw2/cs553.pem"
chmod 400 cs553.pem
# Download Hadoop package
cd ~/build
wget "http://www.dsgnwrld.com/am/hadoop/common/hadoop-1.2.1/hadoop-1.2.1-bin.tar.gz"
# Extract packate
tar -zxf "hadoop-1.2.1-bin.tar.gz"
rm hadoop-1.2.1-bin.tar.gz
mv hadoop-1.2.1/ ~/app/
echo export JAVA_HOME=/usr/lib/jvm/default-java >> $HADOOP_HOME/conf/hadoop-env.sh
# Add Hadoop to the PATH environment variable
export HADOOP_HOME=~/app/hadoop-1.2.1
export PATH=$PATH:$HADOOP_HOME/bin
echo export HADOOP_HOME=~/app/hadoop-1.2.1 >> ~/.bashrc
echo export PATH=$PATH:$HADOOP_HOME/bin >> ~/.bashrc
# Download the swift-0.95 package
wget http://swiftlang.org/packages/swift-0.95-RC6.tar.gz
# Extract package
tar -zxf "swift-0.95-RC6.tar.gz"
rm swift-0.95-RC6.tar.gz
mv swift-0.95-RC6 ~/app/
# Add swift to the PATH environment variable
export SWIFT_HOME=~/app/swift-0.95-RC6
export PATH=$PATH:$SWIFT_HOME/bin
echo export SWIFT_HOME=~/app/swift-0.95-RC6 >> ~/.bashrc
echo export PATH=$PATH:$SWIFT_HOME/bin >> ~/.bashrc
# Configure Swift
# In this part you should have your instance creation limit increased.
cd ~/work
git clone https://github.com/yadudoc/cloud-tutorials.git
cd cloud-tutorials/ec2
mv configs configs.default
wget "http://apus.2syu.me/fs/cs553_hw2/configs"
cd ~/work/cloud-tutorials/ec2
echo ''
echo 'PLEASE login, and run the following command:'
echo ''
echo ' source setup.sh'
echo ''
echo 'Notice that setup.sh must be run with source command.'
# Set following config with an absolute path to the credentials file
AWS_CREDENTIALS_FILE=/home/ubuntu/work/aws.csv
# Set the number of worker nodes required (limited by your account quotas)
#AWS_WORKER_COUNT=16
# Set the name for the keypair used to ssh to instances
# A key will be generated in path if none are found
AWS_KEYPAIR_NAME=cs553
# Set following config with an absolute path to where you want the keypair file
AWS_KEYPAIR_FILE=/home/ubuntu/work/cs553.pem
#ubuntu is the default user on Ubuntu nodes
AWS_USERNAME=ubuntu
# Ubuntu Server 14.04 LTS (PV), SSD Volume Type - ami-c9d497f9 (64-bit)
HEADNODE_IMAGE=ami-c9d497f9
# Headnode instance type, refer to Amazon instance types page for reference
# Legal machine types : t1.micro | m1.small | m1.medium | m1.large
HEADNODE_MACHINE_TYPE=c3.large
# Ubuntu Server 14.04 LTS (PV), SSD Volume Type - ami-c9d497f9 (64-bit)
WORKER_IMAGE=ami-c9d497f9
# Headnode instance type, refer to Amazon instance types page for reference
# Legal machine types : t1.micro | m1.small | m1.medium | m1.large
WORKER_MACHINE_TYPE=c3.large
# The following allows a script to executed on the worker at boot time
#WORKER_INIT_SCRIPT=ec2_init.sh
# Do not change following parameters
AWS_REGION=us-west-2
SECURITY_GROUP=swift_security_group1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment