CentOS-7-x86_64-DVD-1908.iso
VMware-workstation-full-15.1.0-13591040.exe
FileZilla_3.43.0_win64_sponsored-setup.exe
jdk1.8.0_171
hadoop-2.7.3
scala-2.12.1
spark-2.3.0-bin-hadoop2.7
[root@localhost ~]# hostnamectl set-hostname hadoop1
[root@localhost ~]# hostnamectl
Static hostname: hadoop1
Icon name: computer-vm
Chassis: vm
Machine ID: a34d80dce9364980962f9d85ffb5e9c8
Boot ID: d624e2a84dc34619bfa2fe90e88eb058
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-862.11.6.el7.x86_64
Architecture: x86-64
[root@localhost ~]# hostnamectl --static
hadoop1
• 本次用hadoop用户部署,需要添加hadoop用户,密码也设置为hadoop。
[root@hadoop1 ~]# sudo useradd -m hadoop -s /bin/bash
[root@hadoop1 ~]# sudo passwd hadoop
• 登陆
[root@hadoop1 ~]# ssh hadoop@hadoop1
#输入密码登陆成功
• 设置超级管理员权限
切换root
[root@hadoop1 hadoop]# vim /etc/sudoers
在root下增加:hadoop ALL=(ALL) ALL
• 注意:这里免密登陆指的是hadoop账户登陆的hadoop1,再ssh hadoop@hadoop1。
[hadoop@hadoop1 ~]$ ssh-keygen -t rsa # 三次回车
[hadoop@hadoop1 ~]$ ssh-copy-id hadoop@hadoop1 # 输入密码
[root@hadoop1 ~]# vim /etc/hosts
在第一行添加: 本机IP hadoop1 的映射,如下:
172.16.142.131 hadoop1
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[hadoop@hadoop1 ~]$ ssh hadoop@hadoop1
Last login: Wed Apr 15 09:31:24 2020 from hadoop1
• 本次安装的是JDK1.8,具体版本为jdk-8u171-linux-x64.tar.gz,手动安装。
• 备注:
在无网络情况下,可以直接使用FileZilla将jdk文件传送到目录/usr/local/下
[root@hadoop1 ~]# wget https://dl.cactifans.com/jdk/jdk-8u101-linux-x64.tar.gz
[root@hadoop1 ~]# tar -zxvf jdk-8u101-linux-x64.tar.gz -C /usr/local/
• 编辑/etc/profile
[root@hadoop1 ~]# vim /etc/profile
添加如下内容:
export JAVA_HOME=/usr/local/jdk1.8.0_171
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
• 使配置立即生效
[root@hadoop1 ~]# source /etc/profile
[root@hadoop1 ~]# java -version
openjdk version "1.8.0_222-ea"
OpenJDK Runtime Environment (build 1.8.0_222-ea-b03)
OpenJDK 64-Bit Server VM (build 25.222-b03, mixed mode)