3.Java和hadoop的安装

Posted braveym

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了3.Java和hadoop的安装相关的知识,希望对你有一定的参考价值。

 

先创建目录

技术图片

[[email protected] opt]$ cd /opt
[[email protected] opt]$ sudo mkdir /opt/softwares
[[email protected] opt]$ sudo mkdir /opt/modules
[[email protected] opt]$ sudo mkdir /opt/tools
[[email protected] opt]$ sudo mkdir /opt/datas
[[email protected] opt]$ sudo rm -rh rh
rm: invalid option -- h
Try rm --help for more information.
[[email protected] opt]$ sudo rm -rf rh
[[email protected] opt]$ ll
total 0
drwxr-xr-x. 2 root root 6 May  9 17:19 datas
drwxr-xr-x. 2 root root 6 May  9 17:18 modules
drwxr-xr-x. 2 root root 6 May  9 17:18 softwares
drwxr-xr-x. 2 root root 6 May  9 17:19 tool

 

 

给目录赋予权限

技术图片

[[email protected] opt]$ sudo chown -R hadoop:hadoop /opt/*
[[email protected] opt]$ ll
total 0
drwxr-xr-x. 2 hadoop hadoop 6 May  9 17:19 datas
drwxr-xr-x. 2 hadoop hadoop 6 May  9 17:18 modules
drwxr-xr-x. 2 hadoop hadoop 6 May  9 17:18 softwares
drwxr-xr-x. 2 hadoop hadoop 6 May  9 17:19 tools

 

其他3台机器也是一样的操作!!

 

 

 上传java安装包和hadoop安装包

技术图片

 

 解压jdk

技术图片

 

  配置jdk环境变量

 技术图片

 

#java
export JAVA_HOME=/opt/modules/jdk1.8.0_65
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

 

 使环境变量生效

技术图片

 

 

 

接下来配置给每台机器配置免密码登录

技术图片

 

添加以下语句。

技术图片

另外三台机器也这样操作!!!!

 同时配置虚拟机与本地电脑的地址映射关系

技术图片

 

添加以下语句

技术图片

 

 

 

 

每台机器的各自本身的无密码访问

node1

 技术图片

[[email protected] ~]$ cd 
[[email protected] ~]$ cd .ssh
-bash: cd: .ssh: No such file or directory
[[email protected] ~]$ mkdir .ssh
[[email protected] ~]$ cd .ssh
[[email protected] .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Q2csL/LvcBf6qs29dZyjW0ZVKnqkqx+4DK4QHRJUEHo [email protected]
The keys randomart image is:
+---[RSA 2048]----+
| .=+.           .|
| . .     .     ..|
|. E .   o + o . .|
| . o . . = + .  .|
|  . . . S + o  . |
|   .   o + + ....|
|  .   . + = . .=o|
|   . . o O = .+..|
|    ... =+B.++.  |
+----[SHA256]-----+
[[email protected] .ssh]$ 

 

 

技术图片

技术图片

[[email protected] .ssh]$ ls
id_rsa  id_rsa.pub
[[email protected] .ssh]$ cat id_rsa.pub >> authorized_keys
[[email protected] .ssh]$ ls
authorized_keys  id_rsa  id_rsa.pub
[[email protected] .ssh]$ cd ..
[[email protected] ~]$  chmod 700 .ssh
[[email protected] ~]$ chmod 600 .ssh/*
[[email protected] ~]$ ssh node1
The authenticity of host ‘node1 (fe80::eb1a:bdfe:4746:d86e%ens33)‘ can‘t be established.
ECDSA key fingerprint is SHA256:MgPYAE+6wpwD4f0o7rxojIbSEO1/6CWDDwebvR+m/NA.
ECDSA key fingerprint is MD5:9d:2a:c6:e4:c4:a1:73:42:92:47:a5:f1:9a:eb:2c:58.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘node1,fe80::eb1a:bdfe:4746:d86e%ens33‘ (ECDSA) to the list of known hosts.
Last login: Fri May 10 17:40:50 2019 from 192.168.86.1
[[email protected] ~]$ sudo yum -y install openssh-clients
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.njupt.edu.cn
base                                                                                                                  | 3.6 kB  00:00:00     
extras                                                                                                                | 3.4 kB  00:00:00     
updates                                                                                                               | 3.4 kB  00:00:00     
updates/7/x86_64/primary_db                                                                                           | 4.2 MB  00:00:05     
Package openssh-clients-7.4p1-16.el7.x86_64 already installed and latest version
Nothing to do
[[email protected] ~]$ ssh node1
Last login: Fri May 10 17:51:08 2019 from fe80::eb1a:bdfe:4746:d86e%ens33
[[email protected] ~]$ exit
logout
Connection to node1 closed.
[[email protected] ~]$ 

 

 

node2

技术图片

[[email protected] ~]$ mkdir .ssh
[[email protected] ~]$ cd .ssh
[[email protected] .ssh]$ ls
[[email protected] .ssh]$ cd ..
[[email protected] ~]$ cd .ssh
[[email protected] .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ldG4RCbi5P1vf6McCO6XHm0OMW4ncKdQBrJn53uzyFw [email protected]
The keys randomart image is:
+---[RSA 2048]----+
|      o..o+o     |
|     + ooo+o.    |
|      o..+o=     |
|        oo*      |
|        S+.= .   |
|        . *.O    |
|         . X+E   |
|        . ++%.+..|
|         .o= =o..|
+----[SHA256]-----+
[[email protected] .ssh]$ ls
id_rsa  id_rsa.pub
[[email protected] .ssh]$ 

 

 

技术图片

 

 技术图片

 

 

[[email protected] .ssh]$ cat id_rsa.pub >> authorized_keys
[[email protected] .ssh]$ ls
authorized_keys  id_rsa  id_rsa.pub
[[email protected] .ssh]$ cd ..
[[email protected] ~]$ chmod 700 .ssh
[[email protected] ~]$ chmod 600 .ssh/*
[[email protected] ~]$ sudo yum -y install openssh-clients
Loaded plugins: fastestmirror, langpacks
base                                                                                                                  | 3.6 kB  00:00:00     
extras                                                                                                                | 3.4 kB  00:00:00     
updates                                                                                                               | 3.4 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package openssh-clients.x86_64 0:7.4p1-11.el7 will be updated
---> Package openssh-clients.x86_64 0:7.4p1-16.el7 will be an update
--> Processing Dependency: openssh = 7.4p1-16.el7 for package: openssh-clients-7.4p1-16.el7.x86_64
--> Running transaction check
---> Package openssh.x86_64 0:7.4p1-11.el7 will be updated
--> Processing Dependency: openssh = 7.4p1-11.el7 for package: openssh-server-7.4p1-11.el7.x86_64
---> Package openssh.x86_64 0:7.4p1-16.el7 will be an update
--> Running transaction check
---> Package openssh-server.x86_64 0:7.4p1-11.el7 will be updated
---> Package openssh-server.x86_64 0:7.4p1-16.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                                Arch                          Version                              Repository                   Size
=============================================================================================================================================
Updating:
 openssh-clients                        x86_64                        7.4p1-16.el7                         base                        655 k
Updating for dependencies:
 openssh                                x86_64                        7.4p1-16.el7                         base                        510 k
 openssh-server                         x86_64                        7.4p1-16.el7                         base                        458 k

Transaction Summary
=============================================================================================================================================
Upgrade  1 Package (+2 Dependent packages)

Total download size: 1.6 M
Downloading packages:
No Presto metadata available for base
(1/3): openssh-clients-7.4p1-16.el7.x86_64.rpm                                                                        | 655 kB  00:00:00     
(2/3): openssh-server-7.4p1-16.el7.x86_64.rpm                                                                         | 458 kB  00:00:00     
(3/3): openssh-7.4p1-16.el7.x86_64.rpm                                                                                | 510 kB  00:00:00     
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        2.2 MB/s | 1.6 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : openssh-7.4p1-16.el7.x86_64                                                                                               1/6 
  Updating   : openssh-clients-7.4p1-16.el7.x86_64                                                                                       2/6 
  Updating   : openssh-server-7.4p1-16.el7.x86_64                                                                                        3/6 
  Cleanup    : openssh-server-7.4p1-11.el7.x86_64                                                                                        4/6 
  Cleanup    : openssh-clients-7.4p1-11.el7.x86_64                                                                                       5/6 
  Cleanup    : openssh-7.4p1-11.el7.x86_64                                                                                               6/6 
  Verifying  : openssh-7.4p1-16.el7.x86_64                                                                                               1/6 
  Verifying  : openssh-clients-7.4p1-16.el7.x86_64                                                                                       2/6 
  Verifying  : openssh-server-7.4p1-16.el7.x86_64                                                                                        3/6 
  Verifying  : openssh-clients-7.4p1-11.el7.x86_64                                                                                       4/6 
  Verifying  : openssh-7.4p1-11.el7.x86_64                                                                                               5/6 
  Verifying  : openssh-server-7.4p1-11.el7.x86_64                                                                                        6/6 

Updated:
  openssh-clients.x86_64 0:7.4p1-16.el7                                                                                                      

Dependency Updated:
  openssh.x86_64 0:7.4p1-16.el7                                     openssh-server.x86_64 0:7.4p1-16.el7                                    

Complete!
[[email protected] ~]$ ssh node2
The authenticity of host ‘node2 (fe80::2b74:214b:f03a:9f89%ens33)‘ can‘t be established.
ECDSA key fingerprint is SHA256:6mgGUMwozj0Cl6LzCNi250qZGSruWJA7bAktWIEAkDo.
ECDSA key fingerprint is MD5:cc:17:8e:2c:8f:9d:6f:1d:1a:da:ef:20:05:da:1f:2a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘node2,fe80::2b74:214b:f03a:9f89%ens33‘ (ECDSA) to the list of known hosts.
Last login: Fri May 10 17:40:59 2019 from 192.168.86.1
[[email protected] ~]$ exit
logout
Connection to node2 closed.
[[email protected] ~]$

 

 

 

 node3

 技术图片

[[email protected] ~]$  mkdir .ssh
[[email protected] ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:0aMi9W78aCoXPqtkQ6Jv6HnKec9BqyKjdbaY6tcFEmQ [email protected]
The keys randomart image is:
+---[RSA 2048]----+
|  .E             |
|  ..     .       |
|    . . . o      |
|   . o . o .     |
|  . +.o S        |
| . o..o=         |
|... B+..+        |
|[email protected]++=..o       |
|[email protected]+*o=. .      |
+----[SHA256]-----+
[[email protected] ~]$ 

 技术图片

[[email protected] .ssh]$ cat id_rsa.pub >> authorized_keys
[[email protected] .ssh]$ ls
authorized_keys  id_rsa  id_rsa.pub
[[email protected] .ssh]$ cd ..
[[email protected] ~]$ chmod 700 .ssh
[[email protected] ~]$  chmod 600 .ssh/*
[[email protected] ~]$ sudo yum -y install openssh-clients
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
base                                                                                                                  | 3.6 kB  00:00:00     
extras                                                                                                                | 3.4 kB  00:00:00     
updates                                                                                                               | 3.4 kB  00:00:00     
updates/7/x86_64/primary_db                                                                                           | 4.2 MB  00:00:01     
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: mirrors.nju.edu.cn
 * updates: centos.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package openssh-clients.x86_64 0:7.4p1-11.el7 will be updated
---> Package openssh-clients.x86_64 0:7.4p1-16.el7 will be an update
--> Processing Dependency: openssh = 7.4p1-16.el7 for package: openssh-clients-7.4p1-16.el7.x86_64
--> Running transaction check
---> Package openssh.x86_64 0:7.4p1-11.el7 will be updated
--> Processing Dependency: openssh = 7.4p1-11.el7 for package: openssh-server-7.4p1-11.el7.x86_64
---> Package openssh.x86_64 0:7.4p1-16.el7 will be an update
--> Running transaction check
---> Package openssh-server.x86_64 0:7.4p1-11.el7 will be updated
---> Package openssh-server.x86_64 0:7.4p1-16.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                                Arch                          Version                              Repository                   Size
=============================================================================================================================================
Updating:
 openssh-clients                        x86_64                        7.4p1-16.el7                         base                        655 k
Updating for dependencies:
 openssh                                x86_64                        7.4p1-16.el7                         base                        510 k
 openssh-server                         x86_64                        7.4p1-16.el7                         base                        458 k

Transaction Summary
=============================================================================================================================================
Upgrade  1 Package (+2 Dependent packages)

Total download size: 1.6 M
Downloading packages:
No Presto metadata available for base
warning: /var/cache/yum/x86_64/7/base/packages/openssh-7.4p1-16.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY-- ETA 
Public key for openssh-7.4p1-16.el7.x86_64.rpm is not installed
(1/3): openssh-7.4p1-16.el7.x86_64.rpm                                                                                | 510 kB  00:00:00     
(2/3): openssh-clients-7.4p1-16.el7.x86_64.rpm                                                                        | 655 kB  00:00:00     
(3/3): openssh-server-7.4p1-16.el7.x86_64.rpm                                                                         | 458 kB  00:00:01     
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        935 kB/s | 1.6 MB  00:00:01     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : openssh-7.4p1-16.el7.x86_64                                                                                               1/6 
  Updating   : openssh-clients-7.4p1-16.el7.x86_64                                                                                       2/6 
  Updating   : openssh-server-7.4p1-16.el7.x86_64                                                                                        3/6 
  Cleanup    : openssh-server-7.4p1-11.el7.x86_64                                                                                        4/6 
  Cleanup    : openssh-clients-7.4p1-11.el7.x86_64                                                                                       5/6 
  Cleanup    : openssh-7.4p1-11.el7.x86_64                                                                                               6/6 
  Verifying  : openssh-7.4p1-16.el7.x86_64                                                                                               1/6 
  Verifying  : openssh-clients-7.4p1-16.el7.x86_64                                                                                       2/6 
  Verifying  : openssh-server-7.4p1-16.el7.x86_64                                                                                        3/6 
  Verifying  : openssh-clients-7.4p1-11.el7.x86_64                                                                                       4/6 
  Verifying  : openssh-7.4p1-11.el7.x86_64                                                                                               5/6 
  Verifying  : openssh-server-7.4p1-11.el7.x86_64                                                                                        6/6 

Updated:
  openssh-clients.x86_64 0:7.4p1-16.el7                                                                                                      

Dependency Updated:
  openssh.x86_64 0:7.4p1-16.el7                                     openssh-server.x86_64 0:7.4p1-16.el7                                    

Complete!
[[email protected] ~]$ ssh node3
The authenticity of host ‘node3 (fe80::bfbd:a651:53ba:e59d%ens33)‘ can‘t be established.
ECDSA key fingerprint is SHA256:+l31dPuaqq6XYXQvR7qWBn186HGwB9t+3lh0i+7vDWo.
ECDSA key fingerprint is MD5:92:e4:1f:2f:95:c7:65:a9:10:a5:16:9c:0d:d7:9c:15.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘node3,fe80::bfbd:a651:53ba:e59d%ens33‘ (ECDSA) to the list of known hosts.
Last login: Fri May 10 17:40:47 2019 from 192.168.86.1
[[email protected] ~]$

 

 

 

 

node4

 技术图片

[[email protected] ~]$  mkdir .ssh
[[email protected] ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:P4007EgHcn03gI4wdXr9x6ohEAQTG7CCNZEqNAvDEtw [email protected]
The keys randomart image is:
+---[RSA 2048]----+
|+.=o..=+o ...    |
|+B.E .o= +.. .   |
|=o+ . oo=oo o o  |
|o. .   o.=.. o o |
|.       S =   . o|
|       . B +   o |
|        . * o .  |
|           o o   |
|            .    |
+----[SHA256]-----+
[[email protected] ~]$ 

 

 技术图片

 

 技术图片

[[email protected] .ssh]$ cat id_rsa.pub >> authorized_keys
[[email protected] .ssh]$ ls
authorized_keys  id_rsa  id_rsa.pub
[[email protected] .ssh]$ cd ..
[[email protected] ~]$ chmod 700 .ssh
[[email protected] ~]$  chmod 600 .ssh/*
[[email protected] ~]$ sudo yum -y install openssh-clients
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
base                                                                                                     | 3.6 kB  00:00:00     
extras                                                                                                   | 3.4 kB  00:00:00     
updates                                                                                                  | 3.4 kB  00:00:00     
updates/7/x86_64/primary_db                                                                              | 4.2 MB  00:00:01     
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package openssh-clients.x86_64 0:7.4p1-11.el7 will be updated
---> Package openssh-clients.x86_64 0:7.4p1-16.el7 will be an update
--> Processing Dependency: openssh = 7.4p1-16.el7 for package: openssh-clients-7.4p1-16.el7.x86_64
--> Running transaction check
---> Package openssh.x86_64 0:7.4p1-11.el7 will be updated
--> Processing Dependency: openssh = 7.4p1-11.el7 for package: openssh-server-7.4p1-11.el7.x86_64
---> Package openssh.x86_64 0:7.4p1-16.el7 will be an update
--> Running transaction check
---> Package openssh-server.x86_64 0:7.4p1-11.el7 will be updated
---> Package openssh-server.x86_64 0:7.4p1-16.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================
 Package                             Arch                       Version                          Repository                Size
================================================================================================================================
Updating:
 openssh-clients                     x86_64                     7.4p1-16.el7                     base                     655 k
Updating for dependencies:
 openssh                             x86_64                     7.4p1-16.el7                     base                     510 k
 openssh-server                      x86_64                     7.4p1-16.el7                     base                     458 k

Transaction Summary
================================================================================================================================
Upgrade  1 Package (+2 Dependent packages)

Total size: 1.6 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/openssh-7.4p1-16.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : openssh-7.4p1-16.el7.x86_64                                                                                  1/6 
  Updating   : openssh-clients-7.4p1-16.el7.x86_64                                                                          2/6 
  Updating   : openssh-server-7.4p1-16.el7.x86_64                                                                           3/6 
  Cleanup    : openssh-server-7.4p1-11.el7.x86_64                                                                           4/6 
  Cleanup    : openssh-clients-7.4p1-11.el7.x86_64                                                                          5/6 
  Cleanup    : openssh-7.4p1-11.el7.x86_64                                                                                  6/6 
  Verifying  : openssh-7.4p1-16.el7.x86_64                                                                                  1/6 
  Verifying  : openssh-clients-7.4p1-16.el7.x86_64                                                                          2/6 
  Verifying  : openssh-server-7.4p1-16.el7.x86_64                                                                           3/6 
  Verifying  : openssh-clients-7.4p1-11.el7.x86_64                                                                          4/6 
  Verifying  : openssh-7.4p1-11.el7.x86_64                                                                                  5/6 
  Verifying  : openssh-server-7.4p1-11.el7.x86_64                                                                           6/6 

Updated:
  openssh-clients.x86_64 0:7.4p1-16.el7                                                                                         

Dependency Updated:
  openssh.x86_64 0:7.4p1-16.el7                               openssh-server.x86_64 0:7.4p1-16.el7                              

Complete!
[[email protected] ~]$ ssh node4
The authenticity of host ‘node4 (fe80::38af:ecce:cbe3:7f4b%ens32)‘ can‘t be established.
ECDSA key fingerprint is SHA256:CDJlRxM3LfysC51g+2RIesc/FI2OnTJRQi3w/WnK7jk.
ECDSA key fingerprint is MD5:74:5b:35:fa:fb:fe:31:d5:c4:a0:ff:d0:62:12:3e:d3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘node4,fe80::38af:ecce:cbe3:7f4b%ens32‘ (ECDSA) to the list of known hosts.
Last login: Fri May 10 17:40:49 2019 from 192.168.86.1
[[email protected] ~]$ exit
logout
Connection to node4 closed.
[[email protected] ~]$

 到此为止每台机器的各自本身的无密码访问已经成功设置好了。

 

每台机器之间的无密码访问的设置

完成node2与node1

 技术图片

[[email protected] ~]$ cat ~/.ssh/id_rsa.pub | ssh [email protected] cat >> ~/.ssh/authorized_keys
The authenticity of host node1 (192.168.86.131) cant be established.
ECDSA key fingerprint is SHA256:MgPYAE+6wpwD4f0o7rxojIbSEO1/6CWDDwebvR+m/NA.
ECDSA key fingerprint is MD5:9d:2a:c6:e4:c4:a1:73:42:92:47:a5:f1:9a:eb:2c:58.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added node1,192.168.86.131 (ECDSA) to the list of known hosts.
[email protected]s password: 
[[email protected] ~]$ 

 

 完成node3与node1

技术图片

[[email protected] ~]$ cat ~/.ssh/id_rsa.pub | ssh [email protected] cat >> ~/.ssh/authorized_keys
The authenticity of host node1 (192.168.86.131) cant be established.
ECDSA key fingerprint is SHA256:MgPYAE+6wpwD4f0o7rxojIbSEO1/6CWDDwebvR+m/NA.
ECDSA key fingerprint is MD5:9d:2a:c6:e4:c4:a1:73:42:92:47:a5:f1:9a:eb:2c:58.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added node1,192.168.86.131 (ECDSA) to the list of known hosts.
[email protected]s password: 
[[email protected] ~]$ 

 

 完成node4与node1

 技术图片

[[email protected] ~]$ cat ~/.ssh/id_rsa.pub | ssh [email protected] cat >> ~/.ssh/authorized_keys
The authenticity of host node1 (192.168.86.131) cant be established.
ECDSA key fingerprint is SHA256:MgPYAE+6wpwD4f0o7rxojIbSEO1/6CWDDwebvR+m/NA.
ECDSA key fingerprint is MD5:9d:2a:c6:e4:c4:a1:73:42:92:47:a5:f1:9a:eb:2c:58.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added node1,192.168.86.131 (ECDSA) to the list of known hosts.
[email protected]s password: 
[[email protected] ~]$ 

 

 将node1的authorized_keys分发给node2 node3 node4技术图片

[[email protected] ~]$ cd .ssh
[[email protected] .ssh]$ scp -r authorized_keys [email protected]:~/.ssh/
The authenticity of host node2 (192.168.86.132) cant be established.
ECDSA key fingerprint is SHA256:6mgGUMwozj0Cl6LzCNi250qZGSruWJA7bAktWIEAkDo.
ECDSA key fingerprint is MD5:cc:17:8e:2c:8f:9d:6f:1d:1a:da:ef:20:05:da:1f:2a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added node2,192.168.86.132 (ECDSA) to the list of known hosts.
[email protected]s password: 
authorized_keys                                                                                            100% 1576     1.5MB/s   00:00    
[[email protected] .ssh]$ scp -r authorized_keys [email protected]:~/.ssh/
The authenticity of host node3 (192.168.86.133) cant be established.
ECDSA key fingerprint is SHA256:+l31dPuaqq6XYXQvR7qWBn186HGwB9t+3lh0i+7vDWo.
ECDSA key fingerprint is MD5:92:e4:1f:2f:95:c7:65:a9:10:a5:16:9c:0d:d7:9c:15.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added node3,192.168.86.133 (ECDSA) to the list of known hosts.
[email protected]s password: 
authorized_keys                                                                                            100% 1576     1.6MB/s   00:00    
[[email protected] .ssh]$ scp -r authorized_keys [email protected]:~/.ssh/
The authenticity of host node4 (192.168.86.134) cant be established.
ECDSA key fingerprint is SHA256:CDJlRxM3LfysC51g+2RIesc/FI2OnTJRQi3w/WnK7jk.
ECDSA key fingerprint is MD5:74:5b:35:fa:fb:fe:31:d5:c4:a0:ff:d0:62:12:3e:d3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added node4,192.168.86.134 (ECDSA) to the list of known hosts.
[email protected]s password: 
authorized_keys                                                             

 

 因为我们配置了4台机器之间的免密码登录了,因此我们可以将node1安装好的jdk分发给其他3台机器

技术图片

 技术图片

 技术图片

 

 分别给3台机器配置环境变量(操作都一样)

技术图片

技术图片

#java
export JAVA_HOME=/opt/modules/jdk1.8.0_65
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

 

使环境变量生效

技术图片

3台操作都一样所以就不赘述了!!!

 

hadoop的安装

解压hadoop

技术图片

[[email protected] softwares]$ tar -zxf hadoop-3.1.2.tar.gz -C /opt/modules/
[[email protected] softwares]$ ls
hadoop-2.7.3.tar.gz  hadoop-3.1.2.tar.gz  jdk-8u65-linux-x64.tar.gz
[[email protected] softwares]$ cd ../modules/
[[email protected] modules]$ ls
hadoop-3.1.2  jdk1.8.0_65
[[email protected] modules]$ 

 

 

给hadoop配置环境变量

技术图片

#hadoop
export HADOOP_HOME=/opt/modules/hadoop-3.1.2
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

 

 

使其环境变量生效

技术图片

[[email protected] hadoop-3.1.2]# source /etc/profile
[[email protected] hadoop-3.1.2]# hadoop version
Hadoop 3.1.2
Source code repository https://github.com/apache/hadoop.git -r 1019dde65bcf12e05ef48ac71e84550d589e5d9a
Compiled by sunilg on 2019-01-29T01:39Z
Compiled with protoc 2.5.0
From source with checksum 64b8bdd4ca6e77cce75a93eb09ab2a9
This command was run using /opt/modules/hadoop-3.1.2/share/hadoop/common/hadoop-common-3.1.2.jar
[[email protected] hadoop-3.1.2]# 

 

以上是关于3.Java和hadoop的安装的主要内容,如果未能解决你的问题,请参考以下文章

Hadoop Mapper参数含义

在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途

PHP代码-psysh调试代码片段工具

Hadoop之Linux源代码编译

Android 逆向Android 进程注入工具开发 ( Visual Studio 开发 Android NDK 应用 | Visual Studio 中 SDK 和 NDK 安装位置 )(代码片段

VIM 代码片段插件 ultisnips 使用教程