大数据环境搭建
虚拟机仿真,与物理机设置完全相同
一:系统准备
1,在虚拟机中最小安装CENT OS7系统
视自己电脑内存大小而定:
虚拟机内存设置1G~2G
CPU 1~4核心
硬盘20G~60G
yum install nano : 查看是否安装nano(测试是否有网络)
2,设置虚拟机网络
查看虚拟机网络设置,记录网段和网关
禁用IPV6 编辑 /etc/default/grub
在第6行添加:
ipv6.disable=1(第六行开头添加)
保存
重新加载配置:
grub2-mkconfig -o /boot/grub2/grub.cfg
重启:
reboot
分配静态IP地址,编辑
/etc/sysconfig/network-scripts/ifcfg-网卡名
修改:
BOOTPROTO=static
IPADDR=网段内静态IP
NETMASK=255.255.255.0
GATEWAY=记录的网关地址
DNS1=114.114.114.114
ONBOOT=yes
修改 :/etc/resolv.conf
添加
nameserver 114.114.114.114
129.29.29.29
systemctl restart network #重启网络服务
修改ip 与用户名映射: /etc/hosts
3,实现主机与虚拟机互访
4,添加用户,设置密码
adduser bda
passwd bda
之后reboot用bda登录
5,创建目录/opt下:software, modules, data, tools
更改所有权(root用户权限更改为bda)
sudo chown -R bda:bda /opt/*
sudo chown -R bda:bda ./*
6,如果有,卸载自带的Open-JDK
rpm -qa|grep java
rpm -e --nodeps 各 个 名 字
安装官方JDK
版本根据hadoop版本要求确定,此处用7u67
下载该版本JDK压缩包到 /opt/software
修改权限u+x
sudo chmod u+x 文件名
解压缩到/opt/moduls
tar -zxf 文件名 -C /opt/modules
配置JAVA_HOME
/etc/profile
export JAVA_HOME=/opt/modules/jdk1.7.0_67
export PATH=$PATH:$JAVA_HOME/bin
二,集群准备
1,复制多份虚拟机
分别设置静态IP
/etc/sysconfig/network-scripts/ifcfg-网卡名
机器名
/etc/hostname
彼此添加机器名和IP地址映射
/etc/hosts
实现虚拟机互访
2,实现SSH工具连接
配置sudo免密码
/etc/sudoers
bda ALL=(root)NOPASSWD:ALL
3,关闭防火墙
/etc/sysconfig/selinux
SELINUX=disabled
SELINUXTYPE=targeted
关机命令:
1、halt 立刻关机 2、poweroff 立刻关机 3、shutdown -h now 立刻关机(root用户使用) 4、shutdown -h 10 10分钟后自动关机 如果是通过shutdown命令设置关机的话,可以用shutdown -c命令取消重启
重启命令:
1、reboot 2、shutdown -r now 立刻重启(root用户使用) 3、shutdown -r 10 过10分钟自动重启(root用户使用) 4、shutdown -r 20:35 在时间为20:35时候重启(root用户使用) 如果是通过shutdown命令设置重启的话,可以用shutdown -c命令取消重启
4,安装HADOOP
网址:(很详细)
https://www.cnblogs.com/frankdeng/p/9047698.html
使用“ls -l”命令查看文件的属性为,用户组为()
同时更改文件或目录的所有者和用户组:
chown -R root:root test_dir”(test_dir为文件名称)
注意:想递归更改目录下所有文件的用户属性,请在命令中添加一个“-R”参数
遇到一个编辑错误:
E325: ATTENTION
Found a swap file by the name "/etc/.profile.swp"
owned by: root dated: Sat Jul 14 16:28:48 2018
file name: /etc/profile
modified: YES
modified: YES
user name: root host name: hd1
process ID: 1869
While opening file "/etc/profile"
dated: Sat Jul 14 16:37:56 2018
NEWER than swap file!
(1) Another program may be editing the same file. If this is the c
ase,
be careful not to end up with two different instances of the sa
me
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /etc/profile"
我们按回车进入vi时,出现错误!
在终端输入命令: rm -f /etc/.profile.swp
然后回车,再次进入vi编辑是以前的提示就消失了
(我遇到的是vi /etc/profile,删除etc下的那个配置文件然后正常)