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
相关推荐
搬山境KL攻城狮6 小时前
maven 私服上传jar
java·maven·jar
jenchoi41310 小时前
【2025-11-11】软件供应链安全日报:最新漏洞预警与投毒预警情报汇总
网络·安全·web安全·网络安全·npm
百***926513 小时前
Node.js npm 安装过程中 EBUSY 错误的分析与解决方案
前端·npm·node.js
百***353313 小时前
node.js+npm的环境配置以及添加镜像(保姆级教程)
arcgis·npm·node.js
by__csdn16 小时前
Node各版本的区别,如何选择版本以及与NPM版本对照关系
前端·npm·node.js
by__csdn1 天前
nvm安装部分node版本后没有npm的问题(14及以下版本)
前端·npm·node.js
by__csdn1 天前
Node与Npm国内最新镜像配置(淘宝镜像/清华大学镜像)
前端·npm·node.js
是梦终空1 天前
vue下载依赖报错npm ERR node-sass@4.14.1 postinstall: `node scripts/build.js`的解决方法
javascript·npm·vue·node-sass·vue依赖
陈陈小白1 天前
npm run dev报错Error: listen EADDRINUSE: address already in use :::8090
前端·npm·node.js·vue