在配置树莓派的时候想更换yum的安装源为国内的,这样可以提高其速度;
但是网上给的教程重复操作了无数遍,用过阿里云、清华、16等的源,都是跪在yum makecache
时,出现各种404无应答,后来解决了这个问题,原因应该是树莓派的centos镜像是armhf的。
解决方案:采用中科大的armhf源
具体操作:更改/etc/yum.repos.d/CentOS-Base.repo
采用finalshell或者MobaXterm可以直接找到该目录双击打开文件进行更改
更改之前可以先备份一下,更改为以下内容:
# 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
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
#released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/updates/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/extras/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
随后依次执行:
yum clean all
yum makecache
然后是漫长的等待,基本上可以看一集电视剧了,一开始我还以为有问题,试过,就是这样。
[root@centos yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
epel | 3.8 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/14): base/7/aarch64/group_gz | 153 kB 00:00:00
(2/14): base/7/aarch64/filelists_db | 6.2 MB 00:00:04
(3/14): base/7/aarch64/primary_db | 4.9 MB 00:00:06
(4/14): base/7/aarch64/other_db | 2.1 MB 00:00:02
(5/14): epel/group_gz | 88 kB 00:00:09
(6/14): epel/primary_db | 10 MB 00:15:11
(7/14): extras/7/aarch64/filelists_db | 332 kB 00:00:00
(8/14): extras/7/aarch64/other_db | 149 kB 00:00:00
(9/14): extras/7/aarch64/primary_db | 250 kB 00:00:00
(10/14): updates/7/aarch64/primary_db | 3.2 MB 00:00:01
(11/14): updates/7/aarch64/other_db | 776 kB 00:00:00
(12/14): updates/7/aarch64/filelists_db | 3.1 MB 00:00:03
(13/14): epel/other_db | 5.5 MB 00:07:31
(14/14): epel/filelists_db | 24 MB 00:40:33
Metadata Cache Created