首页 学习记录 正文
  • 本文约2617字,阅读需13分钟
  • 3830
  • 0

arm主板yum使用报错解决方案

摘要

在使用ARM主板centos系统发现使用yum命令报错

在使用ARM主板centos系统发现使用yum命令报错,报错命令如下:

[anaconda root@localhost ethtool-4.8]# yum install -y gcc 
Traceback (most recent call last): 
   File "/bin/yum", line 28, in<module>
         import yummain
ImportError: No module named yummain

此报错是由于没有安装yum命令导致,可按照以下方法进行yum安装:

1、先下载yum命令包,并解压进入

[anaconda root@localhost ]# wget  http://yum.baseurl.org/download/3.4/yum-3.4.0.tar.gz
[anaconda root@localhost ]# tar -xvf yum-3.4.0.tar.gz
......
[anaconda root@localhost ]# cd yum-3.4.0

2、在解压的yum-3.4.0文件夹下进行安装

[anaconda root@localhost ]# ./yummain.py  install yum

3、在此执行安装的时候发现有报错,在etc目录下没有yum.conf文件,我们先创建一个空文件,同时创建yum.repos.d文件夹和CentOS-Base.repo文件,继续执行

[anaconda root@localhost yum-3.4.0]# ./yummain.py install yum
CRITICAL:yum.cli:Config Error: Error accessing file for config file:///etc/yum.conf
[anaconda root@localhost yum-3.4.0]# touch /etc/yum.conf
[anaconda root@localhost yum-3.4.0]# mkdir /etc/yum.repos.d
[anaconda root@localhost yum-3.4.0]# touch /etc/yum.repos.d/CentOS-Base.repo

4、继续执行安装yum后发现还有报错,没有yum所需要的repos文件,因为我们是arm架构,所有我找了华为源下载repo文件

[anaconda root@localhost yum-3.4.0]# ./yummain.py install yum
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>
[anaconda root@localhost etc]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-AltArch-7.repo
......

5、下载完成后我们继续通过前面下载的yum-3.4.0安装,安装正常进行,无报错

[anaconda root@localhost yum-3.4.0]# ./yummain.py install yum
base                                                     | 3.6 kB     00:00
base/primary_db                                          | 4.9 MB     00:00
extras                                                   | 2.9 kB     00:00
extras/primary_db                                        | 237 kB     00:00
updates                                                  | 2.9 kB     00:00
updates/primary_db                                       | 1.0 MB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum.noarch 0:3.4.3-168.el7.centos will be installed
--> Processing Dependency: python(abi) = 2.7 for package: yum-3.4.3-168.el7.centos.noarch
--> Processing Dependency: yum-metadata-parser >= 1.1.0 for package: yum-3.4.3-168.el7.centos.noarch
--> Processing Dependency: rpm >= 4.11.3-22 for package: yum-3.4.3-168.el7.centos.noarch
..........

6、安装完成后做一下yum更新

[anaconda root@localhost yum-3.4.0]# yum update
(1/3): extras/aarch64/primary_db                           | 237 kB   00:00
(2/3): updates/aarch64/primary_db                          | 1.0 MB   00:00
(3/3): base/aarch64/primary_db                             | 4.9 MB   00:01
No packages marked for update

7、更新完成尝试通过yum安装一个服务看是否正常

[anaconda root@localhost yum-3.4.0]# yum install -y tftp
Resolving Dependencies
--> Running transaction check
---> Package tftp.aarch64 0:5.2-22.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package         Arch               Version               Repository       Size
================================================================================
Installing:
 tftp            aarch64            5.2-22.el7            base             38 k
..........


服务能够正常安装,yum安装成功

注:yum在此系统下安装的rpm包位置在此目录下  /var/cache/yum/base/packages/


标签:Linuxarmyum


    评论
    更换验证码
    友情链接