本文介绍安装Hadoop 2.2.0 single node。
首先准备一个虚拟机,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"
http://codesfusion.blogspot.com/2013/10/setup-hadoop-2x-220-on-ubuntu.html?m=1
创建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
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
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
现在下载hadoop,下载网址:http://apache.mirrors.lucidnetworks.net/hadoop/common/
现在运行下面的命令下载和修改文件权限
$ cd ~ $ wget http://www.trieuvan.com/apache/hadoop/common/hadoop-2.2.0/hadoop-2.2.0.tar.gz $ 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 12.04 上使用Hadoop 2.2.0 一 用户权限设置
原文:http://blog.csdn.net/csfreebird/article/details/19624417