Link

Ubuntu 安装软件

目录

  1. Ubuntu 安装软件
    1. 修改国内源
    2. 安装Docker

修改国内源

#编辑 /etc/apt/sources.list 文件,直接替换成下列内容
deb https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
de

#更新源
apt-get update

或者参考每个国内源的指导手册:

http://mirrors.ustc.edu.cn/help/ubuntu.html

http://mirrors.163.com/.help/ubuntu.html

https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b116cm6hn

安装Docker

#允许 apt 使用 https 连接
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
  
#添加 Docker 官方 gpg key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

#运行下列命令查看是否有 Docker Release (CE deb) <[email protected]>
sudo apt-key fingerprint 0EBFCD88

add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

#更新源
sudo apt-get update
#安装最新版本的 Docker
sudo apt-get install docker-ce docker-ce-cli containerd.io
 

#如果要安装其他版本的docker,可以先用下列命令搜索可以安装的版本
apt-cache madison docker-ce

docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 18.06.1~ce~3-0~ubuntu       | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  docker-ce | 18.06.0~ce~3-0~ubuntu       | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
  ...

#再使用下列命令安装指定版本。
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

#运行 hello-world 测试
sudo docker run hello-world

参考链接:

https://docs.docker.com/install/linux/docker-ce/ubuntu/