【nba买球】Hadoop 单机节点集群安装

作者:计算机教程

安装 Ubantun 11.10 ,root:Hadoop/hadoop

RHEL7.2 SSH非root用户无密码登录

安装yum:sudo apt-get install yum

1 修改三台虚拟机的/ect/hosts文件

更改 root密码:sudo passwd root 输入两次密码即可

[Hadoop@hadoop01 ~]$ cat /etc/hosts
127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4
::1        localhost localhost.localdomain localhost6 localhost6.localdomain6
[hadoop@hadoop01 ~]$ su - root
密码:
上一次登录:六 11月  4 15:52:36 CST 2017pts/0 上
ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1509781956
[root@hadoop01 ~]# vi /etc/hosts
[root@hadoop01 ~]# cat /etc/hosts
127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4
::1        localhost localhost.localdomain localhost6 localhost6.localdomain6
 
192.168.169.101 hadoop01
192.168.169.102 hadoop02
192.168.169.103 hadoop03

安装ssh:apt-get install ssh

2 修改三台虚拟机的/etc/ssh/sshd_config

配置ssh免密码登录

[root@hadoop01 ~]# vi /etc/ssh/sshd_config
[root@hadoop01 ~]# cat /etc/ssh/sshd_config | grep uth | grep -v "#"
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  .ssh/authorized_keys

root@Ubuntu:~# ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
Generating public/private dsa key pair.
Created directory '/root/.ssh'.
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
be:03:05:4b:ea:dd:5e:c0:43:e7:a0:ce:13:26:5b:32 root@ubuntu
The key's randomart image is:
--[ DSA 1024]----
|                |
|      o o .      |
|    o *       |
|    E * = .      |
|  . @ So      |
|    o *.. .      |
|      ..      |
|        o.      |
|        ..      |
-----------------

 将前面的#号去掉

root@ubuntu:~# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
root@ubuntu:~# cd .ssh/
root@ubuntu:~/.ssh# ls
authorized_keys  id_dsa  id_dsa.pub
root@ubuntu:~/.ssh# cat authorized_keys
ssh-dss AAAAB3NzaC1kc3MAAACBANeaZTGYfT t4C2EERqIOx6E7KOvrz/ kDSgBSMLz0rCKdXVMdVsfAmqXumfnq7StnFM2WYnz11tmGvHymmJQNrVvd4pAUFKd/oX6uCNpjXA45CMCivXNq67dBM1SDhhBzpntxLNDpU1GVniegiD2a6gFREzhdKe9a2OOA6xoECLAAAAFQDhsAFK1H0VezETQoXe3aWYnm9QRwAAAIBmE8x14azfEhaO59rF7uVlQbjKIOMcBtN9Q0tpuLNkX9bCaqVNMsTanaDXJKoW/cwboRY/32HET/Noc7uqfJZk4YY87ihaPsEeoOZ8uZpknWKDul6j3sbk1yroor16wqCA8CK2Z1Ro22lRY WHtdeEFfFZd6vvlNxBwQTQCbKuggAAAIAB0gp4uSAY6DEiVnxLfjDx2fEqggGjIFnjfu8PoKV8tbtWpdoayYaw758gN3r3UptOWD/p9//MqVP4CYWwADi1jyTFduRJMjQX91e3VcxH2T69t0c5CJQIZEdleeW2pI1FYN3GNUoj2PD193zWINJTBdQhvW0WWs/2n2XPmqcNEw== root@ubuntu
root@ubuntu:~/.ssh# ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is 0e:1d:c9:40:67:53:db:fb:51:1b:a8:ce:35:32:29:3d.
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 11.10 (GNU/Linux 3.0.0-12-generic i686)

3 修改三台虚拟机的/etc/selinux/config

* Documentation:  https://help.ubuntu.com/

[root@hadoop01 ~]# vi /etc/selinux/config 
[root@hadoop01 ~]# cat /etc/selinux/config | grep SELINUX= | grep -v "#"
SELINUX=disabled

New release '12.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

 4 重启虚机三台虚拟机

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

[root@hadoop01 ~]# reboot

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

 5 配置SSH无密码登录

安装rsync:apt-get install rsync

三台虚拟机依次操作如下:

安装vsftpd:apt-get install vsftpd

192.168.168.101

启动vsftpd:service vsftpd start/stop

[hadoop@hadoop01 ~]$ ssh-keygen
Generating public/private dsa key pair.
Created directory '/hadoop/.ssh'.
Your identification has been saved in /hadoop/.ssh/id_dsa.
Your public key has been saved in /hadoop/.ssh/id_dsa.pub.
The key fingerprint is:
c1:4b:6d:30:2b:57:b9:f8:dc:33:b6:d9:05:f8:79:31 hadoop@hadoop01
The key's randomart image is:
--[ DSA 1024]----
|        o ..    |
|      . *.      |
|      . *.o. .  |
|      . . . .E |
|        So . . oo|
|          o = o o|
|          . * o |
|            o .  |
|                |
-----------------
[hadoop@hadoop01 ~]$ chmod 700 .ssh
[hadoop@hadoop01 ~]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[hadoop@hadoop01 ~]$ chmod 600 ~/.ssh/authorized_keys
[hadoop@hadoop01 ~]$ ssh hadoop01
The authenticity of host 'hadoop01 (192.168.169.101)' can't be established.
ECDSA key fingerprint is 7a:41:d1:c6:30:98:21:51:40:b7:ac:13:a4:0d:05:5c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop01,192.168.169.101' (ECDSA) to the list of known hosts.
Last login: Sun Nov  5 10:24:11 2017 from 192.168.169.1
[hadoop@hadoop01 ~]$ exit
登出
Connection to hadoop01 closed.
[hadoop@hadoop01 ~]$ ssh hadoop01
Last login: Sun Nov  5 10:26:02 2017 from hadoop01

解压缩gz:gzip -d hadoop-1.1.0.tar.gz

192.168.168.102

解压缩tar:tar -xf hadoop-1.1.0.tar

[hadoop@hadoop02 ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/hadoop/.ssh/id_rsa):
Created directory '/hadoop/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /hadoop/.ssh/id_rsa.
Your public key has been saved in /hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
ee:ba:9f:68:d8:ab:27:ea:f7:42:ff:0c:47:80:fe:63 hadoop@hadoop02
The key's randomart image is:
--[ RSA 2048]----
|                |
|    .          |
|    . .          |
|  .  .        |
|    .  S        |
|    .. o        |
|  . E o        |
|    =.=B .      |
| .oo.B***        |
-----------------
[hadoop@hadoop02 ~]$ chmod 700 .ssh
[hadoop@hadoop02 ~]$ scp -rp ~/.ssh/id_rsa.pub hadoop@hadoop01:/hadoop/.ssh/id_rsa.pub.102
The authenticity of host 'hadoop01 (192.168.169.101)' can't be established.
ECDSA key fingerprint is 7a:41:d1:c6:30:98:21:51:40:b7:ac:13:a4:0d:05:5c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop01,192.168.169.101' (ECDSA) to the list of known hosts.
hadoop@hadoop01's password:
id_rsa.pub

nba买球 1

192.168.169.103

[hadoop@hadoop03 ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/hadoop/.ssh/id_rsa):
Created directory '/hadoop/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /hadoop/.ssh/id_rsa.
Your public key has been saved in /hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
dc:c2:8d:14:b0:bf:64:a7:2f:41:44:34:1b:66:2b:b2 hadoop@hadoop03
The key's randomart image is:
--[ RSA 2048]----
|      . O        |
|      .*      |
|    . o.         |
|    o *.       |
|    E  .S       |
|      o.=      |
|        o.      |
|        ..      |
|        ..      |
-----------------
[hadoop@hadoop03 ~]$ chmod 700 .ssh
[hadoop@hadoop03 ~]$ scp -rp ~/.ssh/id_rsa.pub hadoop@hadoop01:/hadoop/.ssh/id_rsa.pub.103
The authenticity of host 'hadoop01 (192.168.169.101)' can't be established.
ECDSA key fingerprint is 7a:41:d1:c6:30:98:21:51:40:b7:ac:13:a4:0d:05:5c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop01,192.168.169.101' (ECDSA) to the list of known hosts.
hadoop@hadoop01's password:
id_rsa.pub 

192.168.169.101

[hadoop@hadoop01 ~]$ cat ~/.ssh/id_rsa.pub.102 >> ~/.ssh/authorized_keys
[hadoop@hadoop01 ~]$ cat ~/.ssh/id_rsa.pub.103 >> ~/.ssh/authorized_keys
[hadoop@hadoop01 ~]nba买球,$ scp -rp ~/.ssh/authorized_keys hadoop@hadoop02:/hadoop/.ssh/
The authenticity of host 'hadoop02 (192.168.169.102)' can't be established.
ECDSA key fingerprint is f7:ef:fb:e5:7e:0f:59:40:63:23:99:9a:ca:e2:03:e8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop02,192.168.169.102' (ECDSA) to the list of known hosts.
hadoop@hadoop02's password:
authorized_keys                                                                                                                        100%  397    0.4KB/s  00:00   
[hadoop@hadoop01 ~]$ scp -rp ~/.ssh/authorized_keys hadoop@hadoop03:/hadoop/.ssh/
The authenticity of host 'hadoop03 (192.168.169.103)' can't be established.
ECDSA key fingerprint is 25:a7:16:1f:49:91:0f:ba:f8:ba:68:bb:1e:e0:1c:44.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop03,192.168.169.103' (ECDSA) to the list of known hosts.
hadoop@hadoop03's password:
authorized_keys                                                                                                                        100%  397    0.4KB/s  00:00   

本文由nba买球发布,转载请注明来源

关键词: