cat /etc/redhat-release uname -a cat /proc/version
筆者的版本是: centos7.5linux
https://opsx.alibaba.com/mirror 打開,找到你對應的版本, 點擊幫助docker
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all yum makecache //將服務器上的軟件包信息緩存到本地,以提升搜索安裝軟件的速度
執行到此處就遇到如下錯誤vim
cp: 在"CentOS-Epel.repo" 後缺乏了要操做的目標文件 Try 'cp --help' for more information. [root@sgfoot2021 yum.repos.d]# cp CentOS-Epel.repo CentOS-Epel.repo.bak [root@sgfoot2021 yum.repos.d]# vim CentOS-Epel.repo [root@sgfoot2021 yum.repos.d]# yum makecache 已加載插件:fastestmirror, langpacks Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 docker-ce-stable | 3.5 kB 00:00:00 http://mirrors.tencentyun.com/epel/7/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.tencentyun.com; 未知的錯誤" 正在嘗試其它鏡像。 One of the configured repositories failed (EPEL for redhat/centos 7 - x86_64), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=epel ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable epel or subscription-manager repos --disable=epel 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=epel.skip_if_unavailable=true failure: repodata/repomd.xml from epel: [Errno 256] No more mirrors to try. http://mirrors.tencentyun.com/epel/7/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.tencentyun.com; 未知的錯誤"
cd /etc/yum.repos.d vim CentOS-Epel.repo #如下爲內容, 換tencentyun更換成aliyun [epel] name=EPEL for redhat/centos $releasever - $basearch failovermethod=priority gpgcheck=1 gpgkey=http://mirrors.tencentyun.com/RPM-GPG-KEY-EPEL-7 enabled=1 baseurl=http://mirrors.tencentyun.com/epel/$releasever/$basearch/
[epel] name=EPEL for redhat/centos $releasever - $basearch failovermethod=priority gpgcheck=1 gpgkey=http://mirrors.tencentyun.com/RPM-GPG-KEY-EPEL-7 enabled=1 baseurl=http://mirrors.tencentyun.com/epel/$releasever/$basearch/
yum clean all yum makecache yum -y update