ubuntu更换国内镜像源

  1. 备份原来的源
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

  2. 更换源
    sudo vi /etc/apt/sources.list
    将下边的阿里源复制进去
    阿里源(Ubuntu 18.04):

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

强烈建议:在软件源列表sources.list(该文本的位置在/etc/apt/sources.list)文件中的末尾添加如下内容:
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse

  1. 更新源
    sudo apt-get update

==================== 分割线 ==========================

  1. (可选)修复损坏的软件包,尝试卸载出错的包,重新安装正确版本:sudo apt-get -f install
  2. (可选)更新软件:sudo apt-get upgrade

==================== 分割线 ==========================

参考并感谢:Ubuntu 更换国内源

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Ubuntu更换镜像源,可以按照以下步骤进行操作: 1. 打开终端:在Ubuntu桌面上,按下Ctrl + Alt + T键组合,或者点击左上角的“应用程序”图标,然后搜索并打开“终端”。 2. 备份原始源列表文件:在终端中运行以下命令来备份原始源列表文件: ``` sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup ``` 3. 编辑源列表文件:使用文本编辑器(如nano或gedit)编辑源列表文件。运行以下命令使用nano编辑器打开文件: ``` sudo nano /etc/apt/sources.list ``` 4. 更换镜像源:在源列表文件中找到以“http://archive.ubuntu.com/”开头的行,并将其替换为你选择的镜像源。你可以选择一个靠近你所在地区的镜像源或者使用官方推荐的镜像源。例如,如果你在中国,你可以使用清华大学的镜像源,将行替换为: ``` deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse ``` 5. 保存和关闭文件:按下Ctrl + O保存文件,在nano编辑器中按下Enter确认,然后按下Ctrl + X关闭编辑器。 6. 更新软件包列表:运行以下命令来更新软件包列表,使更改生效: ``` sudo apt update ``` 现在,你的Ubuntu系统将使用新的镜像源来下载软件包和更新。请注意,如果你遇到任何问题,可以恢复到原始源列表文件(通过运行`sudo cp /etc/apt/sources.list.backup /etc/apt/sources.list`命令)或使用其他可用的镜像源

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值