【FATE】FATE 单机部署全流程(使用Docker镜像安装FATE )

Docker 容器

注意:Linux 服务器上安装 Docker 需要 root 权限,安装完成之后可以设置 Docker 组用户访问 Docker 的权限。

docker 18.09 -> 19.03sy

官方文档:https://docs.docker.com/engine/install/ubuntu/

1,查看本地是否有安装过旧版 Docker
$ docker --version

2,卸载旧版本的 Docker

$ sudo apt-get remove docker docker-engine docker.io containerd runc

3,Install using the repository
有两种安装方式,这里使用官方推荐的方式,使用 Docker 仓库进行安装

4,Set up the repository
Update the apt package index

$ sudo apt-get update

install packages to allow apt to use a repository over HTTPS

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Add Docker’s official GPG key

 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

验证是否拥有带指纹的密钥(参考这里,好像已经失效了,先码着)

$ sudo apt-key fingerprint

set up the stable repository

 echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

5,Install Docker Engine
Update the apt package index
$ sudo apt-get update

install a specific version of Docker Engine and containerd

a,List the version available in your repo:
$ apt-cache madison docker-ce

 docker-ce | 5:20.10.7~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.6~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.5~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.4~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.3~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.2~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.1~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.0~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.15~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.14~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.13~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.12~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.11~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.10~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.9~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages

b,这里没有需要的18.09版本,先添加阿里云的docker GPG密钥

$ curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
> OK

c,添加阿里镜像源

$ sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

d,再次查看版本列表
$ apt-cache madison docker-ce

e,这个时候还是没有的话,直接安装,把<VERSION_STRING>中的版本号手动更改一下试试(再不行就安装现有版本吧..)

$ sudo apt-get install docker-ce=5:19.03.9~3-0~ubuntu-focal docker-ce-cli=5:19.03.9~3-0~ubuntu-focal containerd.io

f,Verify that Docker Engine is installed correctly by running the hello-world image

$ sudo docker run hello-world
> Hello from Docker!
> This message shows that your installation appears to be working correctly.

6,allow non-privileged users to run Docker commands

Create the docker group
$ sudo groupadd docker

Add your user to the docker group ($USER 替换为用户名)
$ sudo usermod -aG docker $USER

activate the changes to groups
$ newgrp docker

Verify that you can run docker commands without sudo
$ docker run hello-world

(可选)7,阿里云镜像加速

a,阿里云镜像地址:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors

b,登录账号,获取加速器地址

c,配置加速器

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["加速器地址"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

docker-compose 1.24.0

官方文档:https://docs.docker.com/compose/install/

download the current stable release of Docker Compose (替换相应的版本号)

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Apply executable permissions to the binary

$ sudo chmod +x /usr/local/bin/docker-compose

Test the installation
$ docker-compose --version

配置开发环境和依赖库(略)

JDK 1.8+
Python 3.6
Python virtualenv
MySQL 5.6+
Redis 5.0.2
...

安装 FATE

官方文档:https://github.com/FederatedAI/FATE/blob/master/standalone-deploy/doc/Fate-standalone_deployment_guide_zh.md
注意:安装FATE之前可以切换环境

1,查询端口号8080,9360,9380是否被占用
sudo netstat -nultp | grep 9360

2,获取和解压安装包(fate.env 查询 version)

$ wget https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/docker_standalone_fate_1.6.0.tar.gz
$ tar -xzvf docker_standalone_fate_1.6.0.tar.gz

3,切换文件夹并执行部署

$ cd docker_standalone_fate_1.6.0
$ bash install_standalone_docker.sh

4,验证和单元测试

$ CONTAINER_ID=`docker ps -aqf "name=fate"`
$ docker exec -t -i ${CONTAINER_ID} bash
$ bash ./python/federatedml/test/run_test.sh
> ...
> there are 0 failed test

5,Toy测试

$ python ./examples/toy_example/run_toy_example.py 10000 10000 0
> ...
> success to calculate secure_sum, it is 1999.9999999999998

6,安装 FATE-Client 和 FATE-Test

$ pip install fate-client
$ pip install fate-test

7,使用 FATE Board
a,规则与jupyter notebook相同那个,localhost:8080,使用PuTTy的隧道,并在本地浏览器打开即可
b,在fate#下进入examples/ federatedml-1.x-examples/,执行python quick_run.py,查看 FATE Board进度

posted @ 2021-07-17 22:15  林東雨  阅读(2704)  评论(0编辑  收藏  举报