树莓派 centos 7-aarch64如何替换yum源

之前按网上方法更换源 都有问题 这个试过了是可以的

一、进入yum.repo.d

[root@node-01 ~]# cd /etc/yum.repos.d/
 
[root@node-01 yum.repos.d]# ls
CentOS-Base.repo  CentOS-Sources.repo

二、备份原yum源

[root@node-01 yum.repos.d]# mkdir yum-back
 
[root@node-01 yum.repos.d]# mv CentOS-* yum-back/
 
[root@node-01 yum.repos.d]# ls
yum-back

三、替换yum源为阿里源

[root@node-01 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
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

[root@node-01 yum.repos.d]# cat epel.repo 
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
 
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch/debug
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
 
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/SRPMS
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

四、运行yum生成缓存

[root@node-01 ~]#  yum makecache
 
[root@node-01 ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
 
[root@node-01 ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

五、验证

[root@node-01 ~]# yum -y install gcc-c++
 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.aarch64 0:4.8.5-36.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-36.el7 for package: gcc-c++-4.8.5-36.el7.aarch64
--> Processing Dependency: libstdc++ = 4.8.5-36.el7 for package: gcc-c++-4.8.5-36.el7.aarch64
--> Processing Dependency: gcc = 4.8.5-36.el7 for package: gcc-c++-4.8.5-36.el7.aarch64
......
......
......
Installed:
  gcc-c++.aarch64 0:4.8.5-36.el7                                                                                                       
 
Dependency Installed:
  cpp.aarch64 0:4.8.5-36.el7    gcc.aarch64 0:4.8.5-36.el7    libmpc.aarch64 0:1.0.1-3.el7    libstdc++-devel.aarch64 0:4.8.5-36.el7   
 
Dependency Updated:
  libgcc.aarch64 0:4.8.5-36.el7              libgomp.aarch64 0:4.8.5-36.el7              libstdc++.aarch64 0:4.8.5-36.el7             
 
Complete