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

短命女 2022-11-19 07:43 3730阅读 0赞

目录

    1. 查看当前 Debian 镜像源
    1. 备份当前镜像源
    1. 修改当前镜像源
    1. 更新镜像源

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

  • 阿里云官方镜像站
  • 阿里云 Debian 官方镜像站

1. 查看当前 Debian 镜像源

  1. less /etc/apt/sources.list

文件部分内容:

  1. # deb http://snapshot.debian.org/archive/debian/20200130T000000Z stretch main
  2. deb http://deb.debian.org/debian stretch main
  3. # deb http://snapshot.debian.org/archive/debian-security/20200130T000000Z stretch/updates main
  4. deb http://security.debian.org/debian-security stretch/updates main
  5. # deb http://snapshot.debian.org/archive/debian/20200130T000000Z stretch-updates main
  6. deb http://deb.debian.org/debian stretch-updates main
  7. ...

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

2. 备份当前镜像源

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

3. 修改当前镜像源

  1. # 需要 root 权限
  2. sudo vim /etc/apt/sources.list
  3. # 打开文件不要做任何操作,直接输入 ggdG 清空文件,注意 G 是大写
  4. 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. 更新镜像源

  1. sudo apt-get update

控制台部分输出内容:

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

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

个人博客:Roc’s Blog

发表评论

表情:
评论列表 (有 0 条评论,3730人围观)

还没有评论,来说两句吧...

相关阅读