添加用户及无密码访问
添加用户 adduser hadoop
设置密码 passwd hadoop
添加到sudo用户组
chmod +w /etc/sudoers
echo '%hadoop ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
chmod -w /etc/sudoers
su hadoop
ssh-keygen -t rsa
机器互通
安装maven
sudo mkdir -p /opt/maven
sudo chown -R hadoop:hadoop /opt/maven
tar zxvf apache-maven-3.1.1-bin.tar.gz -C /opt/maven/
安装JDK
sudo mkdir -p /opt/java
sudo chown -R hadoop:hadoop /opt/java
tar zxvf jdk-7u45-linux-x64.tar.gz -C /opt/java/
配置环境变量
sudo vim /etc/profile
export JAVA_HOME=/opt/java/jdk1.7.0_45
export MAVEN_HOME=/opt/maven/apache-maven-3.1.1
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
安装protobuf
wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2
sudo mkdir -p /opt/protobuf
sudo chown -R hadoop:hadoop /opt/protobuf
tar jxvf protobuf-2.5.0.tar.bz2 -C /opt/protobuf
sudo yum install gcc
cd /opt/protobuf/protobuf-2.5.0
./configure
make
sudo make check
sudo make install
protoc --version
安装hadoop 2.2.0
tar zxvf hadoop-2.2.0-src.tar.gz
打补丁
cd hadoop-2.2.0-src
wget https://issues.apache.org/jira/secure/p_w_upload/12614482/HADOOP-10110.patch
patch -p0 < HADOOP-10110.patch
编译
mvn clean install -DskipTests
编译本地包
sudo yum install cmake ncurses-devel openssl-devel -y
mvn package -Pdist,native -DskipTests -Dtar
校验安装成功
cd /home/hadoop/hadoop-2.2.0-src/hadoop-dist/target/hadoop-2.2.0
bin/hadoop version
加快其它机器编译速度
scp -r ~/.m2/ kn02:~/
转载于:https://blog.51cto.com/10495845/1696725