我们如何得知安装的包来自哪个仓库?

有时候你可能想知道安装的软件包来自于哪个仓库。这将帮助你在遇到包冲突问题时进行故障排除。

我们如何得知安装的包来自哪个仓库?

有时候你可能想知道安装的软件包来自于哪个仓库。这将帮助你在遇到包冲突问题时进行故障排除。因为第三方仓库拥有最新版本的软件包,所以有时候当你试图安装一些包的时候会出现兼容性的问题。在 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_64
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.4.50-1.el7.x8664
checksum
data = a24d18102ed40148cfcc965310a516050ed437d728eeeefb23709486783a4d37
checksumtype = sha256
command
line = –enablerepo=epel install lighttpd apachetop aria2 atop axel
fromrepo = epel
from
reporevision = 1540756729
from
repotimestamp = 1540757483
installed
by = 0
originurl = https://epel.mirror.constant.com/7/x8664/Packages/l/lighttpd-1.4.50-1.el7.x8664.rpm
reason = user
releasever = 7
var
contentdir = centos
varinfra = stock
var
uuid = ce328b07-9c0a-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_64
Install Date: Mon 29 Oct 2018 06:47:49 AM EDT
Group : Applications/Internet
Size : 67020
License : BSD
Signature : RSA/SHA256, Mon 22 Jun 2015 09:30:26 AM EDT, Key ID 6a2faea2352c64e5
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 仓库。

方法-4:使用 repoquery 命令

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

“`

repoquery -i httpd

Name : httpd
Version : 2.4.6
Release : 80.el7.centos.1
Architecture: x86_64
Size : 9817285
Packager : CentOS BuildSystem
Group : System Environment/Daemons
URL : http://httpd.apache.org/
Repository : updates
Summary : Apache HTTP Server
Source : httpd-2.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 04 Oct 2017 06:43:27 AM IST.
Installed Packages
Name : tilix
Version : 1.6.4
Release : 1.fc26
Arch : x86_64
Size : 3.6 M
Source : tilix-1.6.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:

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

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

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

主题测试文章,只做测试使用。发布者:eason,转转请注明出处:https://aicodev.cn/2018/11/23/%e6%88%91%e4%bb%ac%e5%a6%82%e4%bd%95%e5%be%97%e7%9f%a5%e5%ae%89%e8%a3%85%e7%9a%84%e5%8c%85%e6%9d%a5%e8%87%aa%e5%93%aa%e4%b8%aa%e4%bb%93%e5%ba%93%ef%bc%9f/

(0)
eason的头像eason
上一篇 2018年11月23日
下一篇 2018年11月23日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信