使用Docker安装Spark集群(带有HDFS)

本实验在CentOS 7中完成

第一部分:安装Docker

这一部分是安装Docker,如果机器中已经安装过Docker,可以直接跳过

[root@VM-48-22-centos ~]# systemctl stop firewalld
[root@VM-48-22-centos ~]# systemctl disable firewalld
[root@VM-48-22-centos ~]# systemctl status firewalld
[root@VM-48-22-centos ~]# setenforce 0
[root@VM-48-22-centos ~]# getenforce
[root@VM-48-22-centos ~]# yum -y update
[root@VM-48-22-centos ~]# mkdir /etc/yum.repos.d/oldrepo
[root@VM-48-22-centos ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/oldrepo/
[root@VM-48-22-centos ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@VM-48-22-centos ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@VM-48-6-centos ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@VM-48-22-centos ~]# yum clean all
[root@VM-48-22-centos ~]# yum makecache fast
[root@VM-48-22-centos ~]# yum list docker-ce --showduplicates | sort -r
[root@VM-48-22-centos ~]# yum -y install docker-ce
[root@VM-48-22-centos ~]# systemctl start docker
[root@VM-48-22-centos ~]# systemctl enable docker
[root@VM-48-22-centos ~]# ps -ef | grep docker
[root@VM-48-22-centos ~]# docker version

到这一步能正常输出docker版本,说明docker已经成功安装。

为了后续拉取镜像能更快,需要添加一个镜像:

[root@VM-48-22-centos ~]# vi /etc/docker/daemon.json
 {
   
  "registry-mirrors": ["https://x3n9jrcg.mirror.aliyuncs.com"]
 }

重启docker。
后续需要用git拉取一些资源,所以要安装git,同样为了能够正常访问github,需要修改一下hosts文件。

[root@VM-48-22-centos ~]# systemctl daemon-reload
[root@VM-48-22-centos ~]# systemctl restart docker
[root@VM-48-22-centos ~]# yum -y install git
[root@VM-48-22-centos ~]# vi /etc/hosts

添加以下内容:

192.30.255.112  github.com git 

第二部分:安装Docker-Compose

这一部分是安装Docker-Compose,如果已经安装过,可以直接跳过。

[root@VM-48-6-centos ~]# curl -L https://get.daocloud.io/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   423  100<
  • 2
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值