更换成清华镜像源命令
时间: 2024-11-03 22:15:25 浏览: 223
更换成清华大学开源软件镜像源的命令通常是在使用Docker或者Yum/Apt等包管理工具的时候。以下是几个操作系统的示例:
1. **Docker**:
对于Docker,如果你想要设置Docker的官方镜像仓库为中国清华大学的镜像站,可以在`~/.docker/config.json`文件中添加配置,或者通过命令行设置:
```sh
docker config set registry-mirrors https://mirrors.tuna.tsinghua.edu.cn/docker/
```
2. **Ubuntu/Debian (使用APT)**
在Ubuntu或Debian系统中,可以编辑`/etc/apt/sources.list`,将默认的索引服务器替换为清华大学源,例如:
```
deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal main restricted universe multiverse
deb-src [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal main restricted universe multiverse
```
3. **CentOS/RHEL (使用Yum)**
在CentOS/RHEL中,编辑`/etc/yum.repos.d/CentOS-Base.repo` 或创建一个新的文件,然后更新为清华大学源:
```
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/$basearch/centos/$releasever/os/
gpgcheck=1
enabled=1
```
记得运行 `sudo apt-get update` 或 `sudo yum makecache fast` 来刷新新的镜像列表。
阅读全文
相关推荐














