-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbootstrap.sh
206 lines (164 loc) · 5.29 KB
/
bootstrap.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#!/usr/bin/env bash
# upating yum first
sudo yum update
# installing 'Extra Packages for Enterprise Linux'
# yum package manager does not have all latest software on its default repository
sudo yum install -y epel-release
sudo yum install -y wget
sudo yum install -y unzip
#Java
if [ ! -f /opt/jdk1.7.0_79/bin/java ];
then
echo "Downloading Java 7"
cd /opt/
wget --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/7u79-b15/jdk-7u79-linux-x64.tar.gz"
tar xzf jdk-7u79-linux-x64.tar.gz
echo "Installing Java 7"
cd /opt/jdk1.7.0_79/
alternatives --install /usr/bin/java java /opt/jdk1.7.0_79/bin/java 2
alternatives --install /usr/bin/jar jar /opt/jdk1.7.0_79/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_79/bin/javac 2
alternatives --set jar /opt/jdk1.7.0_79/bin/jar
alternatives --set javac /opt/jdk1.7.0_79/bin/javac
else
echo "Java 7 already installed - skipping"
fi
#Maven
if [ ! -f /usr/share/maven/bin/mvn ];
then
echo "Installing Maven"
sudo yum install -y maven
else
echo "Maven already installed - skipping"
fi
#Git
if [ ! -f /usr/bin/git ];
then
echo "Installing Git"
sudo yum install -y git
else
echo "Git already installed - skipping"
fi
if [ ! -f /etc/init.d/jenkins ];
then
echo "Installing 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 install -y jenkins
sed -i 's/8080/6060/g' /etc/default/jenkins
/etc/init.d/jenkins restart
else
echo "Jenkins already installed - not Installing"
fi
#SonarQube Server
echo "Downloading Sonar"
wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-5.5.zip
echo "Unpacking Sonar"
sudo unzip sonarqube-5.5.zip
echo "Installing Sonar"
sudo mv -v sonarqube-5.5 /opt/sonar
echo "Starting Sonar Server"
sudo /opt/sonar/bin/linux-x86-64/sonar.sh start
#Sonar Runner
cd /opt
sudo wget http://repo1.maven.org/maven2/org/codehaus/sonar/runner/sonar-runner-dist/2.4/sonar-runner-dist-2.4.zip
sudo unzip sonar-runner-dist-2.4.zip
sudo ln -s sonar-runner-2.4 sonar-runner
echo "Downloading Nexus"
cd /usr/local/
sudo wget www.sonatype.org/downloads/nexus-2.13.0-01-bundle.zip
echo "Extracting Nexus"
sudo unzip nexus-2.13.0-01-bundle.zip
sudo ln -s nexus-2.13.0-01 nexus
echo "Adding Nexus User"
sudo useradd nexus
sudo chown -R nexus:nexus nexus
sudo chown -R nexus:nexus nexus-2.13.0-01
sudo chown -R nexus:nexus sonatype-work
echo "Configuring Nexus script to have correct environment properties"
sudo sed -i 's/NEXUS_HOME=".."/NEXUS_HOME="\/usr\/local\/nexus"/g' /usr/local/nexus/bin/nexus
sudo sed -i 's/#RUN_AS_USER=/RUN_AS_USER=nexus/' /usr/local/nexus/bin/nexus
echo "Removing nexus download zip"
sudo rm nexus-2.13.0-01-bundle.zip
echo "Starting Nexus"
sudo /usr/local/nexus/bin/nexus start
#PHP
# (dependency requirement for GitList)
echo "Installing PHP"
sudo yum install -y php
#GitList
# (A Git Repository Viewer)
echo "Downloading GitList"
sudo wget https://s3.amazonaws.com/gitlist/gitlist-0.5.0.tar.gz
echo "Extracting GitList"
sudo mv gitlist-0.5.0.tar.gz /var/www/html
cd /var/www/html/
sudo tar -xvzf gitlist-0.5.0.tar.gz
sudo rm gitlist-0.5.0.tar.gz
cd /var/www/html/gitlist
sudo mkdir cache
sudo chmod 777 cache
sudo mkdir /var/www/projects/
sudo mv config.ini-example config.ini
sudo sed 's%\/home\/git\/repositories%\/var\/www\/projects%g' config.ini
echo "Disabling SELinux"
sudo sed 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
# At this point GitList should be installed
# It is just a matter of configuration for use
# 1. Reboot VM after vagrant up - so vagrant up again after shutdown
# 2. Need to change /var/www/html's AllowOverride from None to All in the default Apache website config file
# (CentOS this is /etc/httpd/conf/httpd.conf)
# 2. Restart Apache (sudo apachectl restart)
echo "Setting up MySQL Community Repo"
sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
#MySQL Server
if [ ! -f /usr/sbin/mysqld ];
then
echo "Installing MySQL Server"
sudo yum install -y mysql-server
sudo /sbin/service mysqld start
else
echo "Mysql server already installed - skipping"
fi
#Apache Http Web Server
if [ ! -f /usr/lib/apache2/mpm-worker/apache2 ];
then
echo "Installing Apache"
sudo yum install -y httpd
else
echo "Apache already installed - skipping"
fi
echo "Starting apache"
sudo apachectl start
#Tomcat
if [ ! -f /etc/init.d/tomcat ];
then
echo "Installing Tomcat"
sudo yum install -y tomcat
echo "Installing Tomcat docs"
sudo yum install -y tomcat-docs-webapp
echo "Installing Tomcat administration web apps"
sudo yum install -y tomcat-admin-webapp
else
echo "Tomcat already installed - skipping"
fi
echo "Starting Tomcat"
sudo systemctl start tomcat
echo "Enabling Tomcat service"
sudo systemctl enable tomcat
#NGINX
if [ ! -f /usr/sbin/nginx ];
then
echo "Installing NGINX"
sudo yum install -y nginx
echo "Starting NGINX"
sudo /etc/init.d/nginx start
else
echo "NGINX already installed - skipping"
fi