[ubuntu][转载]ubuntu更换apt国内阿里云源

Posted FL1623863129

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[ubuntu][转载]ubuntu更换apt国内阿里云源相关的知识,希望对你有一定的参考价值。

1.备份原始源文件source.list
打开终端,执行命令:sudo  cp   /etc/apt/sources.list   /etc/apt/sources.list.bak

2.修改源文件sources.list
(1)终端执行命令:sudo  chmod  777  /etc/apt/sources.list   更改文件权限使其可编辑;

(2)执行命令:  sudo  gedit   /etc/apt/sources.list    打开文件进行编辑;

(3)删除原来的文件内容,复制下面的任意一个到其中并保存(常用的是阿里源和清华源,推荐阿里源);

阿里源:

ubuntu 16
#------------------------------------------------------------------------
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
#------------------------------------------------------------------------
unbuntu 18
#---------------------------------------------------------------------------------------------
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-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed 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
#---------------------------------------------------------------------------------------------
ubuntu 20
#---------------------------------------------------------------------------------------------
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
#---------------------------------------------------------------------------------------------
3.更新源
桌面终端执行命令:sudo apt update更新软件列表,换源完成。

复损坏的软件包,尝试卸载出错的包,重新安装正确版本的 sudo apt-get -f install

更新软件 sudo apt-get upgrade

其他换源方法
还有一种更简单的方法,打开"软件更新器",依次点击"设置","Ubuntu软件",在"下载自"后面的窗口选择 "其它站点"在其中找到清华大学镜像站选择即可。
修改完软件源后,更新软件列表和软件

sudo apt update
sudo apt upgrade
 

以上是关于[ubuntu][转载]ubuntu更换apt国内阿里云源的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu16.04更换国内源

Ubuntu16.04更换国内源

Ubuntu18.04更换国内源

Ubuntu更换国内源

Ubuntu更换国内源

ubuntu更换国内源