0、创建虚拟机
1、关闭防火墙(CentOS7)
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
2、创建用户名密码(非root)
[root@localhost ~]# useradd atguigu
[root@localhost ~]# passwd atguigu
更改用户 atguigu 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
3、在/opt目录下创建两个文件夹module和software,并把所有权赋给atguigu
[root@localhost ~]# mkdir /opt/software /opt/module
[root@localhost ~]# ll /opt
总用量 0
drwxr-xr-x. 2 root root 6 10月 19 16:14 module
drwxr-xr-x. 2 root root 6 10月 19 16:14 software
[root@localhost ~]# chown atguigu:atguigu /opt/software /opt/module/
[root@localhost ~]# ll /opt
总用量 0
drwxr-xr-x. 2 atguigu atguigu 6 10月 19 16:14 module
drwxr-xr-x. 2 atguigu atguigu 6 10月 19 16:14 software
4、配置这个用户为sudoers
vi /etc/sudoers
root ALL=(ALL) ALL
atguigu ALL=(ALL) NOPASSWD:ALL
4.1 校验,使用atguigu用户执行sudo命令,只要不报错则成功
[root@localhost ~]# su atguigu
[atguigu@localhost root]$ sudo ls
anaconda-ks.cfg
5、(root用户)配置/etc/hosts
vi /etc/hosts
192.168.37.100 hadoop100
192.168.37.101 hadoop101
192.168.37.102 hadoop102
192.168.37.103 hadoop103
192.168.37.104 hadoop104
192.168.37.105 hadoop105
192.168.37.106 hadoop106
192.168.37.107 hadoop107
192.168.37.108 hadoop108
192.168.37.109 hadoop109
6、修改静态ip
vi /etc/sysconfig/network-scripts/ifcfg-ens33
# **删除配置文件中的UUID那一行**
# ip地址(查看ip命令:ip addr)
IPADDR=192.168.37.100
GATEWAY=192.168.37.2
DNS1=192.168.37.2
# 子网掩码是位数表示法(C类ip为24,相当于255.255.255.0)
PREFIX=24
# ip属性(static:静态;DHCP:动态;none:无)
BOOTPROTO=static```
# 系统启动时是否激活网卡,必须有
ONBOOT=yes
7、改主机名
[root@localhost atguigu]# hostnamectl set-hostname hadoop100
[root@localhost atguigu]# hostnamectl
Static hostname: hadoop100
Icon name: computer-vm
Chassis: vm
Machine ID: 0a9ad40640d9445b834ab6ea1c83963e
Boot ID: cc00fd9e79924cdead6db188f3019033
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-957.el7.x86_64
Architecture: x86-64
8、关机,快照,克隆
打开新克隆的虚拟机,执行第6、 7步(注意对应hosts文件)
9、安装jdk,hadoop
[atguigu@hadoop101 ~]$ cd /opt/software/
[atguigu@hadoop101 software]$ ll
总用量 374196
-rw-rw-r--. 1 atguigu atguigu 197657687 10月 19 23:25 hadoop-2.7.2.tar.gz
-rw-rw-r--. 1 atguigu atguigu 185515842 10月 19 23:25 jdk-8u144-linux-x64.tar.gz
[atguigu@hadoop101 software]$ tar -zxvf jdk-8u144-linux-x64.tar.gz -C /opt/module
[atguigu@hadoop101 software]$ tar zxf hadoop-2.7.2.tar.gz -C /opt/module/
... 略 ...
[atguigu@hadoop101 software]$ cd ../module/
[atguigu@hadoop101 module]$ ll
总用量 0
drwxr-xr-x. 9 atguigu atguigu 149 5月 22 2017 hadoop-2.7.2
drwxr-xr-x. 8 atguigu atguigu 255 7月 22 2017 jdk1.8.0_144
9.1 配置环境变量
[atguigu@hadoop101 jdk1.8.0_144]$ sudo vi /etc/profile
文件末添加
# JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_144
export PATH=$PATH:$JAVA_HOME/bin
# HADOOP_HOME
export HADOOP_HOME=/opt/module/hadoop-2.7.2
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
验证
[atguigu@hadoop101 jdk1.8.0_144]$ source /etc/profile
[atguigu@hadoop101 jdk1.8.0_144]$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
[atguigu@hadoop101 hadoop-2.7.2]$ hadoop version
Hadoop 2.7.2
Subversion Unknown -r Unknown
Compiled by root on 2017-05-22T10:49Z
Compiled with protoc 2.5.0
From source with checksum d0fda26633fa762bff87ec759ebe689c
This command was run using /opt/module/hadoop-2.7.2/share/hadoop/common/hadoop-common-2.7.2.jar
网友评论