首頁  >  文章  >  運維  >  如何用阿里源替換原Centos的yum源

如何用阿里源替換原Centos的yum源

藏色散人
藏色散人轉載
2020-04-26 17:14:362144瀏覽

下面由Centos使用教學欄位來介紹用阿里源取代原始Centos的yum來源的方法,希望對需要的朋友有幫助!

如何用阿里源替換原Centos的yum源

簡單的了解幾個開源站

如果需要下載一些鏡像文件,例如CentOS或Ubuntu等等之類的開源軟體,可以再國內透過下面幾個鏡像網站來取得。

阿里的開源鏡像站(https://opsx.alibaba.com/)

#網易開源鏡像站(http://mirrors.163.com/)

#清華大學開源鏡像站(https://mirrors.tuna.tsinghua.edu.cn/)

進入正題

##1.備份

#

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.下載新的CentOS-Base.repo 到/etc/yum.repos.d/下

CentOS 5
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3.執行yum makecache產生快取

  [root@localhost ~]# yum clean all
    [root@localhost ~]# yum makecache
    [root@localhost ~]# yum update

這裡解釋下yum makecache:就是把伺服器的包資訊下載到本地電腦快取起來。

以上是如何用阿里源替換原Centos的yum源的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:segmentfault.com。如有侵權,請聯絡admin@php.cn刪除
上一篇:centos是乾嘛的下一篇:centos是乾嘛的