[Hadoop] 第一篇 Hadoop 安装步骤

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Hadoop] 第一篇 Hadoop 安装步骤相关的知识,希望对你有一定的参考价值。

一 安装JDK


1.下载JDK

目前最新JDK:Java SE Development Kit 8u91
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


2.解压安装
我们把JDK安装到这个路径:/usr/lib/jvm
如果没有这个目录(第一次当然没有),我们就新建一个目录
1 cd /usr/lib
2 sudo mkdir jvm
建立好了以后,我们来到刚才下载好的压缩包的目录,解压到我们刚才新建的文件夹里面去,并且修改好名字方便我们管理
1 sudo tar zxvf ./jdk-8u91-linux-x64.tar.gz  -C /usr/lib/jvm
2 cd /usr/lib/jvm
3 sudo mv jdk1.8.0_91/   jdk8

3.配置环境变量
gedit ~/.bashrc
在打开的文件的末尾添加
export JAVA_HOME=/usr/lib/jvm/jdk8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
保存退出,然后输入下面的命令来使之生效
source ~/.bashrc

4.配置默认JDK(一般情况下这一步都可以省略)
由于一些Linux的发行版中已经存在默认的JDK,如OpenJDK等。所以为了使得我们刚才安装好的JDK版本能成为默认的JDK版本,我们还要进行下面的配置。
执行下面的命令:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk8/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk8/bin/javac 300
 注意:如果以上两个命令出现找不到路径问题,只要重启一下计算机在重复上面两行代码就OK了。
 
5.验证安装成功
[email protected]:~$ java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)


二 配置SSH


[email protected]:~$ sudo apt-get install ssh
[sudo] password for michael:
[email protected]:~$ ls -a /home/michael
.              .dmrc             .local             .python-eggs
..             Documents         .mission-control   redis-3.2.0
.bash_history  Downloads         .mozilla           redis-3.2.0.tar.gz
.bash_logout   examples.desktop  Music              .rediscli_history
.bashrc        ez_setup.py       .oracle_jre_usage  Templates
.bashrc~       .fontconfig       .pam_environment   .thumbnails
.cache         .gconf            Pictures           Videos
.compiz-1      .gnome2           .profile           .Xauthority
.config        .gtk-bookmarks    Public             .xsession-errors
.dbus          .gvfs             .pulse             .xsession-errors.old
Desktop        .ICEauthority     .pulse-cookie
[email protected]:~$ cd .ssh
bash: cd: .ssh: No such file or directory
[email protected]:~$ ssh-keygen -t dsa -P ‘‘ -f ~/.ssh/id_dsa


Generating public/private dsa key pair.
Created directory ‘/home/michael/.ssh‘.
Your identification has been saved in /home/michael/.ssh/id_dsa.
Your public key has been saved in /home/michael/.ssh/id_dsa.pub.
The key fingerprint is:
a8:c1:14:50:51:a8:4f:51:05:92:fe:b3:f0:1c:be:71 [email protected]
The key‘s randomart image is:
+--[ DSA 1024]----+
|  .o=*+o.        |
|    +o           |
|   o..           |
|  .oo  .         |
|   oo.. S        |
|    oo+          |
|    .=.+E        |
|      =o         |
|      ..         |
+-----------------+
[email protected]:~$ cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
[email protected]:~$ ssh -version
OpenSSH_5.9p1 Debian-5ubuntu1.9, OpenSSL 1.0.1 14 Mar 2012
Bad escape character ‘rsion‘.
[email protected]:~$ ssh localhost
The authenticity of host ‘localhost (127.0.0.1)‘ can‘t be established.
ECDSA key fingerprint is b7:fe:dc:32:13:c0:d6:2f:20:1b:ea:c8:ab:ab:c6:55.
Are you sure you want to continue connecting (yes/no)? y
Please type ‘yes‘ or ‘no‘: yes
Warning: Permanently added ‘localhost‘ (ECDSA) to the list of known hosts.
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

New release ‘14.04.4 LTS‘ available.
Run ‘do-release-upgrade‘ to upgrade to it.

Last login: Tue May 24 07:20:17 2016




本文出自 “软件设计与开发” 博客,请务必保留此出处http://yuanzhitang.blog.51cto.com/2769219/1784127

以上是关于[Hadoop] 第一篇 Hadoop 安装步骤的主要内容,如果未能解决你的问题,请参考以下文章

Hadoop集群搭建

大数据面试宝典 第一篇 Hadoop 面试题

大数据Hadoop-2

大数据Hadoop学习之搭建Hadoop平台(2.1)

hadoop入门学习教程--DKHadoop完整安装步骤

在Windows 10 环境下安装 Hadoop-3.1.2