ROOT:Hadoop123
atguigu:atguigu/123456
内存2G,硬盘50G
1. 安装好linux
/boot 200M
/swap 2g
/ 剩余
2. *安装VMTools
3. 关闭防火墙
sudo systemctl stop firewalld
sudo systemctl disable firewalld
4. 设置静态IP,改主机名
编辑vim /etc/sysconfig/network-scripts/ifcfg-eth0(阿里云此处不修改)
改成
=================================
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
NAME="eth0"
IPADDR=192.168.5.101
PREFIX=24
GATEWAY=192.168.5.2
DNS1=192.168.5.2
=================================
编辑vim /etc/sysconfig/network
改HOSTNAME=那一行
5. 配置/etc/hosts增加私网IP,在c盘C:\Windows\System32\drivers\etc中hosts文件中增加公网IP(阿里云服务器)
vim /etc/hosts
=============================
39.101.171.194 172.26.89.117
39.101.177.65 172.26.89.119
39.99.145.17 172.26.89.118
=============================
6. 创建一个一般用户atguigu,给他配置密码
useradd atguigu
passwd atguigu
7. 配置这个用户为/etc/sudoers, sudo vi /etc/sudoers
在root ALL=(ALL) ALL
添加atguigu ALL=(ALL) NOPASSWD:ALL
保存时wq!保存
8. 在/opt目录下创建两个文件夹module和software,并把所有权赋给atguigu
mkdir /opt/module /opt/software
chown atguigu:atguigu /opt/module /opt/software
从这里开始要以一般用户登陆
9. 搞一个分发脚本
cd ~
vim xsync
内容如下:
=================================================================
#!/bin/bash
#1. 判断参数个数
if [ $# -lt 1 ]
then
echo Not Enough Arguement!
exit;
fi
#2. 遍历集群所有机器
for host in hadoop102 hadoop103 hadoop104
do
echo ==================== $host ====================
#3. 遍历所有目录,挨个发送
for file in $@
do
#4 判断文件是否存在
if [ -e $file ]
then
#5. 获取父目录
pdir=$(cd -P $(dirname $file); pwd)
#6. 获取当前文件的名称
fname=$(basename $file)
ssh $host "mkdir -p $pdir"