Files
jcutmirror/docs/zh/centos.mdx
2024-02-14 23:39:12 +08:00

36 lines
927 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
mirrorId: centos
---
在使用 CentOS 镜像前,请检查您所应该使用的对应软件源:
| CentOS 版本 | 架构 | 对应软件源 |
|---|---|---|
| 6 及之前 | - | centos-vault |
| 7 | x86_64 | centos |
| 7 | 其他 | centos-altarch |
| 8 ~ 8.1 | x86_64 | centos |
| 8 ~ 8.1 | 其他 | centos-altarch |
| 8.1 ~ 8.5 | - | centos-vault |
| 8 Stream | - | centos |
| 9 Stream | - | centos-stream |
使用以下命令切换源并备份原始配置:
```bash
sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.zju.edu.cn|g' \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo
```
注意其中的*通配符,如果只需要替换一些文件中的源,请自行增删。
如果需要启用其中一些 repo需要将其中的 `enabled=0` 改为 `enabled=1`。
然后,更新软件包缓存:
```bash
sudo yum makecache
```