冬宝不乖不听话 發表於 2022-10-22 19:26:00

Fedora中配置软件存储库:添加、启用、禁用

<span style="font-size: 16px; font-family: times new roman, times">Fedora发行版从存储库获取其软件,每个存储库都附带了许多可安装的免费和专有软件应用程序。 官方Fedora存储库拥有数千个免费和开源应用程序。</span><br><span style="font-size: 16px; font-family: times new roman, times">使用命令行中的DNF包管理器工具在Fedora发行版中配置软件存储库:</span>
<p><span style="font-size: 16px; font-family: times new roman, times">1. 在Fedora中查看启用的存储库:</span></p>
<pre class="prettyprint" data-index="0"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">      sudo dnf repolist<br>运行以下命令从指定的存储库(例如**fedora)**列出包,它将列出从指定的存储库中可用和安装的所有软件包:<br></code></span></pre>
<pre class="prettyprint" data-index="1"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">      sudo dnf repository-packages fedora list<br>要仅显示指定存储库中可用或安装的那些软件包的列表,分别添加<strong>available</strong>或<strong>installed</strong>选项:<br></code></span></pre>
<pre class="prettyprint" data-index="2"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">      sudo dnf repository-packages fedora list available
      sudo dnf repository-packages fedora list installed<br></code></span></pre>
<p><span style="font-size: 16px; font-family: times new roman, times">2. 添加,启用和禁用DNF存储库:</span></p>
<span style="font-size: 16px; font-family: times new roman, times">在向Fedora系统添加新存储库之前,需要通过在/etc/dnf/dnf.conf文件中添加部分或在/etc/yum.repos中添加** .repo文件来定义它。大多数开发人员或软件包维护人员都在.d /目录为DNF存储库提供了自己的.repo文件。</span><br><span style="font-size: 16px; font-family: times new roman, times">原文链接:https://blog.csdn.net/a772304419/article/details/123329258</span>
<pre class="prettyprint" data-index="2"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">例如,要在.repo文件中定义Grafana的存储库:<code class="has-numbering" style="position: unset">sudo vim /etc/yum.repos.d/grafana.repo</code><br>然后在文件中添加<code></code>部分并保存(<code>enabled=0表示不启用)</code>;<br>在Fedora中添加新的DNF存储库:<br></code></span></pre>
<pre class="prettyprint" data-index="4"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">      sudo dnf config-manager --add-repo /etc/yum.repos.d/grafana.repo</code></span><br><br><span style="font-size: 16px; font-family: times new roman, times">要启用或禁用 DNF存储库,例如在尝试从中安装软件包时,使用<code>--enablerepo</code>或<code>--disablerepo</code>选项。</span></pre>
<pre class="prettyprint" data-index="5"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">      sudo dnf --enablerepo=grafana install grafana
      sudo dnf --disablerepo=fedora-extras install grafana <br>还可以使用单个命令启用或禁用多个存储库:<br>      sudo dnf --enablerepo=grafana, repo2, repo3 install grafana package2 package3 <br>      sudo dnf --disablerepo=fedora, fedora-extras, remi install grafana <br>还可以同时启用和禁用存储库:<br></code></span></pre>
<pre class="prettyprint" data-index="7"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">      sudo dnf --enablerepo=grafana --disablerepo=fedora, fedora_extra, remi, elrepo install grafana<br>要永久启用特定存储库,使用<code>--set-enabled</code>选项:<br>      sudo grep enable /etc/yum.repos.d/grafana.repo<br>      sudo dnf config-manager --set-enabled grafana<br></code></span></pre>
<span style="font-size: 16px; font-family: times new roman, times">&nbsp;&nbsp;&nbsp; 要永久禁用特定存储库,使用<code>--set-disabled</code>开关:</span>
<pre class="prettyprint" data-index="9"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">      sudo dnf config-manager --set-disabled grafana</code></span></pre>
<pre class="prettyprint" data-index="7"></pre>
<pre class="prettyprint" data-index="5"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">&nbsp;</code></span></pre>
<pre class="prettyprint" data-index="2"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset"><br><br><br></code></span></pre>
<pre class="prettyprint" data-index="1"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">&nbsp;</code></span></pre>
<pre class="prettyprint" data-index="0"><span style="font-size: 16px; font-family: times new roman, times"><code class="has-numbering" style="position: unset">&nbsp;</code></span></pre><br><br>
来源:https://www.cnblogs.com/liujingli1986/p/16817119.html
頁: [1]
查看完整版本: Fedora中配置软件存储库:添加、启用、禁用