更改 Ubuntu 的 apt 源

Posted hk_faith

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了更改 Ubuntu 的 apt 源相关的知识,希望对你有一定的参考价值。

1.在更改apt源之前要先备份官方自带的apt源

cd   /etc/apt
sudo  cp sources.list  sources.list.bak 

2. 更改 sources.list 文件

sudo gedit sources.list  或者  sudo  vim  sources.list 

3.一些 国内的 apt 源 

  香港中文大学:

deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty main restricted universe multiverse
deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security main restricted universe multiverse
deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-updates main restricted universe multiverse
deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty main restricted universe multiverse
deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-backports main restricted universe multiverse

 或者用阿里云:

deb http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse

 ubuntu的源, 最好也加上,避免某些库下载不到  

deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

4.运行

sudo  apt-get  update
sudo  ape-get  upgrade

  

  

 

以上是关于更改 Ubuntu 的 apt 源的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu操作-更改apt-get软件源

ubuntu 更改阿里云镜像源

Ubuntu 20.04系统更改apt源为阿里源

Ubuntu更改源地址列表

Ubuntu更改国内源,设置固定IP和DNS

ubuntu 14.10 更改阿里云