跃哥 發表於 2024-12-22 00:21:00

debian使用apt升级内核

<h2 id="一默认源升级">一、默认源升级</h2>
<ol>
<li>更新源之后,搜索可用的镜像</li>
</ol>
<pre><code>sudo apt update
sudo apt search linux-image
</code></pre>
<p>搜索结果样例如下:</p>
<pre><code>Sorting...
Full Text Search...
linux-image-6.1.0-11-amd64/stable-security 6.1.38-4 amd64
Linux 6.1 for 64-bit PCs (signed)

linux-image-6.1.0-11-cloud-amd64/stable-security 6.1.38-4 amd64
Linux 6.1 for x86-64 cloud (signed)

linux-image-6.1.0-11-rt-amd64/stable-security 6.1.38-4 amd64
Linux 6.1 for 64-bit PCs, PREEMPT_RT (signed)

linux-image-6.1.0-12-amd64/stable-security 6.1.52-1 amd64
Linux 6.1 for 64-bit PCs (signed)

linux-image-6.1.0-12-cloud-amd64/stable-security 6.1.52-1 amd64
Linux 6.1 for x86-64 cloud (signed)

linux-image-6.1.0-12-rt-amd64/stable-security 6.1.52-1 amd64
Linux 6.1 for 64-bit PCs, PREEMPT_RT (signed)

linux-image-6.1.0-17-amd64/stable-security 6.1.69-1 amd64
Linux 6.1 for 64-bit PCs (signed)

linux-image-6.1.0-17-cloud-amd64/stable-security 6.1.69-1 amd64
Linux 6.1 for x86-64 cloud (signed)

linux-image-6.1.0-17-rt-amd64/stable-security 6.1.69-1 amd64
Linux 6.1 for 64-bit PCs, PREEMPT_RT (signed)

linux-image-6.1.0-20-amd64/stable-security 6.1.85-1 amd64
Linux 6.1 for 64-bit PCs (signed)
</code></pre>
<p>选择你要安装的版本,执行 <strong>sudo apt install</strong> 命令安装即可,比如:</p>
<pre><code class="language-bash">sudo apt install linux-image-6.1.0-17-amd64
</code></pre>
<p>其他:上面的版本中有些带有后缀,它们的意思分别是:</p>
<table>
<thead>
<tr>
<th>内核版本</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>linux-image-<code>&lt;version&gt;</code></td>
<td>这是最基本的内核包,包含特定版本的内核映像。</td>
</tr>
<tr>
<td>linux-image-<code>&lt;version&gt;</code>-generic</td>
<td>适用于大多数计算机,包含标准内核配置,适合一般用户。</td>
</tr>
<tr>
<td>linux-image-<code>&lt;version&gt;</code>-lowlatency</td>
<td>针对需要低延迟的应用设计,适合音频和实时处理等场景。</td>
</tr>
<tr>
<td>linux-image-<code>&lt;version&gt;</code>-server</td>
<td>为服务器优化的内核,通常删除了一些不必要的功能,以提高性能和稳定性。</td>
</tr>
<tr>
<td>linux-image-<code>&lt;version&gt;</code>-rt</td>
<td>实时内核,提供更快的响应时间,适合需要高实时性的应用。</td>
</tr>
<tr>
<td>linux-image-<code>&lt;version&gt;</code>-unsigned</td>
<td>未签名的内核映像,通常用于开发或测试目的。</td>
</tr>
<tr>
<td>linux-image-<code>&lt;version&gt;</code>-debug</td>
<td>含有调试信息的内核,适合开发人员进行调试和分析。</td>
</tr>
<tr>
<td>linux-image-<code>&lt;version&gt;</code>-cloud</td>
<td>表示该内核是为云计算环境优化的</td>
</tr>
<tr>
<td>linux-image-<code>&lt;version&gt;</code>-custom</td>
<td>用户自定义编译的内核,通常包含特定功能或补丁。</td>
</tr>
</tbody>
</table>
<h2 id="二backports源更新">二、backports源更新</h2>
<p>在 <strong>Debian</strong> 系的操作系统中,<strong>Backports</strong> 源是一个特殊的软件包源,主要用于提供较新版本的软件包。</p>
<table>
<thead>
<tr>
<th>源类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>主源(Main)</td>
<td>包含 Debian 项目维护的完全自由的软件包,提供最稳定且经过充分测试的软件。</td>
</tr>
<tr>
<td>限制源(Contrib)</td>
<td>包含依赖于非自由软件的自由软件。虽然软件本身是自由的,但它可能需要非自由组件才能正常工作。</td>
</tr>
<tr>
<td>非自由源(Non-free)</td>
<td>包含不符合 Debian 自由软件指南的软件,这些软件可能有版权限制或其他限制。</td>
</tr>
<tr>
<td>测试源(Testing)</td>
<td>包含正在开发中的软件包,可能会比稳定版更新,但相对不够稳定,适合希望尝试新特性的用户。</td>
</tr>
<tr>
<td>不稳定源(Unstable)</td>
<td>也称为 "Sid",是 Debian 的开发版本,包含最新的软件包,适合开发者和测试人员,但不适合生产环境。</td>
</tr>
</tbody>
</table>
<ol>
<li>更改 <strong>source.list</strong> 为 <strong>BackPorts</strong> 源,编辑 <strong>/etc/apt/sources.list</strong>,在文件中添加以下行(请根据你的 Debian 版本号进行替换,例如 buster-backports 或 bullseye-backports)</li>
</ol>
<pre><code>deb http://deb.debian.org/debian &lt;你的版本&gt;-backports main
</code></pre>
<p><img src="https://img2024.cnblogs.com/blog/1604857/202412/1604857-20241222163340720-2139598607.png" alt="image" loading="lazy"></p>
<ol start="2">
<li>更新源之后,搜索可用的镜像</li>
</ol>
<pre><code>sudo apt update
sudo apt search linux-image
</code></pre>
<p>搜索结果样例如下:</p>
<p><img src="https://img2024.cnblogs.com/blog/1604857/202412/1604857-20241222163419925-143153422.png" alt="image" loading="lazy"></p>
<p><img src="https://img2024.cnblogs.com/blog/1604857/202412/1604857-20241222163500437-1150217055.png" alt="image" loading="lazy"></p>
<pre><code>linux-image-6.9.10+bpo-amd64-unsigned/stable-backports 6.9.10-1~bpo12+1 amd64
Linux 6.9 for 64-bit PCs

linux-image-6.9.10+bpo-cloud-amd64/stable-backports 6.9.10-1~bpo12+1 amd64
Linux 6.9 for x86-64 cloud (signed)

linux-image-6.9.10+bpo-cloud-amd64-dbg/stable-backports 6.9.10-1~bpo12+1 amd64
Debug symbols for linux-image-6.9.10+bpo-cloud-amd64

linux-image-6.9.10+bpo-cloud-amd64-unsigned/stable-backports 6.9.10-1~bpo12+1 amd64
Linux 6.9 for x86-64 cloud

linux-image-6.9.10+bpo-rt-amd64/stable-backports 6.9.10-1~bpo12+1 amd64
Linux 6.9 for 64-bit PCs (signed), PREEMPT_RT

linux-image-6.9.10+bpo-rt-amd64-dbg/stable-backports 6.9.10-1~bpo12+1 amd64
Debug symbols for linux-image-6.9.10+bpo-rt-amd64

linux-image-6.9.10+bpo-rt-amd64-unsigned/stable-backports 6.9.10-1~bpo12+1 amd64
Linux 6.9 for 64-bit PCs, PREEMPT_RT

linux-image-6.9.7+bpo-amd64/stable-backports 6.9.7-1~bpo12+1 amd64
Linux 6.9 for 64-bit PCs (signed)

linux-image-6.9.7+bpo-amd64-dbg/stable-backports 6.9.7-1~bpo12+1 amd64
Debug symbols for linux-image-6.9.7+bpo-amd64

linux-image-6.9.7+bpo-amd64-unsigned/stable-backports 6.9.7-1~bpo12+1 amd64
Linux 6.9 for 64-bit PCs
</code></pre>
<p>选择你要安装的版本,执行 <strong>sudo apt install</strong> 命令安装即可,比如:</p>
<pre><code class="language-bash">sudo apt install linux-image-6.9.10+bpo-cloud-amd64
</code></pre>
<p>其他:版本中的 <strong>+bpo</strong> 代表 <strong>Backports</strong></p>
<p><img src="https://img2024.cnblogs.com/blog/1604857/202412/1604857-20241222163634809-1931423214.png" alt="image" loading="lazy"></p>
<p>安装完成截图:<br>
<img src="https://img2024.cnblogs.com/blog/1604857/202412/1604857-20241222163657550-871812846.png" alt="image" loading="lazy"></p>
<p>重启后即可选择已经安装的新版本:</p>
<p><img src="https://img2024.cnblogs.com/blog/1604857/202412/1604857-20241222163757194-1463098118.png" alt="image" loading="lazy"></p>
<p>登录后确认内核版本:</p>
<p><img src="https://img2024.cnblogs.com/blog/1604857/202412/1604857-20241222163827903-82458894.png" alt="image" loading="lazy"></p>


</div>
<div id="MySignature" role="contentinfo">
    有了计划记得推动,不要原地踏步。<br><br>
来源:https://www.cnblogs.com/amnotgcs/p/18621585
頁: [1]
查看完整版本: debian使用apt升级内核