forked from matteobertozzi/Hadoop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hadoop-install.sh
executable file
·79 lines (60 loc) · 2.23 KB
/
hadoop-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
#!/bin/sh
HADOOP_USER="hadoop"
HADOOP_SRC="/usr/local/src/hadoop"
HADOOP_SRC_COMMON="$HADOOP_SRC/hadoop-common"
HADOOP_SRC_HDFS="$HADOOP_SRC/hadoop-hdfs"
HADOOP_SRC_MAPREDUCE="$HADOOP_SRC/hadoop-mapreduce"
HADOOP_BUILDS="/usr/local/hadoop-builds"
HADOOP_BUILDNR="$HADOOP_BUILDS/.buildnr"
HADOOP_HOME="/usr/local/hadoop"
HADOOP_CONF="/root/hadoop-conf"
hadoop_build() {
echo "Build Hadoop Common"
cd $HADOOP_SRC_COMMON
ant jar > /dev/null
echo "Build Hadoop HDFS"
cd $HADOOP_SRC_HDFS
ant jar > /dev/null
echo "Build Hadoop Map-Reduce"
cd $HADOOP_SRC_MAPREDUCE
ant jar > /dev/null
}
hadoop_install() {
mkdir -p $HADOOP_BUILDS
touch $HADOOP_BUILDNR
build_number=$((`cat $HADOOP_BUILDNR` + 1))
echo $build_number > $HADOOP_BUILDNR
echo "Hadoop Install $build_number"
hadoop_build="$HADOOP_BUILDS/hadoop-$build_number"
mkdir -p $hadoop_build
rm -f $HADOOP_HOME
ln -s $hadoop_build $HADOOP_HOME
ln -s /etc/hadoop $HADOOP_HOME/conf
mkdir -p $HADOOP_HOME/classes
mkdir -p $HADOOP_HOME/bin
mkdir -p $HADOOP_HOME/lib
cp -r $HADOOP_SRC_COMMON/build/hadoop-common-*.jar $HADOOP_HOME/
cp -r $HADOOP_SRC_HDFS/build/hadoop-hdfs-*.jar $HADOOP_HOME/
cp -r $HADOOP_SRC_MAPREDUCE/build/hadoop-mapred-*.jar $HADOOP_HOME/
cp -r $HADOOP_SRC_COMMON/bin/* $HADOOP_HOME/bin/
cp -r $HADOOP_SRC_HDFS/bin/* $HADOOP_HOME/bin/
cp -r $HADOOP_SRC_MAPREDUCE/bin/* $HADOOP_HOME/bin/
cp -r $HADOOP_SRC_COMMON/build/classes/* $HADOOP_HOME/classes/
cp -r $HADOOP_SRC_HDFS/build/classes/* $HADOOP_HOME/classes/
cp -r $HADOOP_SRC_MAPREDUCE/build/classes/* $HADOOP_HOME/classes/
cp $HADOOP_SRC_MAPREDUCE/build/ivy/lib/Hadoop/common/*.jar $HADOOP_HOME/lib/
rm -f $HADOOP_HOME/lib/hadoop-common-*.jar
rm -f $HADOOP_HOME/lib/hadoop-hdfs-*.jar
echo "$hadoop_build"
echo $HADOOP_HOME
chown -R $HADOOP_USER:$HADOOP_USER $HADOOP_HOME
chown -R $HADOOP_USER:$HADOOP_USER $HADOOP_BUILDS
echo "Hadoop new conf files $HADOOP_CONF"
rm -rf $HADOOP_CONF
mkdir -p $HADOOP_CONF
cp -r $HADOOP_SRC_COMMON/conf/* $HADOOP_CONF/
cp -r $HADOOP_SRC_HDFS/conf/* $HADOOP_CONF/
cp -r $HADOOP_SRC_MAPREDUCE/conf/* $HADOOP_CONF/
}
hadoop_build
hadoop_install