hadoop配置安装

操作系统为ubuntu10.04,cpu为AMD

1、先到到甲骨文官网下载jdk-7-linux-x64.tar.gz(CPU为其它的注意下载相应的版本),因为hadoop是用java写的,所以要安装java的jdk,我这是把下载的压缩文件解压到目录/usr/lib/jvm/jdk1.7.0,记住这个目录,待会设置hadoop的java环境变量的路径时会用到此目录。

2、再到hadoop官网下载hadoop-0.20.2.tar.gz,解压到某一个目录,我这是 /usr/hadoop-0.20.2

3、修改hadoop的java环境变量的路径,打开/usr/hadoop-0.20.2/conf/hadoop-env.sh文件,添加一行代码:

     export JAVA_HOME=/usr/lib/jvm/jdk1.7.0

到此hadoop默认配置完成,但是这个默认的模式是单机非分布式的。

特别注意关于java的安装,参考:http://www.webupd8.org/2011/09/how-to-install-oracle-java-7-jdk-in.html

1. Download the latest Oracle JDK 7 from HERE (you must click "accept license" and then download the .tar.gz package for your computer architecture - jdk-7-linux-i586.tar.gz or jdk-7-linux-x64.tar.gz; these filenames are just examples, they will change on future releases). You can use these instructions for older JDK versions too, but make sure you use the appropriate folder names, etc.
2. Extract the downloaded Oracle Java JDK archive in your home folder - a new folder called "jdk1.7.0" (for Java JDK7) should be created(自动解压生成了,不用新建) and we must move it to /usr/lib/jvm using the following commands:
cd '/home/lxj/Labs'  #个人把下载到的文件放在/home/lxj/Labs文件夹里
sudo mkdir -p /usr/lib/jvm/ #just in case (这里新建一个 jvm 文件夹,这步可省略不做)
sudo mv jdk1.7.0/ /usr/lib/jvm/ #生成:/usr/lib/jvm/jdk1.7.0


3. Install Update Java package created by Bruce Ingalls (packages available for Ubuntu 11.10, 11.04, 10.10 and 10.04):

sudo add-apt-repository ppa:nilarimogard/webupd8 

sudo apt-get update 

sudo apt-get install update-java


If you don't want to add the WebUpd8 PPA, you can also manually download the script.The script may work with other Linux distributions, but it has only been tested on Ubuntu.

4. Now run the following command in a terminal to install Oracle Java JDK:

sudo update-java

The script will ask you to select the Java version - select "jdk1.7.0" for Oracle Java JDK 7, click OK and wait for it to finish:

After a few minutes, Oracle Java JDK should be successfully installed on your Ubuntu machine. You can check out the version by running these commands in a terminal:java -version javac -version
The version should be "1.7.0".

posted @ 2011-10-17 19:22  郭远威  阅读(783)  评论(0编辑  收藏  举报