> Linux集群 > Hadoop >

Hadoop1.2.1集群安装二

1:安装JDK

下载好jdk-7u45-Linux-x64.gz

或从其它电脑copy过去



[it@feng01 ~]$scp -r ./jdk-7u45-linux-x64.gz it@it.net.cn:/home/it 
The authenticity of host 'it.net.cn (10.3.7.214)' can't be established. 
RSA key fingerprint is a8:9d:34:63:fa:c2:47:4f:81:10:94:fa:4b:ba:08:55. 
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added 'it.net.cn,10.3.7.214' (RSA) to the list of known hosts. 
it@it.net.cn's password:  
jdk-7u45-linux-x64.gz                         100%  132MB  32.9MB/s   00:04     

2:解压并配置java 环境
解压:tar vzxf jdk-7u45-linux-x64.gz

然后在/home/it/.bash_profile文件末加上以下语句:

export JAVA_HOME=$HOME/jdk1.7.0_45

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

接着使文件生效:source /home/it/.bash_profile

最后,验证是否安装成功:

Java -version


[it@it.net.cn ~]$ source /home/it/.bash_profile 
[it@it.net.cn ~]$ java -version 
java version "1.7.0_45" 
Java(TM) SE Runtime Environment (build 1.7.0_45-b18) 
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) 
[it@it.net.cn ~]$  

3:ssh免登陆

[it@it.net.cn ~]$ ssh-keygen -t -rsa 
unknown key type -rsa 
[it@it.net.cn ~]$ ssh-keygen -t rsa 
Generating public/private rsa key pair. 
Enter file in which to save the key (/home/it/.ssh/id_rsa):  
/home/it/.ssh/id_rsa already exists. 存在文件要覆盖 
Overwrite (y/n)? y 
Enter passphrase (empty for no passphrase):  
Enter same passphrase again:  
Your identification has been saved in /home/it/.ssh/id_rsa. 
Your public key has been saved in /home/it/.ssh/id_rsa.pub. 
The key fingerprint is: 
b0:f3:f7:6f:80:98:09:48:52:03:2e:a5:d3:e6:b1:a8 it@it.net.cn 
查看生成的文件

[it@it.net.cn ~]$ cd .ssh 
[it@it.net.cn .ssh]$ ls 
authorized_keys  id_rsa  id_rsa.pub 
[it@it.net.cn .ssh]$ ls -l 
总计 12 
-rw-r--r-- 1 it it  397 07-22 15:40 authorized_keys 
-rw------- 1 it it 1675 07-23 22:56 id_rsa 
-rw-r--r-- 1 it it  397 07-23 22:56 id_rsa.pub 
另外一台电脑也这样操作

[it@it02 ~]$ ssh-keygen -t rsa 
Generating public/private rsa key pair. 
Enter file in which to save the key (/home/it/.ssh/id_rsa):  
/home/it/.ssh/id_rsa already exists. 
Overwrite (y/n)? y 
Enter passphrase (empty for no passphrase):  
Enter same passphrase again:  
Your identification has been saved in /home/it/.ssh/id_rsa. 
Your public key has been saved in /home/it/.ssh/id_rsa.pub. 
The key fingerprint is: 
74:bb:ff:af:9d:f3:4e:2e:18:6b:91:45:ff:ac:37:85 it@it02 
The key's randomart image is: 
+--[ RSA 2048]----+ 
|                 | 
|              .  | 
|        . .  . . | 
|       . . .  . .| 
|        S .  o o.| 
|           .+ E +| 
|          .  = .o| 
|           .+ o*o| 
|           ...oBX| 
+-----------------+ 
复制文件到it02

[it@it.net.cn .ssh]$ scp ./id_rsa.pub it@it02:/home/it/.ssh/authorized_keys 
The authenticity of host 'it02 (10.3.7.212)' can't be established. 
RSA key fingerprint is 5f:20:1a:77:96:99:4a:f2:5d:a1:1d:68:b6:91:5a:e7. 
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added 'it02,10.3.7.212' (RSA) to the list of known hosts. 
it@it02's password:  
id_rsa.pub                                    100%  397     0.4KB/s   00:00     
[it@it.net.cn .ssh]$  

测试成功

[it@it.net.cn .ssh]$ ssh it02 
Last login: Wed Jul 23 22:22:27 2014 from 10.254.254.8 
[it@it02 ~]$   


(责任编辑:IT)