这篇文章将为大家详细讲解有关Ubuntu 14中怎么安装 Hadoop 2.7 集群,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
解压下载的JRE:
ak@UBU14HADOOP01:~$ tar zxvf server-jre-7u80-linux-x64.tar.gz
在USR目录新建Java目录:
ak@UBU14HADOOP01:~$ sudo mkdir /usr/java
拷贝刚刚解压的JRE文件目录到上面新建的java目录,得到如下目录:
ak@UBU14HADOOP01:/usr/java$ ll total 12 drwxr-xr-x 3 root root 4096 Mar 7 11:49 ./ drwxr-xr-x 11 root root 4096 Mar 7 11:49 ../ drwxr-xr-x 8 root root 4096 Mar 7 11:49 jdk1.7.0_80/
修改环境变量:
修改/etc/profile文件,在文件末尾添加如下内容:
# Path Oracle JAVA JAVA_HOME=/usr/java/jdk1.7.0_80 JRE_HOME=/usr/java/jdk1.7.0_80/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export JAVA_HOME JRE_HOME PATH CLASSPATH
重新读取profile文件使java目录生效:
ak@UBU14HADOOP01:~$ source /etc/profile
检查Java -version以确认java路径是否生效,如果看到如下图的返回表示java设置正确:
ak@UBU14HADOOP01:~$ java -version java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
下载Hadoop 2.7.2 binary:
ak@UBU14HADOOP02:~$ wget http://mirrors.cnnic.cn/apache/hadoop/common/hadoop-2.7.2/hadoop-2.7.2.tar.gz
解压
ak@UBU14HADOOP02:~$ tar zxvf hadoop-2.7.2.tar.gz
SSH到本地:
ak@UBU14HADOOP01:~$ ssh localhost
命令返回如下结果:
The authenticity of host 'localhost (::1)' can't be established. ECDSA key fingerprint is 45:3e:07:9e:1f:05:bf:9d:bc:1d:7c:18:aa:f5:03:f3. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts. ak@localhost's password:
这表示SSH还没有配置免密码登陆。
使用SSH-KEYGEN生成秘钥公钥:
ak@UBU14HADOOP01:~$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
运行结果如下:
Generating public/private dsa key pair. Your identification has been saved in /home/ak/.ssh/id_dsa. Your public key has been saved in /home/ak/.ssh/id_dsa.pub. The key fingerprint is: 61:56:f3:b2:aa:8b:b0:df:cb:89:ea:6b:26:13:7d:eb ak@UBU14HADOOP01 The key's randomart image is: +--[ DSA 1024]----+ | o | | . o | | + . . | | o . o | | . S . | |. . . . | | ... . . | |o oo.= o | | *==E Bo | +-----------------+
文件存放的路径为当前用户的home路面下的.ssh目录。由于ssh名前有一个点,该目录是隐藏的。
使用如下命令把生成的公钥放到anthorized_keys里面去:
ak@UBU14HADOOP01:~$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
使用如下命令修改authorized_keys文件的权限,这样只有本用户才能修改:
ak@UBU14HADOOP01:~$ chmod 0600 ~/.ssh/authorized_keys
再次ssh到本地,系统无密码提示,表示配置成功:
ak@UBU14HADOOP01:~$ ssh localhost Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.19.0-51-generic x86_64) * Documentation: https://help.ubuntu.com/ System information as of Mon Mar 7 12:11:46 CST 2016 System load: 0.08 Processes: 146 Usage of /: 11.0% of 17.34GB Users logged in: 1 Memory usage: 4% IP address for eth0: 192.168.88.90 Swap usage: 0% Graph this data and manage this system at: https://landscape.canonical.com/ Last login: Mon Mar 7 12:11:47 2016 from localhost ak@UBU14HADOOP01:~$ exit logout Connection to localhost closed.
关于Ubuntu 14中怎么安装 Hadoop 2.7 集群就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。