1. 程式人生 > >RHEL7.4配置CentOS Yum(阿里雲)

RHEL7.4配置CentOS Yum(阿里雲)

由於沒有購買RedHat的服務,所以RHEL7.3在yum更新的時候由於沒有更新源造成更新失敗,於是把RedHat的更新源設定成阿里的更新源。wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo或者curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo執行後,在/etc/yum.repos.d/目錄生成CentOS-Base.repo檔案。執行yum makecache生成快取。
有報錯:http://mirrors.aliyuncs.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"Trying other mirror.Ctrl+z,結束執行,修改CentOS-Base.repo檔案。將檔案中的$releasever改成7
編輯/yum.repos.d檔案,將http連結中的$releasever修改為7.4.1708# cd /etc/yum.repos.d/# vim CentOS-Base.repo 游標放置在對應行,使用下面命令,將$releasever替換為7.4.1708:s /$releasever/7.4.1708[[email protected] yum.repos.d]# cat CentOS-Base.repo # 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.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/os/$basearch/ http://mirrors.aliyuncs.com/centos/7.4.1708/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#released updates [updates]name=CentOS-$releasever - Updates - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/updates/$basearch/ http://mirrors.aliyuncs.com/centos/7.4.1708/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful[extras]name=CentOS-$releasever - Extras - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/extras/$basearch/ http://mirrors.aliyuncs.com/centos/7.4.1708/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/centosplus/$basearch/ http://mirrors.aliyuncs.com/centos/7.4.1708/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contrib - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/contrib/$basearch/ http://mirrors.aliyuncs.com/centos/7.4.1708/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7執行 yum clean all 清除原有快取
執行 yum makecache 獲取yum列表