配置常用远程源

配置常用远程源

maven

  • 修改maven包下conf/settings.xml,找到<mirrors>···</mirrors>部分修改为如下部分。

    <mirrors>
        <mirror> 
            <id>alimaven</id> 
            <name>aliyun maven</name> 
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url> 
            <mirrorOf>central</mirrorOf> 
        </mirror> 
        <!-- 中央仓库在中国的镜像-->
        <mirror>
            <id>maven.net.cn</id>
            <name>oneof the central mirrors in china</name>
            <url>http://maven.net.cn/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
        <mirror>  
           <id>maven-net-cn</id>  
           <name>Maven China Mirror</name>  
           <url>http://mvnrepository.com/</url>
           <mirrorOf>central</mirrorOf>  
        </mirror>
        <mirror>
          <id>CN</id>
          <name>OSChina Central</name>
          <url>http://maven.oschina.net/content/groups/public/</url>
          <mirrorOf>central</mirrorOf>
        </mirror>
        <mirror>
            <id>nexus-aliyun</id>
            <mirrorOf>*</mirrorOf>
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </mirror>
        <mirror> 
            <id>alimaven</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>
        <mirror>
            <id>central</id>
            <name>Maven Repository Switchboard</name>
            <url>http://repo1.maven.org/maven2/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
    </mirrors>
    

npm

  1. 变更npm远程源为淘宝源。

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

  2. 查看npm远程源配置
    npm config get registry

docker

  1. 创建docker配置文件夹。
    sudo mkdir -p /etc/docker
  2. 修改或新增daemon.json镜像源配置文件。
    sudo vim /etc/docker/daemon.json
  3. 编写registry-mirrors,更改value值即可。
    { "registry-mirrors": ["https:/xxxxxxxxx.mirror.aliyuncs.com"] }
  4. 重新加载配置文件。
    sudo systemctl daemon-reload
  5. 重启docker服务。
    sudo systemctl restart docker

yum

Centos下更改yum远程源

  1. 安装wget

    yum install -y wget (如果已经安装了则省略)

  2. 备份 /etc/yum.repos.d/CentOS-Base.repo文件

    cd /etc/yum.repos.d/ mv CentOS-Base.repo CentOS-Base.repo.back

  3. 下载阿里云的Centos-7.repo文件(根据不同Centos版本更换数字)

    wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  4. 重新加载yum

    yum clean all yum makecache

  5. 检查配置的源是否是阿里的

    cat /etc/yum.repos.d/CentOS-Base.repo

原文地址:https://www.cnblogs.com/RitualYang/p/12037725.html