-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·112 lines (84 loc) · 2.81 KB
/
install.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
#!/usr/bin/env bash
install_java(){
if ! which java >/dev/null; then
sudo apt-get install -y openjdk-8-jre
fi
}
install_elasticsearch(){
if ! ls /etc/apt/sources.list.d/ 2>&1 | grep -q elasticsearch.list; then
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elastic.co/elasticsearch/5.0.0/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list
sudo apt-get update -qq -y
sudo apt-get install -y elasticsearch
fi
}
install_git(){
# Get latest version of git
if ! ls /etc/apt/sources.list.d/ 2>&1 | grep -q git-core-ubuntu-ppa; then
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update -qq -y
sudo apt-get install -y git
fi
}
install_nginx(){
if ! ls /etc/apt/sources.list.d/ 2>&1 | grep -q nginx-ubuntu-stable; then
sudo add-apt-repository -y ppa:nginx/stable
sudo apt-get update
sudo apt-get install -y nginx
fi
}
install_mongodb(){
if ! ls /etc/apt/sources.list.d/ 2>&1 | grep -q mongodb-org-3.2; then
# Import mongodb public GPG key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update -qq -y
sudo apt-get install -y mongodb-org
# Stop MongoDB
sudo service mongod stop
fi
}
install_redis(){
if ! which redis-server >/dev/null; then
# Get latest version of Redis
wget http://download.redis.io/releases/redis-3.2.4.tar.gz
tar xzf redis-3.2.4.tar.gz
cd redis-3.2.4
sudo make install
cd utils
sudo ./install_server.sh
cd ../..
sudo rm -rf redis-3.2.4
sudo rm -rf redis-3.2.4.tar.gz
fi
}
install_phantom(){
if ! which phantomjs >/dev/null; then
cd /usr/local/share
arch=$(uname -m)
if ! [ $(arch) = "x86_64" ]; then
arch="i686"
fi
wget "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-${arch}.tar.bz2" -O- | sudo tar xfj -
sudo ln -snf /usr/local/share/phantomjs-2.1.1-linux-${arch}/bin/phantomjs /usr/local/bin/phantomjs
fi
}
install_nodejs(){
if ! which node >/dev/null; then
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 68576280
sudo apt-add-repository "deb https://deb.nodesource.com/node_6.x $(lsb_release -sc) main"
sudo apt-get update -qq -y
sudo apt-get install -y nodejs
fi
}
# Get password
sudo echo
sudo apt-get install -y python-pip
install_java
install_elasticsearch
install_git
install_nginx
install_mongodb
install_redis
install_nodejs
install_phantom