centos 配置清华源
时间: 2025-01-12 10:50:47 浏览: 158
### 配置清华大学镜像源
对于希望加速软件包下载速度并提高稳定性,可以将CentOS默认使用的国外镜像更换为国内的清华大学镜像。具体操作如下:
编辑`/etc/yum.repos.d/CentOS-Base.repo` 文件[^1]:
```bash
sudo vim /etc/yum.repos.d/CentOS-Base.repo
```
清空原有内容并将以下对应版本的内容复制进去。
#### 对于 CentOS 7 用户
```ini
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the update status of each mirror to pick mirrors that are updated to and geographically close to the client.
# You should use this instead of mirros based on age.
[Tsinghua]
name=CentOS-$releasever - Base - Mirrors
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos/RPM-GPG-KEY-CentOS-7
```
执行命令刷新缓存使更改生效:
```bash
sudo yum clean all
sudo yum makecache
```
通过上述设置即可完成对清华大学镜像源的配置工作,在此之后使用yum工具进行安装或更新时将会自动连接至清华源服务器获取资源。
阅读全文
相关推荐
















