• 欢迎访问好鸭,WordPress信息,WordPress教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏好鸭吧

apt yum pip npm docker alpine更换国内源

教程 haoduck 5个月前 (06-10) 431次浏览 0个评论

各种更换国内软件源

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

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

apt(Debian/Ubuntu)

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

Debian

163源

debian10(buster)

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 http://mirrors.163.com/debian-security/ buster/updates 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-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

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

deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
 
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib

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

deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
 
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib

debian 7.x (wheezy)

deb http://mirrors.163.com/debian-archive/debian/ wheezy main non-free contrib
deb http://mirrors.163.com/debian-archive/debian/ wheezy-updates main non-free contrib
deb http://mirrors.163.com/debian-archive/debian/ wheezy-backports main non-free contrib
deb-src http://mirrors.163.com/debian-archive/debian-security/ wheezy/updates main non-free contrib

deb-src http://mirrors.163.com/debian-archive/debian/ wheezy main non-free contrib
deb-src http://mirrors.163.com/debian-archive/debian/ wheezy-updates main non-free contrib
deb-src http://mirrors.163.com/debian-archive/debian/ wheezy-backports main non-free contrib
deb-src http://mirrors.163.com/debian-archive/debian-security/ wheezy/updates main non-free contrib

Ubuntu

ubuntu 14.04(trusty)
http://mirrors.163.com/.help/sources.list.trusty

deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

ubuntu 16.04(xenial)

deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse

ubuntu 18.04(bionic)

deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

yum(CentOS)

配置方法

阿里云源

1. 备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

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

CentOS 6

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

CentOS 7

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

CentOS 8

wget -O /etc/yum.repos.d/CentOS-Base.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(如果不存在,创建一个)

阿里云源

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com

163源

[global]
index-url = https://mirrors.163.com/pypi/simple/

npm(nodejs)

淘宝 NPM 镜像

1 通过命令配置

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

2 使用cnpm

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

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

docker

配置方法

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

163源

{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}

中科大源

{
"registry-mirrors": ["http://docker.mirrors.ustc.edu.cn"]
}

重启Docker后生效

systemctl restart docker

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

Alpine

阿里云源

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

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

好鸭 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:apt yum pip npm docker alpine更换国内源
喜欢 (1)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址