Ubuntu更换国内源
<h2>Ubuntu更换国内源</h2><h3><strong>备份初始源</strong></h3>
<ul>
<li><strong>sudo cp /etc/apt/sources.list{,.bak}</strong></li>
<li>为了方便,也可以直接切换到root进行操作:<strong>sudo su - root </strong></li>
</ul>
<h3><strong>更换源</strong></h3>
<ul>
<li><span style="background-color: rgba(0, 255, 0, 1)"><strong>vim /etc/apt/sources.list</strong></span></li>
<li>删除全部内容之后,添加上新的源</li>
</ul>
<p><strong>1)阿里源:</strong></p>
<div class="cnblogs_code">
<pre>deb http://mirrors.aliyun.com/ubuntu/<span style="color: rgba(0, 0, 0, 1)"> bionic main restricted universe multiverse
deb http:</span>//mirrors.aliyun.com/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">security main restricted universe multiverse
deb http:</span>//mirrors.aliyun.com/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">updates main restricted universe multiverse
deb http:</span>//mirrors.aliyun.com/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">proposed main restricted universe multiverse
deb http:</span>//mirrors.aliyun.com/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">backports main restricted universe multiverse
deb</span>-src http://mirrors.aliyun.com/ubuntu/<span style="color: rgba(0, 0, 0, 1)"> bionic main restricted universe multiverse
deb</span>-src http://mirrors.aliyun.com/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">security main restricted universe multiverse
deb</span>-src http://mirrors.aliyun.com/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">updates main restricted universe multiverse
deb</span>-src http://mirrors.aliyun.com/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">proposed main restricted universe multiverse
deb</span>-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse</pre>
</div>
<p><strong>2)清华源:</strong></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释</span>
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/<span style="color: rgba(0, 0, 0, 1)"> bionic main restricted universe multiverse
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse</span>
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">updates main restricted universe multiverse
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse</span>
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">backports main restricted universe multiverse
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse</span>
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-<span style="color: rgba(0, 0, 0, 1)">security main restricted universe multiverse
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse</span></pre>
</div>
<h3><strong>更新</strong></h3>
<ul>
<li>更新软件列表
<ul>
<li>sudo apt-get update </li>
</ul>
</li>
<li>更新软件(将已安装的软件与刷新的软件列表中的软件版本进行对比,如果发现已安装的软件版本太低,就会提示更新)
<ul>
<li>sudo apt-get upgrade</li>
</ul>
</li>
</ul>
<p> </p><br><br>
来源:https://www.cnblogs.com/hgzero/p/13187748.html
頁:
[1]