Linux软件安装与基本设置

版本:Ubuntu 20.04.6

Linux基本设置

点击查看代码
sudo apt-get autoremove open-vm-tools
sudo apt-get install open-vm-tools-desktop
reboot

Linux软件安装

Docker

删除docker


彻底删除

卸载 Docker Engine、CLI、containerd 和 Docker Compose 软件包
点击查看代码
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
删除所有镜像、容器和卷
点击查看代码
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

只卸载旧版本

点击查看代码
sudo apt-get remove docker docker-engine docker.io containerd runc

安装docker

快速脚本安装

适用开发、测试环境,默认安装最新稳定版本

安装curl命令

点击查看代码
sudo apt-get install curl

安装docker

点击查看代码
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

查看docker版本

点击查看代码
docker version

2. 手动安装

设置仓库

点击查看代码
// 更新 apt 包索引
sudo apt-get update
// 安装 apt 依赖包,用于通过HTTPS来获取仓库
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
// 添加 Docker 的官方 GPG 密钥
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
// 设置稳定版仓库
sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
  $(lsb_release -cs) \
  stable"
可更换其他镜像源

华为:https://mirrors.huaweicloud.com
清华:https://mirrors.tuna.tsinghua.edu.cn
阿里云:https://mirrors.aliyun.com
网易:https://mirrors.163.com
中科大:https://mirrors.ustc.edu.cn

安装 Docker Engine-Community

1. 安装最新版本的Docker
点击查看代码
sudo apt-get install docker-ce docker-ce-cli containerd.io
2. 输入helloworld测试
点击查看代码
sudo docker run hello-world

安装特定版本docker(可选)
点击查看代码
sudo apt-get install docker-ce=<5:20.10.13 ~ 3-0~ubuntu-jammy> docker-ce-cli=<5:20.10.13 ~ 3-0~ubuntu-jammy> containerd.io
docker的启动、关闭和重启
点击查看代码
// 重启
sudo systemctl restart docker
// 关闭
sudo systemctl enable docker
// 启动
sudo systemctl start docker
posted @ 2024-03-25 11:46  深木  阅读(37)  评论(0)    收藏  举报