Ubuntu 12.04 上使用Hadoop 2.2.0

首先准备一个虚拟机,Ubuntu 12.04.4

Java环境:

root@hm1:~# mvn --version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 15:22:22+0000)
Maven home: /usr/apache-maven-3.1.1
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-59-virtual", arch: "amd64", family: "unix"

创建hadoop的用户以及组, 组hadoop, 用户名hduser, 密码hduser

root@hm1:~# addgroup hadoop
Adding group `hadoop' (GID 1001) ...
Done.
root@hm1:~# adduser --ingroup hadoop hduser
Adding user `hduser' ...
Adding new user `hduser' (1001) with group `hadoop' ...
Creating home directory `/home/hduser' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for hduser
Enter the new value, or press ENTER for the default
 Full Name []:
 Room Number []:
 Work Phone []:
 Home Phone []:
 Other []:
Is the information correct? [Y/n] y

添加到sudo组中

root@hm1:~# adduser hduser sudo
Adding user `hduser' to group `sudo' ...
Adding user hduser to group sudo
Done.

为了防止以后用hduser使用sudo时候遇到如下错误:

hduser is not in the sudoers file.  This incident will be reported.

需要用visudo命令编辑文件/etc/sudoers, 添加一行

# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD: ALL
hduser ALL=(ALL) ALL

退出root用户,用hduser登录。

ssh hduser@192.168.1.70

为了避免安装脚本提示认证,下面的命令将建立localhost访问的证书文件

hduser@hm1:~$ ssh-keygen -t rsa -P ''
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hduser/.ssh/id_rsa):
Created directory '/home/hduser/.ssh'.
Your identification has been saved in /home/hduser/.ssh/id_rsa.
Your public key has been saved in /home/hduser/.ssh/id_rsa.pub.
The key fingerprint is:
b8:b6:3d:c2:24:1f:7b:a3:00:88:72:86:76:5a:d8:c2 hduser@hm1
The key's randomart image is:
+--[ RSA 2048]----+
|                |
|                |
|                |
|ooo    .        |
|=E++  . S        |
|oo=.. o.        |
| .  .=oo        |
|    o=o+        |
|      o+.o      |
+-----------------+
hduser@hm1:~$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
hduser@hm1:~$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is fb:a8:6c:4c:51:57:b2:6d:36:b2:9c:62:94:30:40:a7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-59-virtual x86_64)

* Documentation:  https://help.ubuntu.com/
Last login: Fri Feb 21 07:59:05 2014 from 192.168.1.5

ssh localhost 如果没有遇到询问密码,就说明上面的设置成功了。

现在下载hadoop,下载网址:

现在运行下面的命令下载和修改文件权限

$ cd ~
$ wget
$ sudo tar vxzf hadoop-2.2.0.tar.gz -C /usr/local
$ cd /usr/local
$ sudo mv hadoop-2.2.0 hadoop
$ sudo chown -R hduser:hadoop hadoop

相关阅读

Ubuntu 13.04上搭建Hadoop环境

Ubuntu 12.10 +Hadoop 1.2.1版本集群配置

Ubuntu上搭建Hadoop环境(单机模式+伪分布模式)

Ubuntu下Hadoop环境的配置

单机版搭建Hadoop环境图文教程详解

搭建Hadoop环境(在Winodws环境下用虚拟机虚拟两个Ubuntu系统进行搭建)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/051ce98a7da1aa24ae95281644219320.html