侧边栏壁纸
博主头像
★街角晚灯★博主等级

博观而约取 厚积而薄发

  • 累计撰写 446 篇文章
  • 累计创建 182 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

Debian 10/11更换国内镜像源|Debian换源|换源

WinJay
2023-08-16 / 0 评论 / 0 点赞 / 158 阅读 / 4032 字 / 正在检测是否收录...
温馨提示:
文章发布较早,内容可能过时,阅读注意甄别。。。。

Debian 10/11更换国内镜像源|Debian换源|换源

Linux Ubuntu换源 Debian换源 更新源 Echo换源 sed 换源 Docker Ubuntu换源 Docker Debian换源

Debian 10/11更换国内源,解决系统无法更新和软件无法安装问题;同样适用于容器镜像

img

Debian 默认官方源站节点在境外,导致了更新失败,尤其实在晚上,基本上无法更新,解决这个问题我们只要通过简单的三步更换国内源即可,163网易云、阿里云、清华同方和中国科技大学等源任君选择。

备份现有源

sudo cp /etc/apt/sources.list /etc/apt/sources.list_bak

image-20230128155301913

修改替换国内源

一般情况下,将 /etc/apt/sources.list 文件中 Debian 默认的源地址 http://deb.debian.org/ 替换为国内源即可。

以下国内源选择一个替换即可,个人一般比较喜欢使用阿里的镜像源站。

#中国科技大学
sudo sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
#163网易云
sudo sed -i 's/deb.debian.org/mirrors.163.com/g' /etc/apt/sources.list
#阿里云
sudo sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
#清华同方
sudo sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
  • 推荐使用方式
cat <<EOF> /etc/apt/sources.list
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

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

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

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

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

image-20230128155442486

RUN echo 'deb http://mirrors.163.com/debian/ buster main non-free contrib\\r\\ndeb http://mirrors.163.com/debian/ buster-updates main non-free contrib\\r\\ndeb http://mirrors.163.com/debian/ buster-backports main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian/ buster main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib\\r\\ndeb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\\r\\ndeb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\\r\\n' > /etc/apt/sources.list && apt-get update -y && apt-get upgrade -y
deb http://mirrors.163.com/debian/ buster main non-free contrib
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ buster main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

更新索引以生效

sudo apt-get update

image-20230128155521889

0

评论区