Debian 全版本更换镜像源为阿里云镜像源

【注】系统环境是 Debian 9.2.0 ,其他版本也是可以通用的,只是添加的源不同。

1. 查看当前 Debian 镜像源


less /etc/apt/sources.list

文件部分内容:

# deb http://snapshot.debian.org/archive/debian/20200130T000000Z stretch main
deb http://deb.debian.org/debian stretch main
# deb http://snapshot.debian.org/archive/debian-security/20200130T000000Z stretch/updates main
deb http://security.debian.org/debian-security stretch/updates main
# deb http://snapshot.debian.org/archive/debian/20200130T000000Z stretch-updates main
deb http://deb.debian.org/debian stretch-updates main

...

通过查看地址可以看到默认使用的是 Debian 官方镜像源 http://deb.debian.org/debian

2. 备份当前镜像源


cp /etc/apt/sources.list /etc/apt/sources.list.bak

3. 修改当前镜像源

# 需要 root 权限
sudo vim /etc/apt/sources.list

# 打开文件不要做任何操作,直接输入 ggdG 清空文件,注意 G 是大写
ggdG

清空文件后,然后复制下镜像源(根据自己实际的版本):

  • debian 7.x (wheezy)
deb http://mirrors.aliyun.com/debian/ wheezy main non-free contrib
deb http://mirrors.aliyun.com/debian/ wheezy-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ wheezy main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ wheezy-proposed-updates main non-free contrib
  • debian 8.x (jessie)
deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
  • debian 9.x (stretch)
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

4. 更新镜像源

sudo apt-get update

控制台部分输出内容:

Ign:1 http://mirrors.aliyun.com/debian stretch InRelease
Get:2 http://mirrors.aliyun.com/debian-security stretch/updates InRelease [53.0 kB]
Get:3 http://mirrors.aliyun.com/debian stretch-updates InRelease [93.6 kB]
Get:4 http://mirrors.aliyun.com/debian stretch-backports InRelease [91.8 kB]
Get:5 http://mirrors.aliyun.com/debian stretch Release [118 kB]
Get:6 http://mirrors.aliyun.com/debian-security stretch/updates/main Sources [332 kB]
Get:7 http://mirrors.aliyun.com/debian-security stretch/updates/main amd64 Packages [650 kB]
Get:8 http://mirrors.aliyun.com/debian stretch-updates/non-free Sources [816 B]
Get:9 http://mirrors.aliyun.com/debian stretch-updates/main Sources [1456 B]
Get:10 http://mirrors.aliyun.com/debian stretch-updates/main amd64 Packages [2596 B]

...

恭喜替换为阿里云镜像源成功。

个人博客:Roc’s Blog

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Roc.Chang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值