由于依赖错误,无法在 CentOS 7 上安装 snapd

由于依赖错误,无法在 CentOS 7 上安装 snapd

我不是 Linux 管理员,但需要安装 snapd 的帮助。

以下是我的系统详细信息。

[root@vultr nginx]# hostnamectl
   Static hostname: vultr.guest
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 906711fa42644844bc1f9fde4d4y2a68
           Boot ID: 2b3e8d969ff540ae850f504cefy215ef
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-957.5.1.el7.x86_64
      Architecture: x86-64

这是失败的安装命令。

[root@vultr nginx]# yum install snapd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.newmediaexpress.com
 * epel: fedora.ipserverone.com
 * extras: mirror.newmediaexpress.com
 * remi-php72: mirror.telkomuniversity.ac.id
 * remi-safe: mirror.telkomuniversity.ac.id
 * updates: mirror.newmediaexpress.com
Resolving Dependencies
--> Running transaction check
---> Package snapd.x86_64 0:2.47.1-1.el7 will be installed
--> Processing Dependency: snap-confine(x86-64) = 2.47.1-1.el7 for package: snapd-2.47.1-1.el7.x86_64
--> Processing Dependency: snapd-selinux = 2.47.1-1.el7 for package: snapd-2.47.1-1.el7.x86_64
--> Processing Dependency: bash-completion for package: snapd-2.47.1-1.el7.x86_64
--> Processing Dependency: fuse for package: snapd-2.47.1-1.el7.x86_64
--> Processing Dependency: squashfs-tools for package: snapd-2.47.1-1.el7.x86_64
--> Processing Dependency: squashfuse for package: snapd-2.47.1-1.el7.x86_64
--> Running transaction check
---> Package bash-completion.noarch 1:2.1-8.el7 will be installed
---> Package fuse.x86_64 0:2.9.2-11.el7 will be installed
---> Package snap-confine.x86_64 0:2.47.1-1.el7 will be installed
---> Package snapd-selinux.noarch 0:2.47.1-1.el7 will be installed
--> Processing Dependency: selinux-policy-base >= 3.13.1-268.el7 for package: snapd-selinux-2.47.1-1.el7.noarch
---> Package squashfs-tools.x86_64 0:4.3-0.21.gitaae0aff4.el7 will be installed
---> Package squashfuse.x86_64 0:0.1.102-1.el7 will be installed
--> Processing Dependency: squashfuse-libs(x86-64) = 0.1.102-1.el7 for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libfuse.so.2(FUSE_2.4)(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libfuse.so.2(FUSE_2.5)(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libfuse.so.2(FUSE_2.6)(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libfuse.so.2(FUSE_2.8)(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libfuse.so.2()(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libfuseprivate.so.0()(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libsquashfuse.so.0()(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libzstd.so.1()(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Running transaction check
---> Package fuse-libs.x86_64 0:2.9.2-11.el7 will be installed
---> Package libzstd.x86_64 0:1.4.5-3.el7 will be installed
---> Package snapd-selinux.noarch 0:2.47.1-1.el7 will be installed
--> Processing Dependency: selinux-policy-base >= 3.13.1-268.el7 for package: snapd-selinux-2.47.1-1.el7.noarch
---> Package squashfuse-libs.x86_64 0:0.1.102-1.el7 will be installed
--> Finished Dependency Resolution
Error: Package: snapd-selinux-2.47.1-1.el7.noarch (epel)
           Requires: selinux-policy-base >= 3.13.1-268.el7
           Available: selinux-policy-minimum-3.13.1-266.el7.noarch (base)
               selinux-policy-base = 3.13.1-266.el7
           Available: selinux-policy-minimum-3.13.1-266.el7_8.1.noarch (updates)
               selinux-policy-base = 3.13.1-266.el7_8.1
           Available: selinux-policy-mls-3.13.1-266.el7.noarch (base)
               selinux-policy-base = 3.13.1-266.el7
           Available: selinux-policy-mls-3.13.1-266.el7_8.1.noarch (updates)
               selinux-policy-base = 3.13.1-266.el7_8.1
           Available: selinux-policy-targeted-3.13.1-266.el7.noarch (base)
               selinux-policy-base = 3.13.1-266.el7
           Available: selinux-policy-targeted-3.13.1-266.el7_8.1.noarch (updates)
               selinux-policy-base = 3.13.1-266.el7_8.1
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

答案1

尝试重新安装selinux 策略selinux-策略目标直接从本地/远程路径,例如:

$ sudo yum remove selinux-policy-base

Removed:
  selinux-policy-minimum.noarch 0:3.13.1-268.el7
  selinux-policy-targeted.noarch 0:3.13.1-268.el7 


$ sudo yum install \
http://mirror.centos.org/centos/7/updates/x86_64/Packages/selinux-policy-3.13.1-268.el7_9.2.noarch.rpm \
http://mirror.centos.org/centos/7/updates/x86_64/Packages/selinux-policy-targeted-3.13.1-268.el7_9.2.noarch.rpm

然后,安装 snapd 应该可以工作:

$ sudo yum install snapd

Updated:
  snapd.x86_64 0:2.47.1-1.el7                                                                                                                                                                            

Dependency Updated:
  snap-confine.x86_64 0:2.47.1-1.el7                                                                 snapd-selinux.noarch 0:2.47.1-1.el7                                                                

Complete!

答案2

由于某种原因,它需要尚未发布的 CentOS 7.9。您可以通过执行以下操作更改为 CentOS 的连续版本, sudo yum --enablerepo=cr update或者等待 CentOS 7.9

答案3

来自快照网站https://snapcraft.io/docs/installing-snap-on-centos

您需要启用 CR(持续发布)存储库。尝试运行sudo yum-config-manager --enable cr然后运行sudo yum install snapd。这应该可以修复错误。

答案4

2020-11-14 更新

CentOS 7.9 版本现已在base存储库中提供,以及所需的selinux-policy-base.

只需运行yum update安装centos-release-7-9.2009.0.el7.centos,然后就可以安装snapyum install snapd

相关内容