centos7 hadoop3.x虚拟机配置
su rootvi /etc/sysconfig/network-scripts/ifcfg-ens33vi /etc/hostnamehadoop100vi /etc/hostCentos 7最小化系统安装设置IP(ifconfig命令)https://www.cnblogs.com/karen-ran/p/9497118.html
NAT设置网关
su root
vi /etc/sysconfig/network-scripts/ifcfg-ens33
vi /etc/hostname
hadoop100
vi /etc/host
ping 下网关检查配置
ping 192.168.10.2
ping www.baidu.com
win10hosts
C:\WINDOWS\system32\drivers\etc
最小软件版安装
软件库
yum install -y epel-release
inconfig
yum install -y net-tools
关闭防火墙
关闭防火墙,关闭防火墙开机自启
[root@hadoop100 ~]# systemctl stop firewalld
[root@hadoop100 ~]# systemctl disable firewalld.service
添加用户
[root@hadoop100 ~]# useradd wei
[root@hadoop100 ~]# passwd 000000
配置sudo
修改/etc/sudoers文件,在%wheel这行下面添加一行,如下所示:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
## Allows people in group wheel to run all commands
卸载JDK
注意:如果你的虚拟机是最小化安装不需要执行这一步。
[root@hadoop100 ~]# rpm -qa | grep -i java | xargs -n1 rpm -e --nodeps
rpm -qa:查询所安装的所有rpm软件包
grep -i:忽略大小写
xargs -n1:表示每次只传递一个参数
rpm -e –nodeps:强制卸载软件
安装JDK
Linux的环境变量
Linux的环境变量可在多个文件中配置,如/etc/profile,/etc/profile.d/*.sh,/.bashrc,/.bash_profile等,下面说明上述几个文件之间的关系和区别。
bash的运行模式可分为login shell和non-login shell。
例如,我们通过终端,输入用户名、密码,登录系统之后,得到就是一个login shell。而当我们执行以下命令ssh hadoop103 command,在hadoop103执行command的就是一个non-login shell。
利用VM克隆虚拟机
vim /etc/hostname
vi /etc/sysconfig/network-scripts/ifcfg-ens33
修改IP
reboot
安装同步脚本
sudo yum install rsync
①在用的家目录/home/wei下创建bin文件夹
创建xsync文件,以便全局调用
在该文件中编写如下代码
#!/bin/bash
#1. 判断参数个数
if [ $# -lt 1 ]
then
echo Not Enough Arguement!
exit;
fi
#2. 遍历集群所有机器
for host in hadoop100 hadoop101
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"
rsync -av $pdir/$fname $host:$pdir
else
echo $file does not exists!
fi
done
done
③修改脚本xsync具有执行权限
chmod +x xsync
④测试脚本
xsync xsync
配置shh免密
(1)hadoop102上生成公钥和私钥:
ssh-keygen -t rsa
然后敲(三个回车),就会生成两个文件id_rsa(私钥)、id_rsa.pub(公钥)
(2)将hadoop102公钥拷贝到要免密登录的目标机器上
ssh-copy-id hadoop102
ssh-copy-id hadoop103
ssh-copy-id hadoop104
(3)hadoop103上生成公钥和私钥:
ssh-keygen -t rsa
然后敲(三个回车),就会生成两个文件id_rsa(私钥)、id_rsa.pub(公钥)
(4)将hadoop103公钥拷贝到要免密登录的目标机器上
ssh-copy-id hadoop102
ssh-copy-id hadoop103
ssh-copy-id hadoop104
更多推荐
所有评论(0)