行业知识
centos-stream-9 centos9 配置国内yum源 阿里云源
2026-11-04 22:07:09
来源:互联网转载
���配置
()tips:
yum配置文件路径
()/etc/yum.repos.d/centos.repo
1.备份源配置 [Very Important!]
mv /etc/yum.repos.d/centos.repo /etc/yum.repos.d/centos.repo.backup
2.Clean Cache:
yum clean all
3.Backup the Old CentOS-Base.repoIf exist this file.
cd /etc/yum.repos.d/mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
4.Create the new CentOS-Base.repo file with vim or other editor , and save to the directory '/etc/yum.repos.d/' fill with the following contents below:
# 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 for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base - mirrors.aliyun.com #failovermethod=priority baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/os/ http://mirrors.aliyuncs.com/centos-stream/$stream/BaseOS/$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/BaseOS/$basearch/os/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official #additional packages that may be useful #[extras] #name=CentOS-$releasever - Extras - mirrors.aliyun.com #failovermethod=priority #baseurl=https://mirrors.aliyun.com/centos-stream/$stream/extras/$basearch/os/ # http://mirrors.aliyuncs.com/centos-stream/$stream/extras/$basearch/os/ # http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/extras/$basearch/os/ #gpgcheck=1 #gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - mirrors.aliyun.com #failovermethod=priority baseurl=https://mirrors.aliyun.com/centos-stream/$stream/centosplus/$basearch/os/ http://mirrors.aliyuncs.com/centos-stream/$stream/centosplus/$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/centosplus/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official [PowerTools] name=CentOS-$releasever - PowerTools - mirrors.aliyun.com #failovermethod=priority baseurl=https://mirrors.aliyun.com/centos-stream/$stream/PowerTools/$basearch/os/ http://mirrors.aliyuncs.com/centos-stream/$stream/PowerTools/$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official [AppStream] name=CentOS-$releasever - AppStream - mirrors.aliyun.com #failovermethod=priority baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/ http://mirrors.aliyuncs.com/centos-stream/$stream/AppStream/$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/AppStream/$basearch/os/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official
Press the “ESC” key and input “:wq” to save and quit vim, if you use vim.
阿里源配置, ok5. 更新缓存
yum makecache && yum update
or, you can use the follow tow commands.
yum makecache
then
yum update
Waiting for the “Complete!” notice in your terminal.
6.Finished.