672 lines
503 KiB
HTML
672 lines
503 KiB
HTML
|
<!DOCTYPE html>
|
|||
|
<html lang="zh"><head><title>Linux 包管理器</title><meta charset="utf-8"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com"/><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM Plex Mono&family=Noto Serif Simplified Chinese:wght@400;700&family=Source Sans Pro:ital,wght@0,400;0,600;1,400;1,600&display=swap"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta property="og:title" content="Linux 包管理器"/><meta property="og:description" content="Linux 包管理器."/><meta property="og:image" content="https://wiki.7wate.com/static/og-image.png"/><meta property="og:width" content="1200"/><meta property="og:height" content="675"/><link rel="icon" href="../../../../static/icon.png"/><meta name="description" content="Linux 包管理器."/><meta name="generator" content="Quartz"/><link href="../../../../index.css" rel="stylesheet" type="text/css" spa-preserve/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css" rel="stylesheet" type="text/css" spa-preserve/><script src="../../../../prescript.js" type="application/javascript" spa-preserve></script><script type="application/javascript" spa-preserve>const fetchData = fetch("../../../../static/contentIndex.json").then(data => data.json())</script></head><body data-slug="Technology/OperatingSystem/Linux/3.基础操作/Linux-包管理器"><div id="quartz-root" class="page"><div id="quartz-body"><div class="left sidebar"><h2 class="page-title"><a href="../../../..">🪴 X·Eden</a></h2><div class="spacer mobile-only"></div><div class="search"><button class="search-button" id="search-button"><p>搜索</p><svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title>Search</title><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"></path><circle cx="8" cy="8" r="7"></circle></g></svg></button><div id="search-container"><div id="search-space"><input autocomplete="off" id="search-bar" name="search" type="text" aria-label="搜索些什么" placeholder="搜索些什么"/><div id="search-layout" data-preview="true"></div></div></div></div><button class="darkmode" id="darkmode"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="dayIcon" x="0px" y="0px" viewBox="0 0 35 35" style="enable-background:new 0 0 35 35" xml:space="preserve" aria-label="暗色模式"><title>暗色模式</title><path d="M6,17.5C6,16.672,5.328,16,4.5,16h-3C0.672,16,0,16.672,0,17.5 S0.672,19,1.5,19h3C5.328,19,6,18.328,6,17.5z M7.5,26c-0.414,0-0.789,0.168-1.061,0.439l-2,2C4.168,28.711,4,29.086,4,29.5 C4,30.328,4.671,31,5.5,31c0.414,0,0.789-0.168,1.06-0.44l2-2C8.832,28.289,9,27.914,9,27.5C9,26.672,8.329,26,7.5,26z M17.5,6 C18.329,6,19,5.328,19,4.5v-3C19,0.672,18.329,0,17.5,0S16,0.672,16,1.5v3C16,5.328,16.671,6,17.5,6z M27.5,9 c0.414,0,0.789-0.168,1.06-0.439l2-2C30.832,6.289,31,5.914,31,5.5C31,4.672,30.329,4,29.5,4c-0.414,0-0.789,0.168-1.061,0.44 l-2,2C26.168,6.711,26,7.086,26,7.5C26,8.328,26.671,9,27.5,9z M6.439,8.561C6.711,8.832,7.086,9,7.5,9C8.328,9,9,8.328,9,7.5 c0-0.414-0.168-0.789-0.439-1.061l-2-2C6.289,4.168,5.914,4,5.5,4C4.672,4,4,4.672,4,5.5c0,0.414,0.168,0.789,0.439,1.06 L6.439,8.561z M33.5,16h-3c-0.828,0-1.5,0.672-1.5,1.5s0.672,1.5,1.5,1.5h3c0.828,0,1.5-0.672,1.5-1.5S34.328,16,33.5,16z M28.561,26.439C28.289,26.168,27.914,26,27.5,26c-0.828,0-1.5,0.672-1.5,1.5c0,0.414,0.168,0.789,0.439,1.06l2,2 C28.711,30.832,29.086,31,29.5,31c0.828,0,1.5-0.672,1.5-1.5c0-0.414-0.168-0.789-0.439-1.061L28.561,26.439z M17.5,29 c-0.829,0-1.5,0.672-1.5,1.5v3c0,0.828,0.671,1.5,1.5,1.5s1.5-0.672,1.5-1.5v-3C19,29.672,18.329,29,17.5,29z M17.5,7 C11.71,7,7,11.71,7,17.5S11.71,28,17.5,28S28,23.29,28,17.5S23.29,7,17.5,7z M17.5,25c-4.136,0-7.5-3.364-7.5-7.5 c0-4.136,3.364-7.5,7.5-7.5c4.136,0,7.5,3.364,7.5,7.5C25,21.636,21.636,25,17.5,25z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
|
|||
|
<p>Linux 系统的强大功能之一在于其庞大、多样化的软件生态。不同于 Windows 或 macOS,Linux 使用包管理器来自动化软件的安装、更新、配置和删除,极大简化了软件管理的复杂性。包管理器不仅确保软件和其依赖关系正确安装,还能保持系统的整洁和更新。</p>
|
|||
|
<h3 id="定义和作用">定义和作用<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#定义和作用" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>包管理器是 Linux 和 Unix-like 系统中用于自动化处理软件包任务的工具。它允许用户搜索、安装、更新、配置和删除软件包,而无需手动下载和解压缩。更重要的是,包管理器处理软件包之间的依赖关系,确保系统稳定运行,避免 ” 依赖地狱 “。</p>
|
|||
|
<h3 id="软件包格式">软件包格式<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#软件包格式" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>Linux 软件包有多种格式,最常见的是 Debian 系的 <code>.deb</code> 和 Red Hat 系的 <code>.rpm</code>。</p>
|
|||
|
<ul>
|
|||
|
<li><strong>.deb</strong>:Debian、Ubuntu 及其衍生版使用的软件包格式,通过 <code>dpkg</code> 和 <code>APT</code> 等工具进行管理。</li>
|
|||
|
<li><strong>.rpm</strong>:Red Hat、Fedora、CentOS 等发行版采用的格式,由 <code>RPM</code> 包管理器以及 <code>YUM</code> 或 <code>DNF</code> 等高级工具处理。</li>
|
|||
|
</ul>
|
|||
|
<p>这些格式基本上定义了如何打包软件、元数据(如版本、依赖关系)以及安装后如何布局文件。</p>
|
|||
|
<h3 id="软件仓库和软件源">软件仓库和软件源<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#软件仓库和软件源" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>软件仓库是托管软件包及其元数据的服务器。每个 Linux 发行版通常都会有一个或多个官方软件仓库,同时也支持添加第三方仓库。软件源(Repository Sources)是软件仓库的地址,用户可以在包管理器中配置这些地址,以便下载和安装软件包。</p>
|
|||
|
<ul>
|
|||
|
<li><strong>官方仓库</strong>:提供由发行版维护团队精选和测试的软件包,确保软件的稳定性和安全性。</li>
|
|||
|
<li><strong>第三方仓库</strong>:提供额外的软件包,可能包括最新的软件版本或官方仓库中未包含的软件。</li>
|
|||
|
</ul>
|
|||
|
<p>用户可以根据需要添加、删除或更改软件源,以优化软件安装和更新过程。</p>
|
|||
|
<h2 id="常用包管理器">常用包管理器<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#常用包管理器" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<p>Linux 的包管理器是系统管理的核心组件,它简化了软件的安装、更新、配置和移除过程。下面是针对主流 Linux 发行版包管理器的详细介绍。</p>
|
|||
|
<h3 id="debianubuntu-系">Debian/Ubuntu 系<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#debianubuntu-系" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<h4 id="dpkg">Dpkg<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#dpkg" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h4>
|
|||
|
<p><strong>dpkg</strong> 是 APT 底层的工具,负责处理 <code>.deb</code> 文件(Debian 软件包格式)。dpkg 直接与软件包交互,执行如安装、移除和提供软件包信息等任务。虽然 dpkg 可以独立使用,但通常与 APT 一起使用以自动处理软件依赖。</p>
|
|||
|
<p>dpkg 最早于 1993 年由 Debian 项目的创始人 Ian Murdock 开发。自此,dpkg 成为了 Debian 项目的核心组件之一,逐步发展壮大。后来,随着 Ubuntu 等基于 Debian 的发行版的出现,dpkg 的使用范围进一步扩大。</p>
|
|||
|
<p>dpkg 的主要设计理念是简单、稳定、可扩展。它旨在为 Debian 及衍生系统提供一个可靠、易于使用的软件包管理基础设施。此外,<strong>dpkg 还遵循 Unix 哲学,即“做好一件事”,专注于软件包的底层管理,而将依赖关系处理等高级功能交给上层工具。</strong></p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>命令</th></tr></thead><tbody><tr><td>安装软件包</td><td><code>dpkg -i <package_file.deb></code></td></tr><tr><td>删除软件包</td><td><code>dpkg -r <package_name></code></td></tr><tr><td>显示已安装软件包信息</td><td><code>dpkg -s <package_name></code></td></tr><tr><td>列出所有已安装软件包</td><td><code>dpkg -l</code></td></tr><tr><td>查询文件所属的软件包</td><td><code>dpkg -S <file_name></code></td></tr></tbody></table></div>
|
|||
|
<h4 id="apt">APT<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#apt" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h4>
|
|||
|
<p><strong>APT (Advanced Package Tool)</strong> 是 Debian 及其衍生版(如 Ubuntu)最常用的包管理工具。APT 是一个高级接口,它能够自动下载、配置、安装和删除软件包。APT 的主要特点包括对依赖关系的自动处理、易于使用的命令行界面、软件包的稳定升级以及对多种下载协议的支持。</p>
|
|||
|
<p>APT 最早在 1998 年由 Debian 开发者 Ian Murdock 和其他开发者创建。当时,Debian 社区意识到需要一个更高级的软件包管理工具来简化系统维护,因此 APT 应运而生。随着时间的推移,APT 得到了持续的改进和扩展,逐渐成为 Debian 及其衍生系统的重要组成部分。</p>
|
|||
|
<p>APT 的实现主要基于 C++ 编程语言,后端库则依赖于 dpkg。<strong>APT 与 dpkg 紧密协作,dpkg 负责底层的软件包安装、卸载和管理,而 APT 则负责处理软件仓库、依赖关系和软件包更新。</strong></p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>命令</th></tr></thead><tbody><tr><td>更新软件包列表</td><td><code>apt update</code></td></tr><tr><td>安装软件包</td><td><code>apt install <package_name></code></td></tr><tr><td>升级软件包</td><td><code>apt upgrade</code></td></tr><tr><td>升级所有软件包</td><td><code>apt full-upgrade</code></td></tr><tr><td>搜索软件包</td><td><code>apt search <package_name></code></td></tr><tr><td>显示软件包信息</td><td><code>apt show <package_name></code></td></tr><tr><td>删除软件包</td><td><code>apt remove <package_name></code></td></tr><tr><td>删除软件包及配置</td><td><code>apt purge <package_name></code></td></tr><tr><td>清理未使用的软件包</td><td><code>apt autoremove</code></td></tr><tr><td>清理下载的软件包文件</td><td><code>apt clean</code></td></tr></tbody></table></div>
|
|||
|
<h3 id="red-hatcentos-系">Red Hat/CentOS 系<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#red-hatcentos-系" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<h4 id="rpm">RPM<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#rpm" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h4>
|
|||
|
<p><strong>RPM (RPM Package Manager)</strong> 是一个包管理系统,用于安装、升级、查询、验证、卸载 RPM 软件包。RPM 是 Fedora、RHEL 及其衍生版的底层包管理工具,YUM 和 DNF 都是在 RPM 之上构建的高级工具,提供了更完整的软件包管理功能。</p>
|
|||
|
<p>RPM 的发展始于 1997 年,当时由 Red Hat 的开发人员创建,用于替代当时较为简单的 Linux 软件包管理工具。随着 Linux 的发展,RPM 得到了广泛的应用,成为了许多基于 Red Hat 的发行版的标准软件包管理工具。现在,RPM 在 Fedora、RHEL、CentOS 等发行版中仍被广泛使用。</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>命令</th></tr></thead><tbody><tr><td>安装 RPM 软件包</td><td><code>rpm -ivh <package_name.rpm></code></td></tr><tr><td>升级 RPM 软件包</td><td><code>rpm -Uvh <package_name.rpm></code></td></tr><tr><td>移除(卸载)软件包</td><td><code>rpm -e <package_name></code></td></tr><tr><td>查询所有已安装的软件包</td><td><code>rpm -qa</code></td></tr><tr><td>查询特定软件包是否已安装</td><td><code>rpm -q <package_name></code></td></tr><tr><td>查询已安装软件包的信息</td><td><code>rpm -qi <package_name></code></td></tr><tr><td>列出软件包中的文件</td><td><code>rpm -ql <package_name></code></td></tr><tr><td>查询某个文件属于哪个软件包</td><td><code>rpm -qf <file_name></code></td></tr><tr><td>显示软件包的依赖关系</td><td><code>rpm -qR <package_name></code></td></tr><tr><td>验证软件包</td><td><code>rpm -V <package_name></code></td></tr><tr><td>查询软件包信息(未安装的)</td><td><code>rpm -qpi <package_name.rpm></code></td></tr><tr><td>查询未安装软件包中的文件</td><td><code>rpm -qpl <package_name.rpm></code></td></tr><tr><td>查询未安装软件包的依赖关系</td><td><code>rpm -qpR <package_name.rpm></code></td></tr><tr><td>导入 RPM GPG key</td><td><code>rpm --import /path/to/key</code></td></tr><tr><td>检查软件包签名</td><td><code>rpm -K <package_name.rpm></code></td></tr></tbody></table></div>
|
|||
|
<h4 id="yum">YUM<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#yum" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h4>
|
|||
|
<p><strong>YUM (Yellowdog Updater, Modified)</strong> 是基于 RPM 包管理的命令行工具,主要用于 Fedora、RHEL 及其衍生系统(如 CentOS)。YUM 使得管理 RPM 软件包变得更简单,自动处理依赖关系,提供易于使用的接口来管理软件仓库。</p>
|
|||
|
<p>Yum 最初由 Seth Vidal 编写,2003 年首次在 Fedora Core 1 中引入。Yum 的设计理念是为了改进 Red Hat Linux 中的软件包管理器,使其更快、更易用和更灵活。目前,Yum 已成为 Red Hat Enterprise Linux(RHEL)和 CentOS 等 Linux 发行版中的标准软件包管理器。</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>命令</th></tr></thead><tbody><tr><td>更新软件包列表</td><td><code>yum makecache</code></td></tr><tr><td>安装软件包</td><td><code>yum install <package_name></code></td></tr><tr><td>更新软件包</td><td><code>yum update <package_name></code></td></tr><tr><td>更新所有软件包</td><td><code>yum update</code></td></tr><tr><td>删除软件包</td><td><code>yum remove <package_name></code></td></tr><tr><td>搜索软件包</td><td><code>yum search <package_name></code></td></tr><tr><td>列出所有可用软件包</td><td><code>yum list available</code></td></tr></tbody></table></div>
|
|||
|
<h4 id="dnf">DNF<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#dnf" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h4>
|
|||
|
<p><strong>DNF (Dandified YUM)</strong> 是 YUM 的下一代版本,旨在提供更好的性能和改进的依赖关系解决算法。DNF 采用了新的解决方案架构,改进了用户界面,并支持模块化和容器化应用。</p>
|
|||
|
<p>DNF 最初是由 Fedora 项目推出的 YUM 的替代品,目的是提供更好的性能、更好的内存管理和更好的依赖关系解决方案。随着时间的推移,DNF 在 Red Hat 及其衍生产品中逐渐取代了 YUM。</p>
|
|||
|
<p>DNF 的实现基于 Python,使用 RPM 库进行底层软件包管理。DNF 的核心设计思想是提供更好的性能、内存管理和依赖关系解决方案,同时支持多个软件包仓库、插件和模块化架构。</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>命令</th></tr></thead><tbody><tr><td>更新软件包列表</td><td><code>dnf makecache</code></td></tr><tr><td>安装软件包</td><td><code>dnf install <package_name></code></td></tr><tr><td>更新软件包</td><td><code>dnf upgrade <package_name></code></td></tr><tr><td>更新所有软件包</td><td><code>dnf upgrade</code></td></tr><tr><td>删除软件包</td><td><code>dnf remove <package_name></code></td></tr><tr><td>搜索软件包</td><td><code>dnf search <package_name></code></td></tr><tr><td>清理缓存</td><td><code>dnf clean all</code></td></tr></tbody></table></div>
|
|||
|
<h3 id="arch-linux">Arch Linux<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#arch-linux" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p><strong>Pacman</strong> 是 Arch Linux 的官方包管理工具,它结合了一个简单的二进制包格式和一个易于使用的构建系统。Pacman 的特点包括易于理解的命令语法、对依赖关系的自动处理以及对滚动更新的原生支持。</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>命令</th></tr></thead><tbody><tr><td>更新软件包数据库</td><td><code>pacman -Sy</code></td></tr><tr><td>安装软件包</td><td><code>pacman -S <package_name></code></td></tr><tr><td>更新所有软件包</td><td><code>pacman -Syu</code></td></tr><tr><td>删除软件包</td><td><code>pacman -R <package_name></code></td></tr><tr><td>搜索软件包</td><td><code>pacman -Ss <search_term></code></td></tr><tr><td>列出已安装软件包</td><td><code>pacman -Q</code></td></tr><tr><td>清理未使用的包</td><td><code>pacman -Rns $(pacman -Qdtq)</code></td></tr></tbody></table></div>
|
|||
|
<h3 id="suseopensuse-系">SUSE/openSUSE 系<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#suseopensuse-系" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p><strong>Zypper</strong> 是 SUSE Linux 发行版的命令行包管理工具。它提供了对 RPM 软件包的全面管理,包括安装、更新、搜索和卸载软件包。Zypper 的特点是对软件仓库的高级管理能力和对依赖关系处理的强大支持。</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>命令</th></tr></thead><tbody><tr><td>更新软件包列表</td><td><code>zypper refresh</code></td></tr><tr><td>安装软件包</td><td><code>zypper install <package_name></code></td></tr><tr><td>更新软件包</td><td><code>zypper update <package_name></code></td></tr><tr><td>更新所有软件包</td><td><code>zypper update</code></td></tr><tr><td>删除软件包</td><td><code>zypper remove <package_name></code></td></tr><tr><td>搜索软件包</td><td><code>zypper search <package_name></code></td></tr><tr><td>列出所有软件仓库</td><td><code>zypper repos</code></td></tr></tbody></table></div>
|
|||
|
<h3 id="gentoo">Gentoo<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#gentoo" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p><strong>Portage</strong> 是 Gentoo Linux 的包管理系统,它是基于源代码的包管理系统的一个例子。Portage 包括一个命令行界面工具(<code>emerge</code>),用户可以通过它安装、搜索、查询和维护软件包。Portage 的特点是高度可配置性,允许用户以最适合其需求的方式编译软件。</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>命令</th><th>操作</th></tr></thead><tbody><tr><td><code>emerge --sync</code></td><td>同步软件包数据库</td></tr><tr><td>emerge <package_name></td><td>安装软件包</td></tr><tr><td>emerge —update —deep —newuse @world</td><td>更新系统</td></tr><tr><td>emerge —deselect <package_name></td><td>删除软件包</td></tr><tr><td>emerge —search <package_name></td><td>搜索软件包</td></tr><tr><td>qlist -I</td><td>列出所有安装的软件包</td></tr><tr><td>emerge —update <package_name></td><td>更新软件包</td></tr><tr><td>emerge —depclean</td><td>检查依赖性并重新构建</td></tr><tr><td>equery list <package_name></td><td>查看软件包信息</td></tr></tbody></table></div>
|
|||
|
<h2 id="实践操作">实践操作<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#实践操作" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<h3 id="更新和升级">更新和升级<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#更新和升级" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<pre><code class="mermaid">graph LR
|
|||
|
A[开始] --> B{检查更新}
|
|||
|
B -->|有更新| C[下载更新]
|
|||
|
B -->|无更新| F[结束,系统已是最新]
|
|||
|
C --> D[安装更新]
|
|||
|
D --> E{需要清理旧软件包吗?}
|
|||
|
E -->|是| G[清理旧版本软件包]
|
|||
|
E -->|否| F
|
|||
|
G --> F
|
|||
|
</code></pre>
|
|||
|
<ol>
|
|||
|
<li>
|
|||
|
<p><strong>更新软件包列表</strong></p>
|
|||
|
<p>在安装新软件或升级现有软件之前,应该更新本地软件包列表,以确保获取到最新版本的软件包信息。可以通过以下命令来更新软件包列表:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> update</span></span></code></pre></figure>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p><strong>升级所有可升级的软件包</strong></p>
|
|||
|
<p>更新了软件包列表后,可以通过以下命令来升级所有已安装的软件包至最新版本:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> upgrade</span></span></code></pre></figure>
|
|||
|
<p>此命令会根据依赖关系自动升级软件包,但它不会升级那些会引起依赖问题的软件包。</p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p><strong>全面升级系统</strong></p>
|
|||
|
<p>要执行一个更彻底的系统升级(可能包括删除一些旧软件包),可以使用以下命令:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> full-upgrade</span></span></code></pre></figure>
|
|||
|
<p>这个命令会更积极地处理依赖关系,可能会安装新软件包或删除无法升级的软件包以满足其他软件包的依赖需求。</p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p><strong>清理不再需要的软件包</strong></p>
|
|||
|
<p>在软件升级过程中,一些旧版本的软件包或不再需要的依赖可能会保留在系统上。可以通过以下命令清理这些不再需要的软件包:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> autoremove</span></span></code></pre></figure>
|
|||
|
</li>
|
|||
|
</ol>
|
|||
|
<h3 id="管理仓库源">管理仓库源<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#管理仓库源" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>仓库源是指软件包管理器所用的软件仓库,用于提供软件包的下载和更新。常见的 Linux 发行版都有官方仓库源,也有一些社区提供的非官方仓库源,以及一些专门为国内用户提供的镜像源。</p>
|
|||
|
<p>官方仓库源是由 Linux 发行版官方维护的软件仓库,提供的软件包通常经过严格的测试和验证,保证了软件的稳定性和安全性。用户可以通过软件包管理器直接访问官方仓库源,以获取最新的软件包和更新。</p>
|
|||
|
<ul>
|
|||
|
<li>
|
|||
|
<p>Debian 官方源:<a href="http://deb.debian.org/" class="external">http://deb.debian.org/<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a></p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>Debian 安全源:<a href="https://security.debian.org/" class="external">https://security.debian.org/<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a></p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>Ubuntu 官方源:<a href="http://archive.ubuntu.com" class="external">http://archive.ubuntu.com<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a></p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>CentOS 官方源:<a href="http://mirror.centos.org/" class="external">http://mirror.centos.org/<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a></p>
|
|||
|
</li>
|
|||
|
</ul>
|
|||
|
<p>由于国内网络环境的特殊性,使用国外官方仓库源可能会遇到较慢的下载速度或无法连接的问题。因此,一些开源社区提供了针对国内用户的镜像仓库源,用于加速软件包下载和更新。</p>
|
|||
|
<ul>
|
|||
|
<li>阿里云开源镜像站:<a href="http://mirrors.aliyun.com/" class="external">http://mirrors.aliyun.com/<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a></li>
|
|||
|
<li>中科大开源软件镜像站:<a href="https://mirrors.ustc.edu.cn/" class="external">https://mirrors.ustc.edu.cn/<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a></li>
|
|||
|
<li>教育网联合镜像站:<a href="https://help.mirrors.cernet.edu.cn/" class="external">https://help.mirrors.cernet.edu.cn/<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a></li>
|
|||
|
</ul>
|
|||
|
<h3 id="一键脚本">一键脚本<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#一键脚本" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>LinuxMirrors 是一个由 SuperManito 维护的 Linux 镜像站点列表。该项目旨在为 Linux 用户提供可靠、高速的镜像站点列表,用户可以通过该列表轻松找到离自己最近的镜像站点,以加速软件包的下载和更新。</p>
|
|||
|
<p>LinuxMirrors: <a href="https://github.com/SuperManito/LinuxMirrors" class="external">https://github.com/SuperManito/LinuxMirrors<svg aria-hidden="true" class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg></a></p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bash</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> <(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -sSL</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://linuxmirrors.cn/main.sh)</span></span></code></pre></figure>
|
|||
|
<h2 id="问题解决">问题解决<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#问题解决" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<p>在 Linux 系统的维护过程中,备份、安全性验证以及故障排除是保障系统稳定运行的重要措施。以下是这些方面的详细介绍和指导。</p>
|
|||
|
<h3 id="备份和恢复">备份和恢复<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#备份和恢复" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>备份软件包列表可以帮助你在系统重装或迁移时快速恢复之前的软件环境。</p>
|
|||
|
<h4 id="1-备份软件包列表">1. 备份软件包列表<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#1-备份软件包列表" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h4>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>发行版</th><th>备份命令</th></tr></thead><tbody><tr><td>Debian/Ubuntu</td><td><code>dpkg --get-selections > packages_list.txt</code></td></tr><tr><td>Fedora/CentOS (DNF)</td><td><code>dnf list installed > packages_list.txt</code></td></tr><tr><td>Arch Linux</td><td><code>pacman -Qqe > packages_list.txt</code></td></tr></tbody></table></div>
|
|||
|
<h4 id="2-恢复软件包">2. 恢复软件包<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#2-恢复软件包" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h4>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>发行版</th><th>恢复命令</th></tr></thead><tbody><tr><td>Debian/Ubuntu</td><td>1. <code>dpkg --set-selections < packages_list.txt</code><br/>2. <code>apt-get dselect-upgrade</code></td></tr><tr><td>Fedora/CentOS (DNF)</td><td><code>dnf install $(cat packages_list.txt)</code></td></tr><tr><td>Arch Linux</td><td><code>pacman -S --needed $(< packages_list.txt)</code></td></tr></tbody></table></div>
|
|||
|
<h3 id="安全性和验证">安全性和验证<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#安全性和验证" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>确保软件包的完整性和安全性对于维护 Linux 系统的安全至关重要。下面详细介绍如何操作 GPG 签名验证和校验和检查:</p>
|
|||
|
<h4 id="gpg-签名验证">GPG 签名验证<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#gpg-签名验证" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h4>
|
|||
|
<p>GPG(GNU Privacy Guard)签名验证是一种确认软件包未被篡改并且确实来自发布者的方法。</p>
|
|||
|
<p><strong>Debian/Ubuntu(使用 APT)</strong>:</p>
|
|||
|
<ol>
|
|||
|
<li><strong>导入 GPG 密钥</strong>:如果你尝试安装一个第三方软件包,首先需要导入其 GPG 密钥,使用命令 <code>sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY_ID></code>。</li>
|
|||
|
<li><strong>验证软件包</strong>:APT 在下载和安装软件包时自动验证 GPG 签名。如果验证失败,APT 将停止安装过程并显示错误。</li>
|
|||
|
</ol>
|
|||
|
<p><strong>Fedora/CentOS(使用 RPM)</strong>:</p>
|
|||
|
<ol>
|
|||
|
<li><strong>导入 GPG 密钥</strong>:首先,导入软件包签名用的 GPG 密钥,使用命令 <code>sudo rpm --import /path/to/key</code>。</li>
|
|||
|
<li><strong>检查软件包签名</strong>:在安装 RPM 包之前,可以使用 <code>rpm --checksig -v <package.rpm></code> 命令检查软件包的签名。</li>
|
|||
|
</ol>
|
|||
|
<h4 id="校验和检查">校验和检查<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#校验和检查" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h4>
|
|||
|
<p>校验和是文件的小型数字摘要,用于检测文件是否在传输过程中被篡改。使用校验和进行文件完整性检查是一个好习惯。</p>
|
|||
|
<p>使用 sha256sum 检查:</p>
|
|||
|
<ol>
|
|||
|
<li>首先,你需要获取软件包的 SHA256 校验和,通常在软件下载页面或通过安全信道由软件发布者提供。</li>
|
|||
|
<li>下载完软件包后,在终端中使用命令 <code>sha256sum <downloaded_file></code> 生成文件的 SHA256 校验和。</li>
|
|||
|
<li>比较计算出的校验和与发布者提供的校验和。如果两者相同,说明文件未被篡改,可以安全安装。</li>
|
|||
|
</ol>
|
|||
|
<h2 id="常见问题和故障排除">常见问题和故障排除<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#常见问题和故障排除" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<p>在软件包的安装和更新过程中,可能会遇到各种问题,如依赖关系错误、软件源不可达、包损坏等。</p>
|
|||
|
<h3 id="解决依赖问题">解决依赖问题<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#解决依赖问题" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>软件包依赖问题通常发生在软件包需要但未安装的其他包,或者是需要特定版本的包而系统上安装的是不兼容版本。大多数现代的包管理器都能自动处理依赖问题,但有时候可能需要手动干预。</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>Debian/Ubuntu</th><th>Fedora/CentOS (DNF)</th></tr></thead><tbody><tr><td>自动修复依赖</td><td><code>sudo apt-get -f install</code></td><td><code>sudo dnf check</code></td></tr><tr><td>搜索软件包</td><td><code>apt search <package_name></code></td><td><code>dnf search <package_name></code></td></tr></tbody></table></div>
|
|||
|
<h3 id="更新软件源">更新软件源<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#更新软件源" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>软件源或仓库是网络上或本地的软件包集合。系统通过软件源获取和安装软件包。如果软件源列表过时或软件源服务器不可达,可能会导致无法安装或更新软件包。更新软件源列表或更换到更快的镜像服务器可以解决这个问题。</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>Debian/Ubuntu</th><th>Fedora/CentOS (DNF)</th></tr></thead><tbody><tr><td>编辑软件源列表</td><td>编辑 <code>/etc/apt/sources.list</code> 文件</td><td>编辑 <code>/etc/yum.repos.d/</code> 目录下的文件</td></tr><tr><td>清理缓存</td><td><code>sudo apt clean</code></td><td><code>sudo dnf clean all</code></td></tr></tbody></table></div>
|
|||
|
<h3 id="修复损坏的包">修复损坏的包<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#修复损坏的包" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>损坏的软件包可能会阻止软件正常安装或运行。这可能是由于下载过程中的错误、磁盘错误或其他问题导致的文件损坏。重新安装软件包通常可以解决这个问题。</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="table-container"><table><thead><tr><th>操作</th><th>Debian/Ubuntu</th><th>Fedora/CentOS (DNF)</th></tr></thead><tbody><tr><td>重新安装软件包</td><td><code>sudo apt-get install --reinstall <package_name></code></td><td><code>sudo dnf reinstall <package_name></code></td></tr><tr><td>清理缓存</td><td><code>sudo apt clean</code></td><td><code>sudo dnf clean all</code></td></tr></tbody></table></div>
|
|||
|
<h2 id="通用包管理器">通用包管理器<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#通用包管理器" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h2>
|
|||
|
<p>在 Linux 生态系统中,通用包管理器如 Flatpak 和 AppImage 提供了跨发行版的软件分发方案,使得应用程序的安装和运行变得更加容易和安全。这些工具各有特点,适用于不同的场景和需求。</p>
|
|||
|
<h3 id="flatpak">Flatpak<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#flatpak" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p><strong>基础知识</strong>: Flatpak 通过提供一个沙盒环境,允许应用程序在其自己的隔离空间中运行,与系统的其他部分相互独立。这种方法不仅提高了系统的安全性,还解决了传统的依赖问题,因为每个 Flatpak 应用都包含了其运行所需的所有依赖。</p>
|
|||
|
<p>首先,确保你的系统已安装 Flatpak。在大多数发行版中,可以通过包管理器来安装 Flatpak:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Debian/Ubuntu</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> apt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> flatpak</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Fedora</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> dnf</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> flatpak</span></span>
|
|||
|
<span data-line> </span>
|
|||
|
<span data-line><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Arch Linux</span></span>
|
|||
|
<span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sudo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> pacman</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -S</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> flatpak</span></span></code></pre></figure>
|
|||
|
<ol>
|
|||
|
<li><strong>添加 Flathub 仓库</strong>: Flathub 是最流行的 Flatpak 应用仓库之一。通过以下命令添加 Flathub 仓库:</li>
|
|||
|
</ol>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">flatpak</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> remote-add</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --if-not-exists</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> flathub</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://flathub.org/repo/flathub.flatpakrepo</span></span></code></pre></figure>
|
|||
|
<ol>
|
|||
|
<li><strong>安装 Flatpak 应用</strong>: 安装应用非常简单,只需知道应用的 ID。例如,安装 Spotify:</li>
|
|||
|
</ol>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">flatpak</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> flathub</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> com.spotify.Client</span></span></code></pre></figure>
|
|||
|
<ol>
|
|||
|
<li><strong>运行 Flatpak 应用</strong>: 安装后,可以通过以下命令运行应用:</li>
|
|||
|
</ol>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">flatpak</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> com.spotify.Client</span></span></code></pre></figure>
|
|||
|
<h3 id="appimage">AppImage<a role="anchor" aria-hidden="true" tabindex="-1" data-no-popover="true" href="#appimage" class="internal"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a></h3>
|
|||
|
<p>AppImage 提供了一种便携式软件分发方法,应用程序及其依赖被打包在单一的 AppImage 文件中。用户只需下载这个文件,无需安装,就可以运行应用程序。</p>
|
|||
|
<p><strong>使用 AppImage</strong>: 使用 AppImage 极其简单,只需几个步骤:</p>
|
|||
|
<ol>
|
|||
|
<li>
|
|||
|
<p><strong>下载 AppImage 文件</strong>:首先,从应用程序的官方网站或 GitHub 发布页面下载 AppImage 文件。</p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p><strong>赋予执行权限</strong>:下载后,需要为 AppImage 文件赋予执行权限。在文件所在的目录中打开终端,执行以下命令:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">chmod</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> +x</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> <</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">AppImage_Fil</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">e</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">></span></span></code></pre></figure>
|
|||
|
<p>替换 <code><AppImage_File></code> 为你的 AppImage 文件名。</p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p><strong>运行 AppImage</strong>:赋予执行权限后,直接点击文件或在终端中执行文件,即可启动应用程序:</p>
|
|||
|
<figure data-rehype-pretty-code-figure><pre tabindex="0" data-language="shell" data-theme="github-light github-dark"><code data-language="shell" data-theme="github-light github-dark" style="display:grid;"><span data-line><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><AppImage_File></span></span></code></pre></figure>
|
|||
|
</li>
|
|||
|
</ol></article><hr/><div class="page-footer"></div></div><div class="right sidebar"><div class="graph"><h3>关系图谱</h3><div class="graph-outer"><div id="graph-container" data-cfg="{"drag":true,"zoom":true,"depth":1,"scale":1.1,"repelForce":0.5,"centerForce":0.3,"linkDistance":30,"fontSize":0.6,"opacityScale":1,"showTags":true,"removeTags":[],"focusOnHover":false}"></div><button id="global-graph-icon" aria-label="Global Graph"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 55 55" fill="currentColor" xml:space="preserve"><path d="M49,0c-3.309,0-6,2.691-6,6c0,1.035,0.263,2.009,0.726,2.86l-9.829,9.829C32.542,17.634,30.846,17,29,17
|
|||
|
s-3.542,0.634-4.898,1.688l-7.669-7.669C16.785,10.424,17,9.74,17,9c0-2.206-1.794-4-4-4S9,6.794,9,9s1.794,4,4,4
|
|||
|
c0.74,0,1.424-0.215,2.019-0.567l7.669,7.669C21.634,21.458,21,23.154,21,25s0.634,3.542,1.688,4.897L10.024,42.562
|
|||
|
C8.958,41.595,7.549,41,6,41c-3.309,0-6,2.691-6,6s2.691,6,6,6s6-2.691,6-6c0-1.035-0.263-2.009-0.726-2.86l12.829-12.829
|
|||
|
c1.106,0.86,2.44,1.436,3.898,1.619v10.16c-2.833,0.478-5,2.942-5,5.91c0,3.309,2.691,6,6,6s6-2.691,6-6c0-2.967-2.167-5.431-5-5.91
|
|||
|
v-10.16c1.458-0.183,2.792-0.759,3.898-1.619l7.669,7.669C41.215,39.576,41,40.26,41,41c0,2.206,1.794,4,4,4s4-1.794,4-4
|
|||
|
s-1.794-4-4-4c-0.74,0-1.424,0.215-2.019,0.567l-7.669-7.669C36.366,28.542,37,26.846,37,25s-0.634-3.542-1.688-4.897l9.665-9.665
|
|||
|
C46.042,11.405,47.451,12,49,12c3.309,0,6-2.691,6-6S52.309,0,49,0z M11,9c0-1.103,0.897-2,2-2s2,0.897,2,2s-0.897,2-2,2
|
|||
|
S11,10.103,11,9z M6,51c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S8.206,51,6,51z M33,49c0,2.206-1.794,4-4,4s-4-1.794-4-4
|
|||
|
s1.794-4,4-4S33,46.794,33,49z M29,31c-3.309,0-6-2.691-6-6s2.691-6,6-6s6,2.691,6,6S32.309,31,29,31z M47,41c0,1.103-0.897,2-2,2
|
|||
|
s-2-0.897-2-2s0.897-2,2-2S47,39.897,47,41z M49,10c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S51.206,10,49,10z"></path></svg></button></div><div id="global-graph-outer"><div id="global-graph-container" data-cfg="{"drag":true,"zoom":true,"depth":-1,"scale":0.9,"repelForce":0.5,"centerForce":0.3,"linkDistance":30,"fontSize":0.6,"opacityScale":1,"showTags":true,"removeTags":[],"focusOnHover":true}"></div></div></div><div class="toc desktop-only"><button type="button" id="toc" class aria-controls="toc-content" aria-expanded="true"><h3>目录</h3><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="fold"><polyline points="6 9 12 15 18 9"></polyline></svg></button><div id="toc-content" class><ul class="overflow"><li class="depth-0"><a href="#包管理器" data-for="包管理器">包管理器</a></li><li class="depth-1"><a href="#定义和作用" data-for="定义和作用">定义和作用</a></li><li class="depth-1"><a href="#软件包格式" data-for="软件包格式">软件包格式</a></li><li class="depth-1"><a href="#软件仓库和软件源" data-for="软件仓库和软件源">软件仓库和软件源</a></li><li class="depth-0"><a href="#常用包管理器" data-for="常用包管理器">常用包管理器</a></li><li class="depth-1"><a href="#debianubuntu-系" data-for="debianubuntu-系">Debian/Ubuntu 系</a></li><li class="depth-1"><a href="#red-hatcentos-系" data-for="red-hatcentos-系">Red Hat/CentOS 系</a></li><li class="depth-1"><a href="#arch-linux" data-for="arch-linux">Arch Linux</a></li><li class="depth-1"><a href="#suseopensuse-系" data-for="suseopensuse-系">SUSE/openSUSE 系</a></li><li class="depth-1"><a href="#gentoo" data-for="gentoo">Gentoo</a></li><li class="depth-0"><a href="#实践操作" data-for="实践操作">实践操作</a></li><li class="depth-1"><a href="#更新和升级" data-for="更新和升级">更新和升级</a></li><li class="depth-1"><a href="#管理仓库源" data-for="管理仓库源">管理仓库源</a></li><li class="depth-1"><a href="#一键脚本" data-for="一键脚本">一键脚本</a></li><li class="depth-0"><a href="#问题解决" data-for="问题解决">问题解决</a></li><li class="depth-1"><a href="#备份和恢复" data-for="备份和恢复">备份和恢复</a></li><li class="depth-1"><a href="#安全性和验证" data-for="安全性和验证">安全性和验证</a></li><li class="depth-0"><a href="#常见问题和故障排除" data-for="常见问题和故障排除">常见问题和故障排除</a></li><li class="depth-1"><a href="#解决依赖问题" data-for="解决依赖问题">解决依赖问题</a></li><li class="depth-1"><a href="#更新软件源" data-for="更新软件源">更新软件源</a></li><li class="depth-1"><a href="#修复损坏的包" data-for="修复损坏的包">修复损坏的包</a></li><li class="depth-0"><a href="#通用包管理器" data-for="通用包管理器">通用包管理器</a></li><li class="depth-1"><a href="#flatpak" data-for="flatpak">Flatpak</a></li><li class="depth-1"><a href="#appimage" data-for="appimage">AppImage</a></li></ul></div></div><div class="explorer mobile-only"><button type="button" id="explorer" data-behavior="collapse" data-collapsed="collapsed" data-savestate="true" data-tree="[{"path":"Personal","collapsed":true},{"path":"Personal/Blog","collapsed":true},{"path":"Personal/Blog/2018","collapsed":true},{"path":"Personal/Blog/2020","collapsed":true},{"path":"Personal/Blog/2021","collapsed":true},{"path":"Personal/Blog/2022","collapsed":true},{"path":"Personal/Blog/2023","collapsed":true},{"path":"Personal/Blog/2024","col
|
|||
|
</script><script type="module">
|
|||
|
let mermaidImport = undefined
|
|||
|
document.addEventListener('nav', async () => {
|
|||
|
if (document.querySelector("code.mermaid")) {
|
|||
|
mermaidImport ||= await import('https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.7.0/mermaid.esm.min.mjs')
|
|||
|
const mermaid = mermaidImport.default
|
|||
|
const darkMode = document.documentElement.getAttribute('saved-theme') === 'dark'
|
|||
|
mermaid.initialize({
|
|||
|
startOnLoad: false,
|
|||
|
securityLevel: 'loose',
|
|||
|
theme: darkMode ? 'dark' : 'default'
|
|||
|
})
|
|||
|
|
|||
|
await mermaid.run({
|
|||
|
querySelector: '.mermaid'
|
|||
|
})
|
|||
|
}
|
|||
|
});
|
|||
|
</script><script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/copy-tex.min.js" type="application/javascript"></script><script src="../../../../postscript.js" type="module"></script></html>
|