前言 电脑配置
如果是在个人电脑上学习安装,建议CPU 4核以上,内存:16G,磁盘空间40G以上,如果配置不够跑起来需要较强的等待耐心!
一 Linux 更换软件安装源
配置国内软件安装源
由于国外的Linux软件包源速度比较慢,建议切换成国内的安装源,可以大大提高软件安装的速度。
Ubuntu 18.04 配置
mv /etc/apt/sources.list /etc/apt/source.backup
cat >>/etc/apt/sources.list<<EOF
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF
apt update
CentOS7 配置
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
yum update
二 Docker 安装
Ubuntu 18.04 安装 Docker
sudo apt-get remove docker \
docker-engine \
docker.io
1 安装apt-get系统工具
sudo apt-get update
2 安装允许apt通过HTTPS使用存储库
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
3 安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
4 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
5 更新并安装Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
CentoOS 7 安装Docker
-
卸载旧版本
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
-
安装依赖包
yum install -y yum-utils \ device-mapper-persistent-data \ lvm2
-
Docker 安装源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.安装Docker
安装最新版
yum install -y docker-ce docker-ce-cli containerd.io
安装指定版
yum install -y docker-ce-18.09.0 docker-ce-cli-18.09.0 containerd.io
启动 docker
#开机启动 systemctl enable docker systemctl start docker
三 配置Docker国内镜像源
cat >>/etc/docker/daemon.json<<EOF
{
"registry-mirrors": ["https://yecrg48y.mirror.aliyuncs.com","https://registry.docker-cn.com","http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn/"],"insecure-registries": ["agileone.local:8081","docker.agileone.local:8081"]
}
EOF
sudo systemctl daemon-reload
检查Docker是否安装好
sudo docker version
···