51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

ubunt apt-get updtae 很慢 解决方案

RUN apt-get -y update

非常慢

首先就是要更换源:

1- 4、Ubuntu20:10版本更新源

下面的方法,针对是Ubuntu20:10版本

无论你是用Dockerfile还是直接在容器里更新源,
最核心的是更新/etc/apt/source.list文件

可以将下面的语句写到Dockerfile中或者直接在容器里更新

echo "deb http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ groovy main restricted universe multiverse" > sources.list
echo "deb http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ groovy-security main restricted universe multiverse" >> sources.list
echo "deb http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ groovy-updates main restricted universe multiverse" >> sources.list
echo "deb http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ groovy-backports main restricted universe multiverse" >> sources.list

造成此种现象的主要原因是
ubuntu20.10不是LTS长期支持版本,因此现在很多镜像网站中已经去掉了对20.10的支持。

5.2、Ubuntu22.04系统

5.2.1、更新为 阿里源
先清空sources.list里的旧内容

先清空sources.list里的旧内容

echo "" > /etc/apt/sources.list

增加新的阿里源内容
vim /etc/apt/sources.list

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

deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse

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

# deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

5.3、Ubuntu20.04
5.3.1、更新为 阿里源
先清空sources.list里的旧内容

增加新的阿里源内容
vim /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

5.4、Ubuntu18.04
5.4.1、更新为 阿里源
先清空sources.list里的旧内容

增加新的阿里源内容
vim /etc/apt/sources.list

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

5.5、Ubuntu16.04
5.5.1、更新为 阿里源
先清空sources.list里的旧内容

echo "" > /etc/apt/sources.list

增加新的阿里源内容
vim /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
赞(1)
未经允许不得转载:工具盒子 » ubunt apt-get updtae 很慢 解决方案