首页 > 系统相关 >【Ubuntu】Ubuntu 18.04 LTS 更换国内源——解决终端下载速度慢的问题

【Ubuntu】Ubuntu 18.04 LTS 更换国内源——解决终端下载速度慢的问题

时间:2022-08-23 10:03:19浏览次数:101  
标签:LTS 下载速度 universe restricted Ubuntu bionic ubuntu main multiverse

最近装了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 upgrade
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. 首先在Show Applications找Software & Updates:

搜索software & updates
打开software & updates

2. 打开software & updates,download from里选择other:

download from选择other

3. 然后点击select best server按钮,它会找到最快的那个,然后点击choose server,就选好镜像了:

我这里搜到的阿里云的源

4. 把other software选项中除了阿里云的镜像源的对勾都去掉了,目前没有啥影响:

5. 终端里输入sudo apt-get update,速度瞬间快的飞起。

sudo apt-get update

参考

1. 修改ubuntu 18.04的sources.list源为阿里或清华镜像

2. Ubuntu16.04换国内最快源

标签:LTS,下载速度,universe,restricted,Ubuntu,bionic,ubuntu,main,multiverse
From: https://www.cnblogs.com/lidabo/p/16615132.html

相关文章

  • Ubuntu下 cutecom 串口
    Ubuntu下cutecom图像界面串口调试工具(参考:https://blog.csdn.net/zhaoqi2617/article/details/72238546)(1)终端下载命令:sudoapt-getinstallcutecom(2)通过终端打......
  • Windows10安装WSL2和Ubuntu的过程
      因为在Windows10环境中安装了2个相同的包导致冲突,所以想到了通过WSL2+Docker的方式进行编程开发。因为DockerDesktop直接安装就行了,不做介绍。本文主要介绍WSL2和Ubun......
  • Ubuntu 16.04 LTS 安装后的配置
    1.设置主板时间为本地时间,默认为UTC时间,与Windows不同,如果双系统,时间有时差sudotimedatectlset-local-rtctrue2.移除无用软件sudoaptremove--purgesnapdwebbrowser......
  • ubuntu20.04虚拟机最小化安装(legacy server+xfce4,装完只有3G)
    server自己配桌面,可以最小化安装。legacyserver比liveserver更小,虚拟机用来部署编译环境最好了。其实还有更小的ubuntu-base版,但是那个安装配置太麻烦了。 1.下载ub......
  • Ubuntu20下载安装Docker
    安装Docker卸载旧版本sudoapt-getremovedocker\docker-engine\docker.io使用apt安装sudoapt-getupdatesudoapt-geti......
  • Ubuntu软件管理工具
    dpkg包管理器语法格式dpkg[option][package]常见用法#安装包,不支持包的依赖dpkg-ipackage.deb#删除包,不建议,不自动卸载依赖于它的包dpkg-rpackage#删......
  • ubuntu如何使alias别名永久生效?
    cd/etcsudovimbash.bashrc在后面加上你要的别名比如我这里加上aliasll='ls-al--color'   退出重新登录就好了 参考资料https://www.cnblogs.com/......
  • Ubuntu 16 遇到 No module named 'apt_pkg' 怎么办?
    sudoapt-getinstallpython3-apt--reinstallcd/usr/lib/python3/dist-packagesllapt_pkg.cpython-*sudoln-sapt_pkg.cpython-{your-version-number}-x86_64-li......
  • Windows10/11 三步安装wsl2 Ubuntu20.04(任意盘)
    如果你是Windows用户的话,觉得使用Linux很不方便,那么这篇文章可以给你提供一个还算舒适的Windows10下Linux开发的环境,并且不需要多高的配置,也可以很顺畅的使用。(我的笔记本......
  • win10离线安装WSL2 Ubuntu20.04系统
    虽然微软官方提供了方便的APPStore安装方式,和自动的命令安装方式,单由于国内限制因素,导致官方网速巨慢,而且很不稳定。这不得不迫使我们探索一种不依赖官方网站的安装方式......