You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在嵌入式Linux上安装带依赖的Yum工具?

How to Install Yum on a Minimal Embedded Linux (Avoiding Dependency Loops)

Hey there, I’ve dealt with this exact headache on stripped-down embedded Linux systems before—dependency loops when trying to install yum via rpm are the worst. Let’s go through some practical, low-hassle ways to get this sorted out.

Option 1: Install All Dependencies in One Go (Fixes Loops Instantly)

Dependency loops happen because rpm tries to install packages one by one, checking dependencies each time. If you grab all required packages first and install them together, rpm can resolve the circular dependencies internally.

  • First, confirm your system architecture with uname -m (e.g., x86_64, aarch64).
  • Find a CentOS mirror that matches your system’s base version (since you’re familiar with CentOS, your embedded distro is likely based on it). Download yum, dnf, python-dnf, and all their direct/indirect dependencies—make sure to pick packages for your architecture.
  • Transfer all these .rpm files to your embedded system (use scp, a USB drive, or whatever file transfer works for you).
  • Navigate to the folder with the packages and run:
    rpm -ivh *.rpm
    
    This installs all packages at once, and rpm will handle the circular dependencies without throwing errors. If you still hit minor issues, you can add --nodeps --force as a last resort, but try the plain command first—it usually works.

Option 2: Use MicroDNF Instead (Lightweight Alternative)

Yum is actually just an alias for DNF these days, and MicroDNF is a stripped-down, resource-friendly version of DNF designed for embedded systems. It has far fewer dependencies, so you’ll avoid those annoying loops entirely.

  • Follow the same first two steps as above, but download MicroDNF and its dependencies instead of yum/DNF.
  • Install them with:
    rpm -ivh microdnf-*.rpm *.rpm
    
  • Once installed, you can use MicroDNF just like yum:
    microdnf install <package-name>
    microdnf update
    
    This is my go-to for embedded systems—it’s faster and uses less memory than full yum/DNF.

Option 3: Manually Break the Dependency Loop (For When You Need Full Yum)

If you really need the full yum tool, you can manually resolve the loop by installing packages in a specific order:

  • Try installing yum first to see the exact dependency chain:
    rpm -ivh yum.rpm
    
  • Note down the missing dependencies. If you see a loop (e.g., yum needs dnf, dnf needs python-dnf, python-dnf needs a library that yum provides), start by installing the lowest-level, non-circular dependencies first.
  • If you hit a point where two packages depend on each other, install one temporarily with --nodeps:
    rpm -ivh dnf.rpm --nodeps
    
  • Then install the remaining dependencies, and finally re-install the package you skipped dependencies for to fix any broken links:
    rpm -ivh dnf.rpm --replacepkgs
    

Post-Install: Set Up a Yum Repository

Once yum is installed, you’ll need a valid repo file to pull packages. Create /etc/yum.repos.d/CentOS-Base.repo with content matching your CentOS version (example for CentOS 7):

[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7

Test it with yum update to make sure it works.

内容的提问来源于stack exchange,提问作者user1173240

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:59:09