maven、npm、pip、yum官方镜像修改文档

文章目录

由于各博客繁杂,本文旨在记录各常见镜像官网,及其配置文档。常用镜像及配置可评论后加入

Maven

阿里云

官方文档

setting.xml

xml 复制代码
<mirror>
    <id>aliyunmaven</id>
    <mirrorOf>*</mirrorOf>
    <name>阿里云公共仓库</name>
    <url>https://maven.aliyun.com/repository/public</url>
</mirror>

或者pom.xml

xml 复制代码
<repository>
    <id>spring</id>
    <url>https://maven.aliyun.com/repository/spring</url>
    <releases>
        <enabled>true</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>

网易

官方文档

setting.xml

xml 复制代码
<mirror>
    <id>nexus-163</id>
    <mirrorOf>*</mirrorOf>
    <name>Nexus 163</name>
    <url>http://mirrors.163.com/maven/repository/maven-public/</url>
</mirror>

或者pom.xml

xml 复制代码
<repositories>
    <repository>
        <id>nexus-163</id>
        <name>Nexus 163</name>
        <url>http://mirrors.163.com/maven/repository/maven-public/</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>nexus-163</id>
        <name>Nexus 163</name>
        <url>http://mirrors.163.com/maven/repository/maven-public/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
</pluginRepositories>

华为

官方文档
PDF

setting.xml

xml 复制代码
<mirror>
    <id>huaweicloud</id>
    <mirrorOf>*</mirrorOf>
    <url>https://repo.huaweicloud.com/repository/maven/</url>
</mirror>

腾讯云

官方文档

setting.xml

xml 复制代码
<mirror>
    <id>nexus-tencentyun</id>
    <mirrorOf>*</mirrorOf>
    <name>Nexus tencentyun</name>
    <url>https://mirrors.tencent.com/nexus/repository/maven-public/</url>
 </mirror> 

Npm

淘宝

官方文档

shell 复制代码
npm config set registry https://registry.npmmirror.com

cnpm

shell 复制代码
npm install -g cnpm --registry=https://registry.npmmirror.com

腾讯云

官方文档

shell 复制代码
npm config set registry https://mirrors.tencent.com/npm/

pip

清华源

官方文档

临时使用

shell 复制代码
pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple some-package

设为默认

shell 复制代码
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

阿里

官方文档

a. 找到下列文件

xml 复制代码
~/.pip/pip.conf

b. 在上述文件中添加或修改:

xml 复制代码
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/

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

中科大

官方文档

临时使用

shell 复制代码
pip install -i https://mirrors.ustc.edu.cn/pypi/simple package

设为默认

升级 pip 到最新的版本 (>=10.0.0) 后进行配置:

使用本镜像站来升级 pip

shell 复制代码
pip install -i https://mirrors.ustc.edu.cn/pypi/simple pip -U
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/simple

华科

官方文档

shell 复制代码
curl -sSfL https://mirrors.hust.edu.cn/get | sh -s -- autodeploy #或者采用 ad

Yum

官方文档

shell 复制代码
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

更新镜像源

shell 复制代码
清除缓存:yum clean all
生成缓存:yum makecache
相关推荐
hui函数5 小时前
如何解决 pip install 编译报错 ‘cl.exe’ not found(缺少 VS C++ 工具集)问题
开发语言·c++·pip
全栈前端老曹6 小时前
【包管理】npm init 项目名后底层发生了什么的完整逻辑
前端·javascript·npm·node.js·json·包管理·底层原理
小当家.1056 小时前
Maven与Gradle完整对比指南:构建工具深度解析
java·gradle·maven
indexsunny7 小时前
互联网大厂Java面试实战:Spring Boot与微服务在电商场景的应用解析
java·spring boot·redis·微服务·kafka·gradle·maven
qq_5470261797 小时前
Maven 仓库管理
java·maven
hui函数7 小时前
Python系列Bug修复|如何解决 pip install 安装报错 invalid command ‘bdist_wheel’(缺少 wheel)问题
python·bug·pip
hui函数7 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有索引未设为 trusted-host 导致拒绝 问题
python·bug·pip
hui函数8 小时前
Python系列Bug修复|如何解决 pip install 安装报错 Backend ‘setuptools.build_meta’ 不可用 问题
python·bug·pip
xiaobaishuoAI9 小时前
后端工程化实战指南:从规范到自动化,打造高效协作体系
java·大数据·运维·人工智能·maven·devops·geo
hui函数10 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有仓库认证失败 401 Unauthorized 问题
python·bug·pip