我們如何得知Linux上安裝的包來自哪個倉庫?
有時候你可能想知道安裝的軟件包來自于哪個倉庫。這將幫助你在遇到包沖突問題時進行故障排除。因為第三方倉庫擁有***版本的軟件包,所以有時候當你試圖安裝一些包的時候會出現兼容性的問題。在 Linux 上一切都是可能的,因為你可以安裝一個即使在你的發行版系統上不能使用的包。你也可以安裝一個***版本的包,即使你的發行版系統倉庫還沒有這個版本,怎么做到的呢?這就是為什么出現了第三方倉庫。它們允許用戶從庫中安裝所有可用的包。
幾乎所有的發行版系統都允許第三方軟件庫。一些發行版還會官方推薦一些不會取代基礎倉庫的第三方倉庫,例如 CentOS 官方推薦安裝 EPEL 庫。
下面是常用的倉庫列表和它們的詳細信息。
- CentOS: EPEL、ELRepo 等是 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 apachetopLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* epel: epel.mirror.constant.comInstalled PackagesName : apachetopArch : x86_64Version : 0.15.6Release : 1.el7Size : 65 kRepo : installedFrom repo : epelSummary : A top-like display of Apache logsURL : https://github.com/tessus/apachetopLicense : BSDDescription : 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 lighttpdLoaded plugins: fastestmirrorlighttpd-1.4.50-1.el7.x86_64checksum_data = a24d18102ed40148cfcc965310a516050ed437d728eeeefb23709486783a4d37checksum_type = sha256command_line = --enablerepo=epel install lighttpd apachetop aria2 atop axelfrom_repo = epelfrom_repo_revision = 1540756729from_repo_timestamp = 1540757483installed_by = 0origin_url = https://epel.mirror.constant.com/7/x86_64/Packages/l/lighttpd-1.4.50-1.el7.x86_64.rpmreason = userreleasever = 7var_contentdir = centosvar_infra = stockvar_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 apachetopName : apachetopVersion : 0.15.6Release : 1.el7Architecture: x86_64Install Date: Mon 29 Oct 2018 06:47:49 AM EDTGroup : Applications/InternetSize : 67020License : BSDSignature : RSA/SHA256, Mon 22 Jun 2015 09:30:26 AM EDT, Key ID 6a2faea2352c64e5Source RPM : apachetop-0.15.6-1.el7.src.rpmBuild Date : Sat 20 Jun 2015 09:02:37 PM EDTBuild Host : buildvm-22.phx2.fedoraproject.orgRelocations : (not relocatable)Packager : Fedora ProjectVendor : Fedora ProjectURL : https://github.com/tessus/apachetopSummary : A top-like display of Apache logsDescription :ApacheTop watches a logfile generated by Apache (in standard common orcombined logformat, although it doesn't (yet) make use of any of the extrafields in combined) and generates human-parsable output in realtime.
apachetop 包來自 EPEL 倉庫。
方法-4:使用 repoquery 命令
repoquery 是一個從 YUM 庫查詢信息的程序,類似于 rpm 查詢。
# repoquery -i httpdName : httpdVersion : 2.4.6Release : 80.el7.centos.1Architecture: x86_64Size : 9817285Packager : CentOS BuildSystemGroup : System Environment/DaemonsURL : http://httpd.apache.org/Repository : updatesSummary : Apache HTTP ServerSource : httpd-2.4.6-80.el7.centos.1.src.rpmDescription :The Apache HTTP Server is a powerful, efficient, and extensibleweb 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 tilixLast metadata expiration check: 27 days, 10:00:23 ago on Wed 04 Oct 2017 06:43:27 AM IST.Installed PackagesName : tilixVersion : 1.6.4Release : 1.fc26Arch : x86_64Size : 3.6 MSource : tilix-1.6.4-1.fc26.src.rpmRepo : @SystemFrom repo : updatesSummary : Tiling terminal emulatorURL : https://github.com/gnunn1/tilixLicense : MPLv2.0 and GPLv3+ and CC-BY-SADescription : 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 nanoLoading repository data...Reading installed packages...Information for package nano:-----------------------------Repository : Main Repository (OSS)Name : nanoVersion : 2.4.2-5.3Arch : x86_64Vendor : openSUSEInstalled Size : 1017.8 KiBInstalled : NoStatus : not installedSource package : nano-2.4.2-5.3.srcSummary : Pico editor clone with enhancementsDescription :GNU nano is a small and friendly text editor. It aims to emulatethe Pico text editor while also offering a few enhancements.
nano 包來自于 openSUSE Main 倉庫(OSS)。
在 ArchLinux 系統上我們如何得知安裝的包來自哪個倉庫?
Pacman 命令 即包管理器工具(package manager utility ),是一個簡單的用來安裝、構建、刪除和管理 Arch Linux 軟件包的命令行工具。Pacman 使用 libalpm 作為后端來執行所有的操作。
# pacman -Ss chromiumextra/chromium 48.0.2564.116-1The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browserextra/qt5-webengine 5.5.1-9 (qt qt5)Provides support for web applications using the Chromium browser projectcommunity/chromium-bsu 0.9.15.1-2A fast paced top scrolling shootercommunity/chromium-chromevox latest-1Causes the Chromium web browser to automatically install and update the ChromeVox screen reader extention. Note: Thispackage does not contain the extension code.community/fcitx-mozc 2.17.2313.102-1Fcitx Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google JapaneseInput)
chromium 包來自 ArchLinux extra 倉庫。
或者,我們可以使用以下選項獲得關于包的詳細信息。
# pacman -Si chromiumRepository : extraName : chromiumVersion : 48.0.2564.116-1Description : The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browserArchitecture : x86_64URL : http://www.chromium.org/Licenses : BSDGroups : NoneProvides : NoneDepends On : gtk2 nss alsa-lib xdg-utils bzip2 libevent libxss icu libexif libgcrypt ttf-font systemd dbusflac snappy speech-dispatcher pciutils libpulse harfbuzz libsecret libvpx perl perl-file-basedirdesktop-file-utils hicolor-icon-themeOptional Deps : kdebase-kdialog: needed for file dialogs in KDEgnome-keyring: for storing passwords in GNOME keyringkwallet: for storing passwords in KWalletConflicts With : NoneReplaces : NoneDownload Size : 44.42 MiBInstalled Size : 172.44 MiBPackager : Evangelos FoutrasBuild Date : Fri 19 Feb 2016 04:17:12 AM ISTValidated 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 python3python3:Installed: 3.6.3-0ubuntu2Candidate: 3.6.3-0ubuntu3Version table:3.6.3-0ubuntu3 500500 http://in.archive.ubuntu.com/ubuntu artful-updates/main amd64 Packages*** 3.6.3-0ubuntu2 500500 http://in.archive.ubuntu.com/ubuntu artful/main amd64 Packages100 /var/lib/dpkg/status
python3 包來自 Ubuntu updates 倉庫。
方法-2:使用 apt 命令
APT 命令 即 “Advanced Packaging Tool”,是 apt-get 命令的替代品,就像 DNF 是如何取代 YUM 一樣。它是具有豐富功能的命令行工具并將所有的功能例如 apt-cache、apt-search、dpkg、apt-cdrom、apt-config、apt-ket 等包含在一個命令(APT)中,并且還有幾個獨特的功能。例如我們可以通過 APT 輕松安裝 .dpkg 包,但我們不能使用 apt-get 命令安裝,更多類似的功能都被包含進了 APT 命令。apt-get 因缺失了很多未被解決的特性而被 apt 取代。
$ apt -a show notepadqqPackage: notepadqqVersion: 1.3.2-1~artful1Priority: optionalSection: editorsMaintainer: Daniele Di SarliInstalled-Size: 1,352 kBDepends: notepadqq-common (= 1.3.2-1~artful1), coreutils (>= 8.20), libqt5svg5 (>= 5.2.1), libc6 (>= 2.14), 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 kBAPT-Sources: http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu artful/main amd64 PackagesDescription: Notepad++-like editor for LinuxText editor with support for multiple programminglanguages, multiple encodings and plugin support.Package: notepadqqVersion: 1.2.0-1~artful1Status: install ok installedPriority: optionalSection: editorsMaintainer: Daniele Di SarliInstalled-Size: 1,352 kBDepends: notepadqq-common (= 1.2.0-1~artful1), coreutils (>= 8.20), libqt5svg5 (>= 5.2.1), libc6 (>= 2.14), 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.orgDownload-Size: unknownAPT-Manual-Installed: yesAPT-Sources: /var/lib/dpkg/statusDescription: Notepad++-like editor for LinuxText editor with support for multiple programminglanguages, multiple encodings and plugin support.
notepadqq 包來自 Launchpad PPA。



















