一、本地源
tep1 添加光驱并挂载
[root@CentOS7 ~]#mkdir applocation/Centos7 -p
[root@CentOS7 ~]#mount /dev/sr1 /applocation/Centos7
[root@CentOS7 ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 300M 0 part /boot
├─sda2 8:2 0 2G 0 part [SWAP]
└─sda3 8:3 0 27.7G 0 part /
sr0 11:0 1 4.4G 0 rom
sr1 11:1 1 723M 0 rom /applocation/Centos7
#此时,光盘已经挂载到该目录下
[root@CentOS7 ~]#ls /applocation/Centos7
EFI images isolinux LICENSE TRANS.TBL
tep2 打开仓库配置文件
[root@CentOS7 ~]#ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo CentOS-x86_64-kernel.repo
[root@CentOS7 ~]#mv *.repo bak;touch base.repo;vim base.repo
[Base]
name=Centos7
baseurl=file://applocation/Centos7
gpgcheck=0
tep3 检查本地仓库状态
[root@CentOS7 ~]##yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: www
repo id repo name status
base/7/x86_64 Base 10,072
#此时已完成本地源配置
二、网络源
[base]
name=base
baseurl=https://mirrors.cloud.tencent.com/centos/7/os/x86_64/
https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/
https://repo.huaweicloud.com/centos/7/os/x86_64/
gpgcheck=0
[epel]
name=epel
baseurl=https://mirrors.cloud.tencent.com/epel/7/x86_64/
https://mirrors.huaweicloud.com/epel/7/x86_64/
https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/
gpgcheck=1
gpgkey=https://mirrors.cloud.tencent.com/epel/RPM-GPG-KEY-EPEL-7
https://mirrors.huaweicloud.com/epel/RPM-GPG-KEY-EPEL-7
https://mirrors.tuna.tsinghua.edu.cn/epel/RPM-GPG-KEY-EPEL-7
enabled=1
[extras]
name=extras
baseurl=https://mirrors.cloud.tencent.com/centos/7/extras/x86_64/
https://mirrors.huaweicloud.com/centos/7/extras/x86_64/
https://mirrors.tuna.tsinghua.edu.cn/centos/7/extras/x86_64/
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
[root@CentOS7 ~]#yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: repo.huaweicloud.com
* epel: mirrors.cloud.tencent.com
* extras: mirrors.cloud.tencent.com
repo id repo name status
base base 10,072
epel epel 13,665
extras extras 500
repolist: 24,237
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?