CentOS 6 企業版更新阿裡yum源 禁用訂閱服務
- Certificate-Based Repositories
- Managed by (rhsm) subscription-manager
- ...
最近在使用CentOS 6 企業版,為了更新yum源走了不少彎路,csdn這裡的文章基本都是wget,然後yum clean all 指令,再然後執行yum makecache 指令就行了,實際上直接從http://mirrors.aliyun.com/repo/下載下傳到/etc/yum.repos.d中的CentOS-Base.repo隻是個模版檔案
請參考 yum 軟體包安裝源以及注意事項 https://yq.aliyun.com/articles/507848
第三步:替換$releasever為6
vi /etc/yum.repos.d/CentOS-Base.repo
采用全局替換,在指令模式下輸入
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIn5GcuUzM5EDNwITM3EjMwkTMwIzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
如果是其他版本應該也要做相應替換,最後替換的檔案如下
#released updates
[updates]
name=CentOS-6 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/updates/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / 6 / u p d a t e s / basearch/ http://mirrors.aliyuncs.com/centos/6/updates/ basearch/http://mirrors.aliyuncs.com/centos/6/updates/basearch/
http://mirrors.cloud.aliyuncs.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/extras/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / 6 / e x t r a s / basearch/ http://mirrors.aliyuncs.com/centos/6/extras/ basearch/http://mirrors.aliyuncs.com/centos/6/extras/basearch/
http://mirrors.cloud.aliyuncs.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/centosplus/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / 6 / c e n t o s p l u s / basearch/ http://mirrors.aliyuncs.com/centos/6/centosplus/ basearch/http://mirrors.aliyuncs.com/centos/6/centosplus/basearch/
http://mirrors.cloud.aliyuncs.com/centos/6/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/contrib/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / 6 / c o n t r i b / basearch/ http://mirrors.aliyuncs.com/centos/6/contrib/ basearch/http://mirrors.aliyuncs.com/centos/6/contrib/basearch/
http://mirrors.cloud.aliyuncs.com/centos/6/contrib/$basearch/
20 次替換,共 20 行
之後如果使用yum會碰到 subscription-manager的問題
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security,
: subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Setting up Update Process
No Packages marked for Update
參考 https://blog.csdn.net/qq_31725371/article/details/82766436
Certificate-Based Repositories
Managed by (rhsm) subscription-manager
…
enabled=0
禁用訂閱服務