• 所谓的镜像源:可以理解为提供下载软件的地方
  • 因为使用 apt-get 命令默认是从国外的服务器下载安装软件的,会导致下载安装速度很慢,所以需要更改成国内的镜像源服务器。

一、可视化方式更改镜像源

1. 打开“软件和更新”设备

  • Ubuntu 将“软件和更新”从“设置”中独立出来了
    在这里插入图片描述

2. 选择 “Ubuntu软件 / 源代码 (需验证,输入密码) / 其它站点 / 选择最佳服务器 ”,自动选择合适的镜像源

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3.重新载入可用软件列表,完成更新

在这里插入图片描述

二、手动修改镜像源

如:将镜像源改成清华大学TUNA镜像源:https://mirrors.tuna.tsinghua.edu.cn/

1、百度找到镜像源地址并打开:

在这里插入图片描述

2.选择Ubuntu对应版本

在这里插入图片描述

3.复制相关内容,覆盖原软件源配置文件( /etc/apt/sources.list ),覆盖前先备份

  • 由于/etc/apt/sources.list文件是只读文件,所以正确编辑方式是:sudo vi /etc/apt/sources.list
    在这里插入图片描述
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
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

4.更换好源之后执行下方命令更新:

sudo apt-get update
sudo apt-get upgrade

注:类似更详细文章详见:https://blog.csdn.net/weixin_41762173/article/details/79480832

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐