Skip to content

Instantly share code, notes, and snippets.

@azam
Last active September 5, 2015 00:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save azam/6a9ca8023d062a983c94 to your computer and use it in GitHub Desktop.
EC2 Jenkins preparation script
#!/bin/bash
# This script is intended to be run as preparation script
# during creation of ec2 instance, which is executed as root.
# So we don't need to run these commands with sudo over here.
wget https://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
# NOTE: execute this 4 commands if you change repo, ie redhat to redhat-stable
# rm -f /var/lib/rpm/__db*
# rpm --rebuilddb
# yum clean all
# yum update
# wget http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo -O /etc/yum.repos.d/jenkins.repo
wget http://pkg.jenkins-ci.org/redhat/jenkins.repo -O /etc/yum.repos.d/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum -y update
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/8u60-b27/jdk-8u60-linux-x64.rpm" --output-document="/tmp/jdk-8u60-linux-x64.rpm"
rpm -i /tmp/jdk-8u60-linux-x64.rpm
rm -rf /tmp/jdk-8u60-linux-x64.rpm
alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000
alternatives --set java /usr/java/default/bin/java
yum -y install apache-maven git jenkins
# yum -y install java-1.8.0-openjdk-devel apache-maven git jenkins
# alternatives --set java /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
service jenkins start
chkconfig jenkins on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment