我们如何得知安装的包来自哪个仓库?
创始人
2024-03-02 01:03:37
0

有时候你可能想知道安装的软件包来自于哪个仓库。这将帮助你在遇到包冲突问题时进行故障排除。因为第三方仓库拥有最新版本的软件包,所以有时候当你试图安装一些包的时候会出现兼容性的问题。在 Linux 上一切都是可能的,因为你可以安装一个即使在你的发行版系统上不能使用的包。你也可以安装一个最新版本的包,即使你的发行版系统仓库还没有这个版本,怎么做到的呢?这就是为什么出现了第三方仓库。它们允许用户从库中安装所有可用的包。

几乎所有的发行版系统都允许第三方软件库。一些发行版还会官方推荐一些不会取代基础仓库的第三方仓库,例如 CentOS 官方推荐安装 EPEL 库

下面是常用的仓库列表和它们的详细信息。

  • CentOS: EPELELRepo 等是 Centos 社区认证仓库
  • Fedora: RPMfusion 仓库 是经常被很多 Fedora 用户使用的仓库。
  • ArchLinux: ArchLinux 社区仓库包含了来自于 Arch 用户仓库的可信用户审核通过的软件包。
  • openSUSE: Packman 仓库 为 openSUSE 提供了各种附加的软件包,特别是但不限于那些在 openSUSE Build Service 应用黑名单上的与多媒体相关的应用和库。它是 openSUSE 软件包的最大外部软件库。
  • Ubuntu:个人软件包归档(PPA)是一种软件仓库。开发者们可以创建这种仓库来分发他们的软件。你可以在 PPA 导航页面找到相关信息。同时,你也可以启用 Cananical 合作伙伴软件仓库。

仓库是什么?

软件仓库是存储特定的应用程序的软件包的集中场所。

所有的 Linux 发行版都在维护他们自己的仓库,并允许用户在他们的机器上获取和安装包。

每个厂商都提供了各自的包管理工具来管理它们的仓库,例如搜索、安装、更新、升级、删除等等。

除了 RHEL 和 SUSE 以外大部分 Linux 发行版都是自由软件。要访问付费的仓库,你需要购买其订阅服务。

为什么我们需要启用第三方仓库?

在 Linux 里,并不建议从源代码安装包,因为这样做可能会在升级软件和系统的时候产生很多问题,这也是为什么我们建议从库中安装包而不是从源代码安装。

在 RHEL/CentOS 系统上我们如何得知安装的软件包来自哪个仓库?

这可以通过很多方法实现。我们会给你所有可能的选择,你可以选择一个对你来说最合适的。

方法-1:使用 yum 命令

RHEL 和 CentOS 系统使用 RPM 包,因此我们能够使用 Yum 包管理器 来获得信息。

YUM 即 “Yellodog Updater, Modified” 是适用于基于 RPM 的系统例如 RHEL 和 CentOS 的一个开源命令行前端包管理工具。

yum 是从发行版仓库和其他第三方库中获取、安装、删除、查询和管理 RPM 包的一个主要工具。

# yum info apachetop
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: epel.mirror.constant.com
Installed Packages
Name        : apachetop
Arch        : x86_6https://archive.linux.cn/4
Version     : 0.15.6
Release     : 1.el7
Size        : 65 k
Repo        : installed
From repo   : epel
Summary     : A top-like display of Apache logs
URL         : https://github.com/tessus/apachetop
License     : BSD
Description : ApacheTop watches a logfile generated by Apache (in standard common or
            : combined logformat, although it doesn't (yet) make use of any of the extra
            : fields in combined) and generates human-parsable output in realtime.

apachetop 包来自 EPEL 仓库。

方法-2:使用 yumdb 命令

yumdb info 提供了类似于 yum info 的信息但是它又提供了包校验和数据、类型、用户信息(谁安装的软件包)。从 yum 3.2.26 开始,yum 已经开始在 rpmdatabase 之外存储额外的信息(user 表示软件是用户安装的,dep 表示它是作为依赖项引入的)。

# yumdb info lighttpd
Loaded plugins: fastestmirror
lighttpd-1.https://archive.linux.cn/4.50-1.el7.x86_6https://archive.linux.cn/4
     checksum_data = a2https://archive.linux.cn/4d18102edhttps://archive.linux.cn/401https://archive.linux.cn/48cfcc965310a516050edhttps://archive.linux.cn/437d728eeeefb23709https://archive.linux.cn/486783ahttps://archive.linux.cn/4d37
     checksum_type = sha256
     command_line = --enablerepo=epel install lighttpd apachetop aria2 atop axel
     from_repo = epel
     from_repo_revision = 15https://archive.linux.cn/40756729
     from_repo_timestamp = 15https://archive.linux.cn/40757https://archive.linux.cn/483
     installed_by = 0
     origin_url = https://epel.mirror.constant.com/7/x86_6https://archive.linux.cn/4/Packages/l/lighttpd-1.https://archive.linux.cn/4.50-1.el7.x86_6https://archive.linux.cn/4.rpm
     reason = user
     releasever = 7
     var_contentdir = centos
     var_infra = stock
     var_uuid = ce328b07-9c0a-https://archive.linux.cn/4765-b2ad-59d96a257dc8

lighttpd 包来自 EPEL 仓库。

方法-3:使用 rpm 命令

RPM 命令 即 “Red Hat Package Manager” 是一个适用于基于 Red Hat 的系统(例如 RHEL、CentOS、Fedora、openSUSE & Mageia)的强大的命令行包管理工具。

这个工具允许你在你的 Linux 系统/服务器上安装、更新、移除、查询和验证软件。RPM 文件具有 .rpm 后缀名。RPM 包是用必需的库和依赖关系构建的,不会与系统上安装的其他包冲突。

# rpm -qi apachetop
Name        : apachetop
Version     : 0.15.6
Release     : 1.el7
Architecture: x86_6https://archive.linux.cn/4
Install Date: Mon 29 Oct 2018 06:https://archive.linux.cn/47:https://archive.linux.cn/49 AM EDT
Group       : Applications/Internet
Size        : 67020
License     : BSD
Signature   : RSA/SHA256, Mon 22 Jun 2015 09:30:26 AM EDT, Key ID 6a2faea2352c6https://archive.linux.cn/4e5
Source RPM  : apachetop-0.15.6-1.el7.src.rpm
Build Date  : Sat 20 Jun 2015 09:02:37 PM EDT
Build Host  : buildvm-22.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://github.com/tessus/apachetop
Summary     : A top-like display of Apache logs
Description :
ApacheTop watches a logfile generated by Apache (in standard common or
combined logformat, although it doesn't (yet) make use of any of the extra
fields in combined) and generates human-parsable output in realtime.

apachetop 包来自 EPEL 仓库。

方法-https://archive.linux.cn/4:使用 repoquery 命令

repoquery 是一个从 YUM 库查询信息的程序,类似于 rpm 查询。

# repoquery -i httpd

Name        : httpd
Version     : 2.https://archive.linux.cn/4.6
Release     : 80.el7.centos.1
Architecture: x86_6https://archive.linux.cn/4
Size        : 9817285
Packager    : CentOS BuildSystem 
Group       : System Environment/Daemons
URL         : http://httpd.apache.org/
Repository  : updates
Summary     : Apache HTTP Server
Source      : httpd-2.https://archive.linux.cn/4.6-80.el7.centos.1.src.rpm
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.

httpd 包来自 CentOS updates 仓库。

在 Fedora 系统上我们如何得知安装的包来自哪个仓库?

DNF 是 “Dandified yum” 的缩写。DNF 是使用 hawkey/libsolv 库作为后端的下一代 yum 包管理器(yum 的分支)。从 Fedora 18 开始 Aleš Kozumplík 开始开发 DNF,并最终在 Fedora 22 上得以应用/启用。

dnf 命令 用于在 Fedora 22 以及之后的系统上安装、更新、搜索和删除包。它会自动解决依赖并使安装包的过程变得顺畅,不会出现任何问题。

$ dnf info tilix
Last metadata expiration check: 27 days, 10:00:23 ago on Wed 0https://archive.linux.cn/4 Oct 2017 06:https://archive.linux.cn/43:27 AM IST.
Installed Packages
Name         : tilix
Version      : 1.6.https://archive.linux.cn/4
Release      : 1.fc26
Arch         : x86_6https://archive.linux.cn/4
Size         : 3.6 M
Source       : tilix-1.6.https://archive.linux.cn/4-1.fc26.src.rpm
Repo         : @System
From repo    : updates
Summary      : Tiling terminal emulator
URL          : https://github.com/gnunn1/tilix
License      : MPLv2.0 and GPLv3+ and CC-BY-SA
Description  : Tilix is a tiling terminal emulator with the following features:
             : 
             :  - Layout terminals in any fashion by splitting them horizontally or vertically
             :  - Terminals can be re-arranged using drag and drop both within and between
             :    windows
             :  - Terminals can be detached into a new window via drag and drop
             :  - Input can be synchronized between terminals so commands typed in one
             :    terminal are replicated to the others
             :  - The grouping of terminals can be saved and loaded from disk
             :  - Terminals support custom titles
             :  - Color schemes are stored in files and custom color schemes can be created by
             :    simply creating a new file
             :  - Transparent background
             :  - Supports notifications when processes are completed out of view
             : 
             : The application was written using GTK 3 and an effort was made to conform to
             : GNOME Human Interface Guidelines (HIG).

tilix 包来自 Fedora updates 仓库。

在 openSUSE 系统上我们如何得知安装的包来自哪个仓库?

Zypper 是一个使用 libzypp 的命令行包管理器。Zypper 命令 提供了存储库访问、依赖处理、包安装等功能。

$ zypper info nano

Loading repository data...
Reading installed packages...


Information for package nano:
-----------------------------
Repository     : Main Repository (OSS)             
Name           : nano                               
Version        : 2.https://archive.linux.cn/4.2-5.3                          
Arch           : x86_6https://archive.linux.cn/4                             
Vendor         : openSUSE                           
Installed Size : 1017.8 KiB                         
Installed      : No                                 
Status         : not installed                      
Source package : nano-2.https://archive.linux.cn/4.2-5.3.src                 
Summary        : Pico editor clone with enhancements
Description    :                                    
    GNU nano is a small and friendly text editor. It aims to emulate
    the Pico text editor while also offering a few enhancements.

nano 包来自于 openSUSE Main 仓库(OSS)。

在 ArchLinux 系统上我们如何得知安装的包来自哪个仓库?

Pacman 命令 即包管理器工具(package manager utility ),是一个简单的用来安装、构建、删除和管理 Arch Linux 软件包的命令行工具。Pacman 使用 libalpm 作为后端来执行所有的操作。

# pacman -Ss chromium
extra/chromium https://archive.linux.cn/48.0.256https://archive.linux.cn/4.116-1
    The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browser
extra/qt5-webengine 5.5.1-9 (qt qt5)
    Provides support for web applications using the Chromium browser project
community/chromium-bsu 0.9.15.1-2
    A fast paced top scrolling shooter
community/chromium-chromevox latest-1
    Causes the Chromium web browser to automatically install and update the ChromeVox screen reader extention. Note: This
    package does not contain the extension code.
community/fcitx-mozc 2.17.2313.102-1
    Fcitx Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese
    Input)

chromium 包来自 ArchLinux extra 仓库。

或者,我们可以使用以下选项获得关于包的详细信息。

# pacman -Si chromium
Repository      : extra
Name            : chromium
Version         : https://archive.linux.cn/48.0.256https://archive.linux.cn/4.116-1
Description     : The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browser
Architecture    : x86_6https://archive.linux.cn/4
URL             : http://www.chromium.org/
Licenses        : BSD
Groups          : None
Provides        : None
Depends On      : gtk2  nss  alsa-lib  xdg-utils  bzip2  libevent  libxss  icu  libexif  libgcrypt  ttf-font  systemd  dbus
                  flac  snappy  speech-dispatcher  pciutils  libpulse  harfbuzz  libsecret  libvpx  perl  perl-file-basedir
                  desktop-file-utils  hicolor-icon-theme
Optional Deps   : kdebase-kdialog: needed for file dialogs in KDE
                  gnome-keyring: for storing passwords in GNOME keyring
                  kwallet: for storing passwords in KWallet
Conflicts With  : None
Replaces        : None
Download Size   : https://archive.linux.cn/4https://archive.linux.cn/4.https://archive.linux.cn/42 MiB
Installed Size  : 172.https://archive.linux.cn/4https://archive.linux.cn/4 MiB
Packager        : Evangelos Foutras 
Build Date      : Fri 19 Feb 2016 0https://archive.linux.cn/4:17:12 AM IST
Validated By    : MD5 Sum  SHA-256 Sum  Signature

chromium 包来自 ArchLinux extra 仓库。

在基于 Debian 的系统上我们如何得知安装的包来自哪个仓库?

在基于 Debian 的系统例如 Ubuntu、LinuxMint 上可以使用两种方法实现。

方法-1:使用 apt-cache 命令

apt-cache 命令 可以显示存储在 APT 内部数据库的很多信息。这些信息是一种缓存,因为它们是从列在 source.list 文件里的不同的源中获得的。这个过程发生在 apt 更新操作期间。

$ apt-cache policy python3
python3:
  Installed: 3.6.3-0ubuntu2
  Candidate: 3.6.3-0ubuntu3
  Version table:
     3.6.3-0ubuntu3 500
        500 http://in.archive.ubuntu.com/ubuntu artful-updates/main amd6https://archive.linux.cn/4 Packages
 *** 3.6.3-0ubuntu2 500
        500 http://in.archive.ubuntu.com/ubuntu artful/main amd6https://archive.linux.cn/4 Packages
        100 /var/lib/dpkg/status

python3 包来自 Ubuntu updates 仓库。

方法-2:使用 apt 命令

APT 命令 即 “Advanced Packaging Tool”,是 apt-get 命令的替代品,就像 DNF 是如何取代 YUM 一样。它是具有丰富功能的命令行工具并将所有的功能例如 apt-cacheapt-searchdpkgapt-cdromapt-configapt-ket 等包含在一个命令(APT)中,并且还有几个独特的功能。例如我们可以通过 APT 轻松安装 .dpkg 包,但我们不能使用 apt-get 命令安装,更多类似的功能都被包含进了 APT 命令。apt-get 因缺失了很多未被解决的特性而被 apt 取代。

$ apt -a show notepadqq
Package: notepadqq
Version: 1.3.2-1~artful1
Priority: optional
Section: editors
Maintainer: Daniele Di Sarli 
Installed-Size: 1,352 kB
Depends: notepadqq-common (= 1.3.2-1~artful1), coreutils (>= 8.20), libqt5svg5 (>= 5.2.1), libc6 (>= 2.1https://archive.linux.cn/4), libgcc1 (>= 1:3.0), libqt5core5a (>= 5.9.0~beta), libqt5gui5 (>= 5.7.0), libqt5network5 (>= 5.2.1), libqt5printsupport5 (>= 5.2.1), libqt5webkit5 (>= 5.6.0~rc), libqt5widgets5 (>= 5.2.1), libstdc++6 (>= 5.2)
Download-Size: 356 kB
APT-Sources: http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu artful/main amd6https://archive.linux.cn/4 Packages
Description: Notepad++-like editor for Linux
 Text editor with support for multiple programming
 languages, multiple encodings and plugin support.

Package: notepadqq
Version: 1.2.0-1~artful1
Status: install ok installed
Priority: optional
Section: editors
Maintainer: Daniele Di Sarli 
Installed-Size: 1,352 kB
Depends: notepadqq-common (= 1.2.0-1~artful1), coreutils (>= 8.20), libqt5svg5 (>= 5.2.1), libc6 (>= 2.1https://archive.linux.cn/4), libgcc1 (>= 1:3.0), libqt5core5a (>= 5.9.0~beta), libqt5gui5 (>= 5.7.0), libqt5network5 (>= 5.2.1), libqt5printsupport5 (>= 5.2.1), libqt5webkit5 (>= 5.6.0~rc), libqt5widgets5 (>= 5.2.1), libstdc++6 (>= 5.2)
Homepage: http://notepadqq.altervista.org
Download-Size: unknown
APT-Manual-Installed: yes
APT-Sources: /var/lib/dpkg/status
Description: Notepad++-like editor for Linux
 Text editor with support for multiple programming
 languages, multiple encodings and plugin support.

notepadqq 包来自 Launchpad PPA。


via: https://www.2daygeek.com/how-do-we-find-out-the-installed-packages-came-from-which-repository/

作者:Prakash Subramanian 选题:lujun9972 译者:zianglei 校对:wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出

相关内容

Debian 13“Tri...
IT之家 8 月 10 日消息,历经两年零两个月的开发,Debia...
2025-08-16 16:15:18
谷歌推OSS Rebuil...
2025-07-23 01:40:53 作者:狼叫兽 7月22...
2025-07-23 09:13:19
南网科研院等申请开源软件依...
金融界2025年7月19日消息,国家知识产权局信息显示,南方电网科...
2025-07-19 15:14:19
昆仑万维正式发布并开源Sk...
人民财讯6月20日电,6月20日,昆仑万维发布软件工程(SWE)自...
2025-06-20 15:40:28
使用U盘启动安装CentO...
准备踏上稳定之旅:使用U盘安装CentOS详解 在服务器和开发环境...
2025-06-11 10:10:39
使用IDEA把项目上传到g...
使用IDEA把项目上传到gitee仓库在gitee上建立一个仓库第...
2025-06-01 17:15:00

热门资讯

Helix:高级 Linux ... 说到 基于终端的文本编辑器,通常 Vim、Emacs 和 Nano 受到了关注。这并不意味着没有其他...
使用 KRAWL 扫描 Kub... 用 KRAWL 脚本来识别 Kubernetes Pod 和容器中的错误。当你使用 Kubernet...
JStock:Linux 上不... 如果你在股票市场做投资,那么你可能非常清楚投资组合管理计划有多重要。管理投资组合的目标是依据你能承受...
Epic 游戏商店现在可在 S... 现在可以在 Steam Deck 上运行 Epic 游戏商店了,几乎无懈可击! 但是,它是非官方的。...
《Apex 英雄》正式可在 S... 《Apex 英雄》现已通过 Steam Deck 验证,这使其成为支持 Linux 的顶级多人游戏之...
从 Yum 更新中排除特定/某... 作为系统更新的一部分,你也许需要在基于 Red Hat 系统中由于应用依赖排除一些软件包。如果是,如...
通过 SaltStack 管理... 我在搜索Puppet的替代品时,偶然间碰到了Salt。我喜欢puppet,但是我又爱上Salt了:)...
如何在 Github 上创建一... 学习如何复刻一个仓库,进行更改,并要求维护人员审查并合并它。你知道如何使用 git 了,你有一个 G...
Opera 浏览器内置的 VP... 昨天我们报道过 Opera 浏览器内置了 VPN 服务,用户打开它可以防止他们的在线活动被窥视。不过...
如何检查你的 Linux 系统... 不知道在使用哪个初始化系统?以下是方法。每个主流 Linux 发行版(包括 Ubuntu、Fedor...