为红帽子7安装163源

rehl7.4版本替换yum

#通过下载的rpm最新包,升级rpm到4.11版本
-rw-rw-r--. 1 syadmin syadmin 1219660 8月 14 08:44 rpm-4.11.3-43.el7.x86_64.rpm -rw-rw-r--. 1 syadmin syadmin 152832 8月 14 09:17 rpm-build-4.11.3-43.el7.x86_64.rpm -rw-rw-r--. 1 syadmin syadmin 109752 8月 14 09:17 rpm-build-libs-4.11.3-43.el7.x86_64.rpm -rw-rw-r--. 1 syadmin syadmin 284848 8月 14 09:17 rpm-libs-4.11.3-43.el7.x86_64.rpm -rw-rw-r--. 1 syadmin syadmin 85760 8月 14 09:16 rpm-python-4.11.3-43.el7.x86_64.rpm #升级rpm rpm -Uvh --nopreun rpm-* 卸载redhat_yum及插件 38 rpm -qa | grep yum | xargs rpm -e --nodeps 39 rpm -qa | grep python-urlgrabber|xargs rpm -e --nodeps #安装Centos_yum及插件,提前上mirrors.163.com下载 python-urlgrabber-3.10-10.el7.noarch.rpm yum-3.4.3-167.el7.centos.noarch.rpm yum-cron-3.4.3-167.el7.centos.noarch.rpm yum-langpacks-0.4.2-7.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-53.el7.noarch.rpm yum-rhn-plugin-2.0.1-10.el7.noarch.rpm yum-updateonboot-1.1.31-53.el7.noarch.rpm yum-utils-1.1.31-53.el7.noarch.rpm #安装yum rpm -ivh yum-* python-urlgrabber-3.10-10.el7.noarch.rpm
安装163源
curl -O /etc/yum.repo.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum makecache fast
##提示failure: repodata/repomd.xml from base:
替换掉这段,应该是不能切换版本
sed  -i  "s#\$releasever#7#g" CentOS7-Base-163.repo 

接下来再次建立缓存
yum makecache fast
updates                                                          | 2.9 kB  00:00:00     
(1/4): base/x86_64/group_gz                                      | 153 kB  00:00:00     
(2/4): extras/x86_64/primary_db                                  | 206 kB  00:00:00     
(3/4): updates/x86_64/primary_db                                 | 3.8 MB  00:00:01     
(4/4): base/x86_64/primary_db                                    | 6.1 MB  00:00:02     
元数据缓存已建立

为docker安装,添加华为mirrors
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.huaweicloud.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo


 yum install -y yum-utils device-mapper-persistent-data lvm2

yum install docker-ce

已安装:
  docker-ce.x86_64 3:19.03.12-3.el7                                                     

作为依赖被安装:
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8                                    
  containerd.io.x86_64 0:1.2.13-3.2.el7                                                 
  docker-ce-cli.x86_64 1:19.03.12-3.el7                                                 

作为依赖被升级:
  libselinux-utils.x86_64 0:2.5-15.el7                                                  
  libsemanage-python.x86_64 0:2.5-14.el7                                                
  policycoreutils.x86_64 0:2.5-34.el7                                                   
  policycoreutils-python.x86_64 0:2.5-34.el7                                            
  selinux-policy.noarch 0:3.13.1-266.el7_8.1                                            
  selinux-policy-targeted.noarch 0:3.13.1-266.el7_8.1                                   
  setools-libs.x86_64 0:3.3.8-4.el7                                                     

完毕!

 

你可能感兴趣的:(为红帽子7安装163源)