【linux常用国内镜像资源】

这里写自定义目录标题

    • 1. apt 源
        • 文件:
        • 修改:
    • 2. yum 源
        • 文件:
        • 修改:
    • 3. docker 源
        • 文件:
        • 修改:
    • 4. maven源
        • 文件:
        • 修改
    • 5. python源
        • 执行命令:
        • 一次性使用:
    • 6. nodejs源
        • 执行命令:
        • 恢复官方镜像:

1. apt 源

文件:

/etc/apt/sources.list

修改:

添加到开头

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

2. yum 源

文件:

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

修改:

备份: cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载:http://mirrors.aliyun.com/repo/Centos-7.repo, 并命名为CentOS-Base.repo

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

清除缓存:

yum clean all     # 清除系统所有的yum缓存
yum makecache     # 生成yum缓存

3. docker 源

文件:

/etc/docker/daemon.json

修改:
{
    "registry-mirrors": [
        "http://hub-mirror.c.163.com",
        "https://docker.mirrors.ustc.edu.cn",
        "https://dkgn6f0h.mirror.aliyuncs.com",
        "https://registry.docker-cn.com"
    ]
}

确认:

systemctl restart docker 

docker info

4. maven源

文件:

MVN_HOME/conf/settings.xml

修改

替换repo.maven.apache.org:


    alimaven
    central
    aliyun maven
    http://maven.aliyun.com/nexus/content/repositories/central/

5. python源

执行命令:
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

一次性使用:
pip install pandas -i http://pypi.douban.com/simple/

6. nodejs源

执行命令:
npm config set registry https://registry.npmmirror.com/
恢复官方镜像:
npm get registry

npm config set registry http://registry.npmjs.org

你可能感兴趣的:(其他,linux,ubuntu,docker)