说明
在国内需要修改镜像的地方实在太多了,所以从今天开始做个汇总,把后面遇到的各种情况都记录下来。
镜像
1、Centos7、8修改镜像源
镜像源地址:https://mirror.tuna.tsinghua.edu.cn/help/centos/
修该前需要先备份原来的文件,防止出现意外。
注意:
Centos8的源镜像文件是(CentOS-Linux-*.repo)
Centos7的源镜像文件是(CentOS-Base.repo)
使用下面的命令可以一键设置(包括备份),如果你只想替换部分文件,把通配符(*)改成具体的名字即可
sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo
最后更新软件包缓存
sudo yum makecache
2、Node修改镜像源
修改命令
npm config set registry https://registry.npm.taobao.org
修改好后可以测试一下
npm config get registry