使用ppa/源方式安裝
1.添加ppa
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
2.安裝oracle-java-installer
jdk7html
sudo apt-get install oracle-java7-installer
jdk8java
sudo apt-get install oracle-java8-installer
修改環境變量
c查看JDK安裝位置
update-alternatives - -config java
cd /
cd /etc
suto gedit prifile
#JAVA VARIABLES
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
export PATH=$PATH:$JAVA_HOME/bin
#HADOOP VARIABLES
#export HADOOP_INSTALL=/usr/local/hadoop
#export PATH=$PATH:$HADOOP_INSTALL/bin
#export PATH=$PATH:$HADOOP_INSTALL/sbin
#export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
#export HADOOP_COMMON_HOME=$HADOOP_INSTALL
#export HADOOP_HDFS_HOME=$HADOOP_INSTALL
#export YARN_HOME=$HADOOP_INSTALL
#export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
#export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
建立hadoop用戶
sudo addgroup hadoopnode
sudo adduser -ingroup hadoop hadoopweb
回車後會提示輸入新的UNIX密碼,這是新建用戶hadoop的密碼,輸入回車便可。oracle
若是不輸入密碼,回車後會從新提示輸入密碼,即密碼不能爲空。ssh
最後確認信息是否正確,若是沒問題,輸入 Y,回車便可。jvm
爲hadoop用戶添加權限
輸入:sudo gedit /etc/sudoersoop
回車,打開sudoers文件測試
給hadoop用戶賦予和root用戶一樣的權限spa
切換帳號
su hadoop
SUDO gedit /etc/hosts
#ADD 這裏IP地址重啓VB以後有可能變化,須要從新查看橋接網卡IP,在設置
192.168.56.101 master
192.168.56.102 node1
192.168.56.103 node2
驗證
ping master
ping node1
ping node2
1)生產公私祕鑰
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
2)複製公私祕鑰KEY
cd /.ssh
cat id_dsa.pub >> autohrized_keys
3)單機會還SSH免密碼登陸測試
ssh localhost
發現問題,連接拒絕,懷疑是防火牆問題或者SSH安裝問題。
解決:
sudo
apt-get install openssh-server
4) 讓主結點(master)能經過SSH免密碼登陸兩個子結點(slave)
操做:node1 node2
cd .ssh/
scp hadoop@master:/home/hadoop/.ssh/id_dsa.pub ./master_das.pub
5)
複製aster.dsa-pub到認證KEY文件
cat id_dsa.pub >> autohrized_keys
驗證登陸
操做:master
ssh node1
ssh node2
免密碼登陸便可
#回收權限,防止成爲肉雞
chmod 600 authorized_keys
以上,環境配置成功:
參考文檔: