-
Notifications
You must be signed in to change notification settings - Fork 0
/
zdep-installs.sh
146 lines (118 loc) · 5.01 KB
/
zdep-installs.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
#!/bin/sh
#By Sayan Das
#This script can be used to install JAVA, MySQL, Jmeter ServerAgent & Apache in Centos 6.x or Amazon Linux 2016.x
#Vars
BUILD_VERSION="b03"
JAVA_VERSION="8u77"
MYSQL_MAJOR="5.6"
MYSQL_VERSION="5.6.30-1.linux_glibc2.5"
#Option
installOption=$1
javaInstall() {
wget --quiet --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/$JAVA_VERSION-$BUILD_VERSION/jdk-$JAVA_VERSION-linux-x64.rpm" -O /tmp/jdk-8-linux-x64.rpm
rpm -ivh /tmp/jdk-8-linux-x64.rpm
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 200000 && \
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000 && \
alternatives --install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 200000 && \
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000
wget --quiet --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip -O /tmp/jce_policy-8.zip && \
unzip /tmp/jce_policy-8.zip -d /tmp/ && \
cd /tmp/UnlimitedJCEPolicyJDK8/ && \
cp -pfd /tmp/UnlimitedJCEPolicyJDK8/*.jar /usr/java/default/jre/lib/security/
}
mysqlInstall() {
echo -e "Removing any mysql-libs package if present by default"
rpm -e mysql-libs-* --nodeps
echo -e "Downloading MySQL 5.6.x and installing .."
wget --no-check-certificate --no-cookies "http://dev.mysql.com/get/Downloads/MySQL-$MYSQL_MAJOR/MySQL-$MYSQL_VERSION.x86_64.rpm-bundle.tar" -O /tmp/MySQL-$MYSQL_MAJOR-bundle.tar
yum -y install perl-Data-Dumper
tar -xvf /tmp/MySQL-$MYSQL_MAJOR-bundle.tar --directory /tmp/
yum -y --nogpgcheck install /tmp/MySQL-client-$MYSQL_VERSION.x86_64.rpm && \
yum -y --nogpgcheck install /tmp/MySQL-devel-$MYSQL_VERSION.x86_64.rpm && \
yum -y --nogpgcheck install /tmp/MySQL-shared-$MYSQL_VERSION.x86_64.rpm && \
yum -y --nogpgcheck install /tmp/MySQL-server-$MYSQL_VERSION.x86_64.rpm
mkdir -p /var/run/mysqld
chown mysql: /var/run/mysqld
wget https://raw.githubusercontent.com/sayan-d/sayf/master/sample-my.cnf -O /etc/my.cnf
# cleanup
rm -f /tmp/MySQL-$MYSQL_MAJOR-bundle.tar && \
rm -f /tmp/MySQL-client-$MYSQL_VERSION.x86_64.rpm && \
rm -f /tmp/MySQL-devel-$MYSQL_VERSION.x86_64.rpm && \
rm -f /tmp/MySQL-shared-$MYSQL_VERSION.x86_64.rpm && \
rm -f /tmp/MySQL-server-$MYSQL_VERSION.x86_64.rpm && \
rm -f /tmp/MySQL-*.rpm
/etc/init.d/mysql start
echo -e "Run mysql_secure_installation .."
}
jmeterServerAgentInstall() {
wget http://jmeter-plugins.org/downloads/file/ServerAgent-2.2.1.zip -O /tmp/ServerAgent-2.2.1.zip
unzip /tmp/ServerAgent-2.2.1.zip -d /usr/local/jmeterServerAgent/
#To start jmeter ServerAgent
#/usr/local/jmeterServerAgent/startAgent.sh
}
apache24Install() {
yum -y install httpd24 httpd24-tools
rpm -qa | grep httpd24 > /dev/null
if [ $? -eq 0 ];then
echo -e "Installed httpd24 successfully"
else
echo -e "Intallation failed, exiting"
exit 1
fi
echo -e "Comment out prefork line"
sed -i '/ mpm_prefork_module /s/^/#/' /etc/httpd/conf.modules.d/00-mpm.conf
echo -e "Uncomment event mpm line"
sed -i '/^#.* mpm_event_module /s/^#//' /etc/httpd/conf.modules.d/00-mpm.conf
/etc/init.d/httpd restart
echo -e "Checking current mpm"
httpd -V | grep "Server MPM"
}
nginxInstall() {
yum install -y pcre-devel openssl-devel gcc
wget http://nginx.org/download/nginx-1.9.9.tar.gz -O /usr/local/src/nginx-1.9.9.tar.gz
tar -xvf /usr/local/src/nginx-1.9.9.tar.gz --directory /usr/local/src/
wget https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/08a395c66e42.zip -O /usr/local/src/nginx-sticky-module-ng.zip
unzip /usr/local/src/nginx-sticky-module-ng.zip -d /usr/local/src/
/usr/local/src/nginx-1.9.9/configure --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --with-http_ssl_module --with-http_v2_module --add-module=/usr/local/src/nginx-goodies-nginx-sticky-module-ng-08a395c66e42/
make
make install
wget https://raw.githubusercontent.com/sayan-d/sayf/master/nginx-init-file.sh -O /etc/rc.d/init.d/nginx
chmod 755 /etc/rc.d/init.d/nginx
ln -s /etc/nginx/sbin/nginx /usr/sbin/nginx
service nginx start
}
case $installOption in
java)
echo -e "Installer will install Java $JAVA_VERSION .."
javaInstall
;;
mysql)
echo -e "Installer will install MySQL $MYSQL_MAJOR .."
mysqlInstall
;;
jmeterServerAgent)
echo -e "Installer will install jmeter Server Agent 2.2.1"
jmeterServerAgentInstall
;;
httpd)
echo -e "Installer will install Apache version 2.4.18+ with Event Mpm"
apache24Install
;;
zeeNODE)
echo -e "Installer will install mysql, jmeterServerAgent"
mysqlInstall
jmeterServerAgentInstall
;;
zeeLB)
echo -e "Installer will install Apache, jmeterServerAgent"
apache24Install
jmeterServerAgentInstall
;;
nginx)
echo -e "Installer will install Nginx and also add Sticky session module"
nginxInstall
;;
--help|-h)
echo -e "Choose any of the following options : ./scriptname.sh java / mysql / jmeterServerAgent / httpd / zeeNODE / zeeLB / nginx"
;;
esac