ubuntu 换国内最快源
Posted sll0917
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu 换国内最快源相关的知识,希望对你有一定的参考价值。
最近装了ubuntu18.04 LTS,下载软件有点慢,网上搜了下解决方案,大致是两种:一、把/etc/apt/sources.list文件里的源更换一下,改成阿里云或者其它的镜像的文件;二、更换software&updates里的select best server。
一、更换/etc/apt/sources.list文件里的源
1. 备份源列表
Ubuntu配置的默认源并不是国内的服务器,下载更新软件都比较慢。首先备份源列表文件sources.list:
-
# 首先备份源列表
-
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
2. 打开sources.list文件修改
选择合适的源,替换原文件的内容,保存编辑好的文件, 以阿里云更新服务器为例(可以分别测试阿里云、清华、中科大、163源的速度,选择最快的):
-
# 打开sources.list文件
-
sudo gedit /etc/apt/sources.list
编辑/etc/apt/sources.list文件, 在文件最前面添加阿里云镜像源:
-
# 阿里源
-
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
-
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
-
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
-
deb 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 main restricted universe multiverse
-
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
-
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
-
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
-
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
3. 刷新列表
-
sudo apt-get update
-
sudo apt-get install build-essential
此时下载速度就明显加快了
4. 其他源
中科大源:
-
# 中科大源
-
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
-
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
-
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
-
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
-
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
-
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
-
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
-
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
-
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
-
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
163源:
-
# 163源
-
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
-
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
-
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
-
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
-
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
-
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
-
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
-
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
-
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
-
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
清华源:
-
# 清华源
-
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
-
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
-
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
-
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
-
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
-
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
-
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
-
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
-
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
-
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
更换sources.list速度依然还是很慢就请继续往下看第二种方法。
二、更换software&updates里的select best server
这种方法不需要改什么文件,直接在select best server里自动选择。
1. 首先按 WIN键,搜索 software,找到 software&updates.
2. 然后点进去,在 Download from
里面选择 other
3. 然后点击 select best server
按钮,它会找到最快的那个(最好选比较常用的源,如:清华源,阿里源或者163源之类的这样会比较稳定),然后点击 choose server
,就选好镜像啦.
5. 然后在terminal里面输入
sudo apt-get update
看看是不是已经加速了呀!
以上是关于ubuntu 换国内最快源的主要内容,如果未能解决你的问题,请参考以下文章