-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-mongodb.sh
executable file
·44 lines (34 loc) · 1016 Bytes
/
install-mongodb.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
#!/bin/bash
MONGODB_VERSION=1.6.0
PLATFORM_32=linux-i686
PLATFORM_64=linux-x86_64
echo "### Installing MongoDB"
# Create dir
echo "### Creating mongo/ directory"
mkdir mongo
cd mongo
# Detect the architecture and load correct mongodb
if $(uname -a | grep 'x86_64') || $(uname -a | grep 'ia64')
then
echo "### 64 bit os detected, installing 64 bit mongodb"
MONGODB_NAME=mongodb-$PLATFORM_64-$MONGODB_VERSION
else
echo "### 32 bit os detected, installing 32 bit mongodb."
echo "### WARNING: Database will be restricted to 2 GB, 64 bit machine recommended!"
MONGODB_NAME=mongodb-$PLATFORM_32-$MONGODB_VERSION
fi
# Download
echo "### Downloading mongodb"
wget http://downloads.mongodb.org/linux/$MONGODB_NAME.tgz -O mongo.tgz
# Exctract mongodb
echo "### Extracting mongodb"
tar -xzvf mongo.tgz
rm mongo.tgz
# Alias
echo "### Creating mongodb alias"
ln -s $MONGODB_NAME mongodb
cd ..
# Create a data dir
echo "### Creating data/db/ directory"
mkdir -p data/db/
echo "### End of Mongodb installation"