-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision.sh
124 lines (100 loc) · 4 KB
/
provision.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
if [ ! -f /usr/bin/svn ];
then
echo "-------- PROVISIONING SUBVERSION ------------"
echo "---------------------------------------------"
## Install subverison
apt-get update
apt-get -y install subversion
else
echo "CHECK - Subversion already installed"
fi
if [ ! -f /usr/lib/jvm/java-7-oracle/bin/java ];
then
echo "-------- PROVISIONING JAVA ------------"
echo "---------------------------------------"
## Make java install non-interactive
## See http://askubuntu.com/questions/190582/installing-java-automatically-with-silent-option
echo debconf shared/accepted-oracle-license-v1-1 select true | \
debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | \
debconf-set-selections
## Install java 1.7
## See http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get -y install oracle-java7-installer
else
echo "CHECK - Java already installed"
fi
if [ ! -f /etc/init.d/jenkins ];
then
echo "-------- PROVISIONING JENKINS ------------"
echo "------------------------------------------"
## Install Jenkins
#
# URL: http://localhost:6060
# Home: /var/lib/jenkins
# Start/Stop: /etc/init.d/jenkins
# Config: /etc/default/jenkins
# Jenkins log: /var/log/jenkins/jenkins.log
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
apt-get update
apt-get -y install jenkins
# Move Jenkins to port 6060
sed -i 's/8080/6060/g' /etc/default/jenkins
/etc/init.d/jenkins restart
else
echo "CHECK - Jenkins already installed"
fi
### Everything below this point is not stricly needed for Jenkins to work
###
if [ ! -f /etc/init.d/tomcat7 ];
then
echo "-------- PROVISIONING TOMCAT ------------"
echo "-----------------------------------------"
## Install Tomcat (port 8080)
# This gives us something to deploy builds into
# CATALINA_BASE=/var/lib/tomcat7
# CATALINE_HOME=/usr/share/tomcat7
export JAVA_HOME="/usr/lib/jvm/java-7-oracle"
apt-get -y install tomcat7
# Work around a bug in the default tomcat start script
sed -i 's/export JAVA_HOME/export JAVA_HOME=\"\/usr\/lib\/jvm\/java-7-oracle\"/g' /etc/init.d/tomcat7
/etc/init.d/tomcat7 stop
/etc/init.d/tomcat7 start
else
echo "CHECK - Tomcat already installed"
fi
if [ ! -f /usr/local/lib/ant/apache-ant-1.9.4/bin/ant ];
then
echo "-------- PROVISIONING ANT ---------------"
echo "-----------------------------------------"
mkdir -p /usr/local/lib/ant
cd /usr/local/lib/ant
wget -q http://ftp.halifax.rwth-aachen.de/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz
tar xzf apache-ant-1.9.4-bin.tar.gz
rm apache-ant-1.9.4-bin.tar.gz
ln -s /usr/local/lib/ant/apache-ant-1.9.4/bin/ant /usr/local/bin/ant
echo "Ant installed"
else
echo "CHECK - Ant already installed........................."
fi
echo "-------- PROVISIONING POSTGRESQL---------"
echo "-----------------------------------------"
sudo apt-get -y install postgresql postgresql-contrib
echo "POSTGRESQL installed"
echo "-------- PROVISIONING MONGO--------------"
echo "-----------------------------------------"
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
echo "MONGODB installed............................"
echo "-------- PROVISIONING DONE ------------"
echo "-- Jenkins: http://localhost:6060 "
echo "-- Tomcat7: http://localhost:7070 "
echo "---------------------------------------"