各种更换国内软件源

自己也是经常用到,便记录下来,方便好找。建议加入书签,方便使用

如需转载本文,请在开头或结尾显眼处标明本文链接。谢谢。

apt(Debian/Ubuntu)

下载或者复制对应的源,覆盖/etc/apt/sources.list即可(注意备份)

Debian

163源

debian10(buster)

  1. deb http://mirrors.163.com/debian/ buster main non-free contrib
  2. deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
  3. deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
  4. deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
  5. debsrc http://mirrors.163.com/debian/ buster main non-free contrib
  6. debsrc http://mirrors.163.com/debian/ buster-updates main non-free contrib
  7. debsrc http://mirrors.163.com/debian/ buster-backports main non-free contrib
  8. debsrc http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

debian 9.x (stretch)
http://mirrors.163.com/.help/sources.list.stretch

  1. deb http://mirrors.163.com/debian/ stretch main non-free contrib
  2. deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
  3. deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
  4. deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
  5. debsrc http://mirrors.163.com/debian/ stretch main non-free contrib
  6. debsrc http://mirrors.163.com/debian/ stretch-updates main non-free contrib
  7. debsrc http://mirrors.163.com/debian/ stretch-backports main non-free contrib
  8. debsrc http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib

debian 8.x (jessie)
http://mirrors.163.com/.help/sources.list.jessie

  1. deb http://mirrors.163.com/debian/ jessie main non-free contrib
  2. deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
  3. deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
  4. deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
  5. debsrc http://mirrors.163.com/debian/ jessie main non-free contrib
  6. debsrc http://mirrors.163.com/debian/ jessie-updates main non-free contrib
  7. debsrc http://mirrors.163.com/debian/ jessie-backports main non-free contrib
  8. debsrc http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib

debian 7.x (wheezy)

  1. deb http://mirrors.163.com/debian-archive/debian/ wheezy main non-free contrib
  2. deb http://mirrors.163.com/debian-archive/debian/ wheezy-updates main non-free contrib
  3. deb http://mirrors.163.com/debian-archive/debian/ wheezy-backports main non-free contrib
  4. debsrc http://mirrors.163.com/debian-archive/debian-security/ wheezy/updates main non-free contrib
  5.  
  6. debsrc http://mirrors.163.com/debian-archive/debian/ wheezy main non-free contrib
  7. debsrc http://mirrors.163.com/debian-archive/debian/ wheezy-updates main non-free contrib
  8. debsrc http://mirrors.163.com/debian-archive/debian/ wheezy-backports main non-free contrib
  9. debsrc http://mirrors.163.com/debian-archive/debian-security/ wheezy/updates main non-free contrib

Ubuntu

ubuntu 14.04 配置如下

  1. deb https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
  2. debsrc https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
  3. deb https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
  4. debsrc https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
  5. deb https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
  6. debsrc https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
  7. deb https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
  8. debsrc https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
  9. # deb https://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
  10. # deb-src https://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

ubuntu 16.04 配置如下

  1. deb http://mirrors.aliyun.com/ubuntu/ xenial main
  2. debsrc http://mirrors.aliyun.com/ubuntu/ xenial main
  3. deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
  4. debsrc http://mirrors.aliyun.com/ubuntu/ xenial-updates main
  5. deb http://mirrors.aliyun.com/ubuntu/ xenial universe
  6. debsrc http://mirrors.aliyun.com/ubuntu/ xenial universe
  7. deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
  8. debsrc http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
  9. deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
  10. debsrc http://mirrors.aliyun.com/ubuntu/ xenial-security main
  11. deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
  12. debsrc http://mirrors.aliyun.com/ubuntu/ xenial-security universe

ubuntu 18.04(bionic) 配置如下

  1. deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  2. debsrc http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  4. debsrc http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  6. debsrc http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  7. deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  8. debsrc http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  9. deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  10. debsrc http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

ubuntu 20.04(focal) 配置如下

  1. deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
  2. debsrc http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
  4. debsrc http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
  6. debsrc http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
  7. deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
  8. debsrc http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
  9. deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  10. debsrc http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

yum(CentOS)

配置方法

阿里云源

1. 备份

  1. mv /etc/yum.repos.d/CentOSBase.repo /etc/yum.repos.d/CentOSBase.repo.backup

2. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

CentOS 6

  1. wget O /etc/yum.repos.d/CentOSBase.repo https://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

  1. curl o /etc/yum.repos.d/CentOSBase.repo https://mirrors.aliyun.com/repo/Centos-7.repo

CentOS 8

  1. wget O /etc/yum.repos.d/CentOSBase.repo https://mirrors.aliyun.com/repo/Centos-8.repo

pip(python)

配置方法

a. 找到下列文件

~/.pip/pip.conf

如果是Windows则为C:\Users\haoduck\pip\pip.conf (haoduck为用户名)

b. 添加或修改pip.conf(如果不存在,创建一个)

阿里云源

  1. [global]
  2. indexurl = https://mirrors.aliyun.com/pypi/simple/
  3.  
  4. [install]
  5. trustedhost=mirrors.aliyun.com

163源

  1. [global]
  2. indexurl = https://mirrors.163.com/pypi/simple/

npm(nodejs)

淘宝 NPM 镜像

1 通过命令配置

  1. npm config set registry https://registry.npm.taobao.org

2 使用cnpm

  1. npm install g cnpm registry=https://registry.npm.taobao.org

之后,可以直接用cnpm代替npm执行命令

docker

配置方法

修改或新建文件:/etc/docker/daemon.json,填写下列的代码保存即可

阿里云源

  1. {
  2. “rhttps://ypzju6vq.mirror.aliyuncs.com”]
  3. }
  4.  
  5. 163
  6. <pre class=“prettyprint linenums” >
  7. {
  8. “registry-mirrors”: [“http://hub-mirror.c.163.com”]
  9. }

中科大源

  1. {
  2. “registry-mirrors”: [“http://docker.mirrors.ustc.edu.cn”]
  3. }

重启Docker后生效

  1. systemctl restart docker

使用docker info可以查看当前使用的镜像

一键脚本:

  1. sudo mkdir p /etc/docker
  2. sudo tee /etc/docker/daemon.json <<-‘EOF’
  3. {
  4. “registry-mirrors”: [“https://ypzju6vq.mirror.aliyuncs.com”]
  5. }
  6. EOF
  7. sudo systemctl daemonreload
  8. sudo systemctl restart docker

Alpine

阿里云源

编辑 /etc/apk/repositories
将里面 dl-cdn.alpinelinux.org 的 改成 mirrors.aliyun.com ; 保存退出即可

  1. sed i ‘s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g’ /etc/apk/repositories

说点什么
支持Markdown语法
好耶,沙发还空着ヾ(≧▽≦*)o
Loading...