林诗栋加油 發表於 2019-6-11 22:30:00

Ubuntu通过终端命令行换阿里源

<ol>
<li>
<p>检查Ubuntu系统的Codename</p>
<pre><code class="language-shell">$ lsb_release -a
</code></pre>
<p>得到结果:</p>
<pre><code>No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:      18.04
Codename:       bionic
</code></pre>
<p>访问http://mirrors.aliyun.com/ubuntu/dists/查看阿里源是否支持</p>
</li>
<li>
<p>修改sources.list</p>
<pre><code class="language-shell">$ sudo vi /etc/apt/sources.list
</code></pre>
<p>删除<code>sources.list</code>中原有的内容,更换为阿里源</p>
<pre><code>deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
</code></pre>
<p>注意此处每一行的bionic都需要与系统的Codename相对应,因此不同系统版本间的<code>sources.list</code>文件不能通用</p>
</li>
<li>
<p>更新yuan</p>
<pre><code class="language-shell">$ sudo apt-get update
</code></pre>
</li>
<li>
<p>更新软件</p>
<pre><code class="language-shell">$ sudo apt-get upgrade
</code></pre>
</li>
</ol><br><br>
来源:https://www.cnblogs.com/bosslv/p/11006680.html
頁: [1]
查看完整版本: Ubuntu通过终端命令行换阿里源