新建虚拟机,参考之前的文档《VM安装CentOS6.5》,完成网络配置。
![2a6bc8b9b1108ecdd5a737c92f6090e8.png](https://img-blog.csdnimg.cn/img_convert/2a6bc8b9b1108ecdd5a737c92f6090e8.png)
远程工具连接
![be465114342fcf292397d5d5b9132082.png](https://img-blog.csdnimg.cn/img_convert/be465114342fcf292397d5d5b9132082.png)
关闭Selinux
![cfd393af14ba55361df0e0fc09a07d4d.png](https://img-blog.csdnimg.cn/img_convert/cfd393af14ba55361df0e0fc09a07d4d.png)
关闭防火墙
chkconfig iptables off
![a805ce928438296cfdd88493a32b822f.png](https://img-blog.csdnimg.cn/img_convert/a805ce928438296cfdd88493a32b822f.png)
修改主机名
第一个network,修改后,将主机命名为masterhbase
NETWORKING=yes
#HOSTNAME=localhost.localdomain
HOSTNAME=masterhbase
![8f84b702ec24c142dc20a9ab8ae84b38.png](https://img-blog.csdnimg.cn/img_convert/8f84b702ec24c142dc20a9ab8ae84b38.png)
修改hosts
10.0.200.168 masterhbase
![850b437c751a2cbdf4d78e70bc4600df.png](https://img-blog.csdnimg.cn/img_convert/850b437c751a2cbdf4d78e70bc4600df.png)
重启机器,让配置生效
配置yum源
上传文件
![7c648c334ae464f4e094517bbc8ff754.png](https://img-blog.csdnimg.cn/img_convert/7c648c334ae464f4e094517bbc8ff754.png)
删除原先的镜像
![8a593a260001583e056d26c00222d2e4.png](https://img-blog.csdnimg.cn/img_convert/8a593a260001583e056d26c00222d2e4.png)
清空之前配置,执行下面的语句
yum clean all
yum repolist
![f5c87d4473d91684ef9908a1614269f2.png](https://img-blog.csdnimg.cn/img_convert/f5c87d4473d91684ef9908a1614269f2.png)
安装一些工具,一做测试,二方便后面使用
yum install -y vim
yum install -y lrzsz
![aca84ea1dff18377b4be130038df1b39.png](https://img-blog.csdnimg.cn/img_convert/aca84ea1dff18377b4be130038df1b39.png)
![78c9531bac73f285537ca03e1d4814f9.png](https://img-blog.csdnimg.cn/img_convert/78c9531bac73f285537ca03e1d4814f9.png)
准备一个放置软件包的目录
![a495cb966602430a53c27dff4f503a3a.png](https://img-blog.csdnimg.cn/img_convert/a495cb966602430a53c27dff4f503a3a.png)
上传jdk安装包
![5b22ee990596aa28d2b585603677e1be.png](https://img-blog.csdnimg.cn/img_convert/5b22ee990596aa28d2b585603677e1be.png)
解压安装JDK
创建安装目录
mkdir -p /opt/bigdata
![19f779fcae971df3bb946efa395d2309.png](https://img-blog.csdnimg.cn/img_convert/19f779fcae971df3bb946efa395d2309.png)
tar -zxvf jdk1.8.tar.gz -C /opt/bigdata/
![b59fedf58a2a8a99f734dbf467742646.png](https://img-blog.csdnimg.cn/img_convert/b59fedf58a2a8a99f734dbf467742646.png)
这是安装目录
/opt/bigdata/jdk1.8
![0cb5cb1687114bb4cea3ba91d0e87cd5.png](https://img-blog.csdnimg.cn/img_convert/0cb5cb1687114bb4cea3ba91d0e87cd5.png)
配置环境变量
编辑文件vim /etc/profile
编辑内容
#set java environment
JAVA_HOME=/opt/bigdata/jdk1.8
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME CLASSPATH PATH
![9ca15e6fdd45ed1fdbc0fa6aed5ac5da.png](https://img-blog.csdnimg.cn/img_convert/9ca15e6fdd45ed1fdbc0fa6aed5ac5da.png)
配置生效
source /etc/profile
![0ce3b5ee5ed9e35ef4430db89cc223bc.png](https://img-blog.csdnimg.cn/img_convert/0ce3b5ee5ed9e35ef4430db89cc223bc.png)
查看配置效果
java –version
javac
![9ed21be93511f2a55ee1943fafd6a0ab.png](https://img-blog.csdnimg.cn/img_convert/9ed21be93511f2a55ee1943fafd6a0ab.png)
克隆节点
先关机
![a7c8cdb765138f1f8348a1af7e06d688.png](https://img-blog.csdnimg.cn/img_convert/a7c8cdb765138f1f8348a1af7e06d688.png)
开始克隆
![ae65409897ae68eba53b38c937604f74.png](https://img-blog.csdnimg.cn/img_convert/ae65409897ae68eba53b38c937604f74.png)
![a2161bb8d1dcdd68056e3779d16fca76.png](https://img-blog.csdnimg.cn/img_convert/a2161bb8d1dcdd68056e3779d16fca76.png)
![0b63cd3c12e4c04f308fd2527d31184b.png](https://img-blog.csdnimg.cn/img_convert/0b63cd3c12e4c04f308fd2527d31184b.png)
![c93aaa476199cab31ab477aa6f6ccabf.png](https://img-blog.csdnimg.cn/img_convert/c93aaa476199cab31ab477aa6f6ccabf.png)
![f680368a70718c4a4c403d2075d093b9.png](https://img-blog.csdnimg.cn/img_convert/f680368a70718c4a4c403d2075d093b9.png)
![67e93005b4c9425f06eab9e000d61531.png](https://img-blog.csdnimg.cn/img_convert/67e93005b4c9425f06eab9e000d61531.png)
![37df60b687f3c2cdd8153904a622639c.png](https://img-blog.csdnimg.cn/img_convert/37df60b687f3c2cdd8153904a622639c.png)
完成后,开启机器,更改IP、主机名和hosts文件
![1b76ca6676cba8e98a7a5e968f28e968.png](https://img-blog.csdnimg.cn/img_convert/1b76ca6676cba8e98a7a5e968f28e968.png)
先修改一个地方
vi /etc/udev/rules.d/70-persistent-net.rules
![689921fb7c737dc1fa1c0da7e1319a18.png](https://img-blog.csdnimg.cn/img_convert/689921fb7c737dc1fa1c0da7e1319a18.png)
修改IP
![fc4c8344432f72c3a54134b3579aa990.png](https://img-blog.csdnimg.cn/img_convert/fc4c8344432f72c3a54134b3579aa990.png)
修改主机名
![19488482280905dce68be428057a65ba.png](https://img-blog.csdnimg.cn/img_convert/19488482280905dce68be428057a65ba.png)
修改hosts文件
![ff6e7c20cc0aeffe1f3dbf7baa1af4c4.png](https://img-blog.csdnimg.cn/img_convert/ff6e7c20cc0aeffe1f3dbf7baa1af4c4.png)
重启虚拟机,用远程工具连接
![e64427f029a37afd9cbe1ad47515dedd.png](https://img-blog.csdnimg.cn/img_convert/e64427f029a37afd9cbe1ad47515dedd.png)
再克隆一个节点
![fb8cf7f9286d6a9ec5fec4c10550ac6b.png](https://img-blog.csdnimg.cn/img_convert/fb8cf7f9286d6a9ec5fec4c10550ac6b.png)
一共三个节点
![0ffb86b7f01b988dfc9df7e84f9d10df.png](https://img-blog.csdnimg.cn/img_convert/0ffb86b7f01b988dfc9df7e84f9d10df.png)
三个节点的分配
![db733fd52d981b03e452fb1a82526f03.png](https://img-blog.csdnimg.cn/img_convert/db733fd52d981b03e452fb1a82526f03.png)
免密配置
三台节点生成密钥
ssh-keygen -t rsa(一直回车)
![82aedc3d70c8e46540bfdec94200ba4b.png](https://img-blog.csdnimg.cn/img_convert/82aedc3d70c8e46540bfdec94200ba4b.png)
进入目录查看
![1d2dad1f7d5019df2b05bc1cb85315c4.png](https://img-blog.csdnimg.cn/img_convert/1d2dad1f7d5019df2b05bc1cb85315c4.png)
三个节点上添加新工具
yum install -y openssh-clients
![589104d7d4f32392fd9c91759dac2feb.png](https://img-blog.csdnimg.cn/img_convert/589104d7d4f32392fd9c91759dac2feb.png)
在三台机器上,hosts文件配置
10.0.200.168 masterhbase
10.0.200.169 masterslave1
10.0.200.170 masterslave2
![55c2ee3d88ba0775b3ee8ae3983268b0.png](https://img-blog.csdnimg.cn/img_convert/55c2ee3d88ba0775b3ee8ae3983268b0.png)
在三个节点上.ssh目录中执行下面一段话,将公钥拷贝到另外两个节点中
ssh-copy-id -i id_rsa.pub root@masterhbase
ssh-copy-id -i id_rsa.pub root@masterslave1
ssh-copy-id -i id_rsa.pub root@masterslave2
![ea534bf55f199c1ed357416d77caf864.png](https://img-blog.csdnimg.cn/img_convert/ea534bf55f199c1ed357416d77caf864.png)
测试登录三个节点,可以发现都不用再输入密码(有的可能需要再输入一次就可以了)
ssh masterhbase
ssh masterslave1
ssh masterslave2
exit是退出
![fde5e76c4702c63dd45bd563d80521d6.png](https://img-blog.csdnimg.cn/img_convert/fde5e76c4702c63dd45bd563d80521d6.png)
到此为止
关闭防火墙和selinux,YUM源已安装好、系统版本CentOS6.5、java版本是1.8,三台节点,免密已配置完成。