Skip to content

Instantly share code, notes, and snippets.

@srs81
Forked from bbeck/setup.sh
Created July 24, 2012 17:39
Show Gist options
  • Save srs81/3171401 to your computer and use it in GitHub Desktop.
Save srs81/3171401 to your computer and use it in GitHub Desktop.
Setup Asgard on Ubuntu 12.04
#################
# Update packages
#################
sudo yum -y update
sudo yum -y upgrade
########################
# Install the Oracle JDK
########################
JDK_URL="http://download.oracle.com/otn-pub/java/jdk/6u32-b05/jdk-6u32-linux-x64.bin"
wget --quiet --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" "${JDK_URL}"
chmod +x "jdk-6u32-linux-x64.bin"
yes | ./jdk-6u32-linux-x64.bin
sudo mkdir -p /usr/lib/jvm/
sudo mv jdk1.6.0_32 /usr/lib/jvm/
for binary in $(ls /usr/lib/jvm/jdk1.6.0_32/bin/j*); do
name=$(basename $binary)
sudo update-alternatives --install /usr/bin/${name} ${name} ${binary} 1
sudo update-alternatives --set ${name} ${binary}
done
rm "jdk-6u32-linux-x64.bin"
################
# Install Tomcat
################
TOMCAT_URL="http://mirror.symnds.com/software/Apache/tomcat/tomcat-7/v7.0.28/bin/apache-tomcat-7.0.28.tar.gz"
wget --quiet --no-cookies "${TOMCAT_URL}"
tar xvfz "apache-tomcat-7.0.28.tar.gz"
mv "apache-tomcat-7.0.28" "tomcat"
rm "apache-tomcat-7.0.28.tar.gz"
# "undeploy" the ROOT war...
rm -rf tomcat/webapps/ROOT
################
# Install Asgard
################
ASGARD_URL="https://github.com/downloads/Netflix/asgard/asgard.war"
wget --quiet --no-cookies "${ASGARD_URL}"
mv "asgard.war" "tomcat/webapps/ROOT.war"
# Need to up the heap that tomcat uses
cat <<-EOF > "tomcat/bin/setenv.sh"
if [ "\$1" = "start" ]; then
export JAVA_OPTS=" \\
-verbose:sizes \\
-Xmx4g -Xms4g \\
-Xmn2g \\
-XX:MaxPermSize=128m \\
-XX:+HeapDumpOnOutOfMemoryError \\
-XX:-UseGCOverheadLimit \\
-XX:+ExplicitGCInvokesConcurrent \\
-XX:+PrintGCDateStamps -XX:+PrintGCDetails \\
-XX:+PrintTenuringDistribution \\
-XX:+CMSClassUnloadingEnabled \\
-XX:+UseConcMarkSweepGC \\
"
else
export JAVA_OPTS=""
fi
EOF
################
# Startup Tomcat
################
tomcat/bin/startup.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment