Debian修改国内镜像源
<h2 id="应急使用">应急使用</h2><pre><code class="language-shell">sed -i -E 's/(deb|security).debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
</code></pre>
<ul>
<li>这个配置的没有 no-free 的源,同时还有需要将扫描CD光盘作为镜像源的这一行注释掉</li>
</ul>
<pre><code class="language-bash">#deb cdrom:/ bullseye contrib main
</code></pre>
<h2 id="配置方法">配置方法</h2>
<p><strong>debian 7.x (wheezy)</strong></p>
<p>编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)</p>
<pre><code class="language-bash">mv /etc/apt/sources.list /etc/apt/sources.list.back
</code></pre>
<pre><code class="language-bash">vim /etc/apt/sources.list
</code></pre>
<p>将下列代码复制进去</p>
<pre><code class="language-bash">deb http://mirrors.aliyun.com/debian-archive/debian/ wheezy main non-free contrib
deb http://mirrors.aliyun.com/debian-archive/debian/ wheezy-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-archive/debian/ wheezy main non-free contrib
deb-src http://mirrors.aliyun.com/debian-archive/debian/ wheezy-proposed-updates main non-free contrib
</code></pre>
<p><strong>debian 8.x (jessie)</strong></p>
<p>编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)</p>
<pre><code class="language-bash">mv /etc/apt/sources.list /etc/apt/sources.list.back
</code></pre>
<pre><code class="language-bash">vim /etc/apt/sources.list
</code></pre>
<p>将下列代码复制进去</p>
<pre><code class="language-bash">deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
</code></pre>
<p><strong>debian 9.x (stretch)</strong></p>
<p>编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)</p>
<pre><code class="language-bash">mv /etc/apt/sources.list /etc/apt/sources.list.back
</code></pre>
<pre><code class="language-bash">vim /etc/apt/sources.list
</code></pre>
<p>将下列代码复制进去</p>
<pre><code class="language-bash">deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
</code></pre>
<p><strong>debian 10.x (buster)</strong></p>
<p>编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)</p>
<pre><code class="language-bash">mv /etc/apt/sources.list /etc/apt/sources.list.back
</code></pre>
<pre><code class="language-bash">vim /etc/apt/sources.list
</code></pre>
<p>将下列代码复制进去</p>
<pre><code class="language-bash">deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
</code></pre>
<p><strong>debian 11.x (bullseye)</strong></p>
<p>编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)</p>
<pre><code class="language-bash">mv /etc/apt/sources.list /etc/apt/sources.list.back
</code></pre>
<pre><code class="language-bash">vim /etc/apt/sources.list
</code></pre>
<p>将下列代码复制进去</p>
<pre><code class="language-bash">deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
</code></pre>
<p><strong>debian 12.x (bookworm)</strong></p>
<p>编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)</p>
<pre><code class="language-bash">mv /etc/apt/sources.list /etc/apt/sources.list.back
</code></pre>
<pre><code class="language-bash">vim /etc/apt/sources.list
</code></pre>
<p>将下列代码复制进去</p>
<pre><code class="language-bash">deb http://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src http://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb http://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src http://mirrors.aliyun.com/debian-security/ bookworm-security main
deb http://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src http://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb http://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src http://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
</code></pre>
<h2 id="更新">更新</h2>
<p>更新软件列表</p>
<pre><code class="language-bash">sudo apt-get update
</code></pre>
<p>更新软件</p>
<pre><code class="language-bash">sudo apt-get upgrade
</code></pre>
<ul>
<li>来源:https://developer.aliyun.com/mirror/debian</li>
</ul>
<h2 id="最后编辑时间2023年11月26日104111">最后编辑时间:2023年11月26日10:41:11</h2><br><br>
来源:https://www.cnblogs.com/tothk/p/16298181.html
頁:
[1]