apt
- 原文件备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
- 编辑源列表文件
sudo vim /etc/apt/sources.list
- 将原来的列表删除,添加如下内容(中科大镜像源)
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiversedeb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiversedeb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiversedeb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiversedeb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
npm
直接使用
sudo npm install--registry https://registry.npm.taobao.org/
命令行永久修改
# 1. 设置npm config set registry https://registry.npm.taobao.org# 2. 查看npm config get registry# 如果不需要可以直接删除npm config rm registry
使用cnpm
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org# 使用npm时,直接使用cnpmcnpm install
pip
临时使用
sudo pip3 install-i https://pypi.tuna.tsinghua.edu.cn/simple# 或者 python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple
命令行永久修改(pip 版本 >= 10.0.0)
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/# 查看$ pip config get global.index-url
配置文件修改
mkdir ~/.pipvim ~/.pip/pip.conf
编辑以下内容
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host = pypi.tuna.tsinghua.edu.cn
window下在"C:\Users\Administrator\AppData\Roaming\
创建pip\pip.ini"
[global]index-url = http://pypi.douban.com/simple[install]trusted-host = pypi.douban.com
docker
临时使用
sudo docker pull docker.mirrors.ustc.edu.cn//
持久使用
sudo vim /etc/docker/daemon.json { "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"] }sudo systemctl restart docker