Hadoop1.2.1集群安装二

1:安装JDK

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

或从其它电脑copy过去


[jifeng@feng01 ~]$scp -r ./jdk-7u45-linux-x64.gz jifeng@jifeng01:/home/jifeng
The authenticity of host 'jifeng01 (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 'jifeng01,10.3.7.214' (RSA) to the list of known hosts.
jifeng@jifeng01's password: 
jdk-7u45-linux-x64.gz                         100%  132MB  32.9MB/s   00:04    

2:解压并配置java 环境

解压:tar vzxf jdk-7u45-linux-x64.gz

然后在/home/jifeng/.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/jifeng/.bash_profile

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

java -version

[jifeng@jifeng01 ~]$ source /home/jifeng/.bash_profile
[jifeng@jifeng01 ~]$ 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)
[jifeng@jifeng01 ~]$ 

3:ssh免登陆

[jifeng@jifeng01 ~]$ ssh-keygen -t -rsa
unknown key type -rsa
[jifeng@jifeng01 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jifeng/.ssh/id_rsa): 
/home/jifeng/.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/jifeng/.ssh/id_rsa.
Your public key has been saved in /home/jifeng/.ssh/id_rsa.pub.
The key fingerprint is:
b0:f3:f7:6f:80:98:09:48:52:03:2e:a5:d3:e6:b1:a8 jifeng@jifeng01
查看生成的文件
[jifeng@jifeng01 ~]$ cd .ssh
[jifeng@jifeng01 .ssh]$ ls
authorized_keys  id_rsa  id_rsa.pub
[jifeng@jifeng01 .ssh]$ ls -l
总计 12
-rw-r--r-- 1 jifeng jifeng  397 07-22 15:40 authorized_keys
-rw------- 1 jifeng jifeng 1675 07-23 22:56 id_rsa
-rw-r--r-- 1 jifeng jifeng  397 07-23 22:56 id_rsa.pub
另外一台电脑也这样操作
[jifeng@jifeng02 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jifeng/.ssh/id_rsa): 
/home/jifeng/.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/jifeng/.ssh/id_rsa.
Your public key has been saved in /home/jifeng/.ssh/id_rsa.pub.
The key fingerprint is:
74:bb:ff:af:9d:f3:4e:2e:18:6b:91:45:ff:ac:37:85 jifeng@jifeng02
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|              .  |
|        . .  . . |
|       . . .  . .|
|        S .  o o.|
|           .+ E +|
|          .  = .o|
|           .+ o*o|
|           ...oBX|
+-----------------+
复制文件到jifeng02

[jifeng@jifeng01 .ssh]$ scp ./id_rsa.pub jifeng@jifeng02:/home/jifeng/.ssh/authorized_keys
The authenticity of host 'jifeng02 (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 'jifeng02,10.3.7.212' (RSA) to the list of known hosts.
jifeng@jifeng02's password: 
id_rsa.pub                                    100%  397     0.4KB/s   00:00    
[jifeng@jifeng01 .ssh]$ 
测试成功

[jifeng@jifeng01 .ssh]$ ssh jifeng02
Last login: Wed Jul 23 22:22:27 2014 from 10.254.254.8
[jifeng@jifeng02 ~]$ 




你可能感兴趣的:(Hadoop1.2.1集群安装二)