zoukankan      html  css  js  c++  java
  • 手摸手教程之ubuntu20.04更改国内镜像源(附其他版本ubuntu换源教程,最新详细教程)

    windows10自带ubuntu系统更新到ubuntu20.04版本啦!默认的软件更新源是国外的,速度超级慢,用"apt install"安装软件时各种网络问题也是层出不穷(上次安装ubuntu后忘记修改源结果导致N多次安装半小时然后失败.....亲身经历了这种苦,回过头发现修改源之后很多网络问题迎刃而解),因此我们需要更换成国内镜像源,然后正常安装和更新软件。

    unbuntu版本名
    修改源之前提示大家先查看版本名,ubuntu20.04对应的是“focal”,也就是我下面镜像源中提到的。“eoan”代表ubuntu19.10,“xenial”代表ubuntu16.04,“bionic”代表ubuntu18.04,“disco”代表ubuntu19.04,但是最好还是查看自己的版本名,并更改相应位置的ubuntu版本名。
    用以下命令查看版本名:

    lsb_release -c


    得到的就是你的版本名啦!比如我的就是:

    首先备份原来的软件源并另存:

    sudo cp -v /etc/apt/sources.list /etc/apt/sources.list.backup


    执行chmod命令更改文件权限使软件源文件可编辑:

    sudo chmod 777 /etc/apt/sources.list


    之后通过gedit命令编辑软件源:

    sudo gedit /etc/apt/sources.list


    如果报错提示:

    sudo: gedit: command not found


    那么直接使用vim修改:

    vim /etc/apt/sources.list


    顺便提一下vim的使用:进入后按i进入编辑模式(即INSERT插入),编辑完后先按Esc退出编辑模式,然后输入  :wq  退出即可。
    打开源文件后,进入编辑模式将所有的代码删干净,然后复制粘贴你需要的镜像源(下面的镜像源任选一个就可以,我用的是阿里云的镜像源,这里记得把ubuntu版本名替换为你在自己系统上查看到的版本名):

    编辑完后先按Esc退出编辑模式,输入  :wq  退出。
    **阿里云源:**

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


    **清华源**

    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse
    
    deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse
    
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse
    
    deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse
    
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse
    
    deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse
    
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse
    
    deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse
    
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse
    
    deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse

    修改完软件源后,更新软件列表和软件:

    sudo apt update
    
    sudo apt upgrade

    然后大功告成!如果还有什么问题,留言与我交流!

  • 相关阅读:
    HDU 5213 分块 容斥
    HDU 2298 三分
    HDU 5144 三分
    HDU 5145 分块 莫队
    HDU 3938 并查集
    HDU 3926 并查集 图同构简单判断 STL
    POJ 2431 优先队列
    HDU 1811 拓扑排序 并查集
    HDU 2685 GCD推导
    HDU 4496 并查集 逆向思维
  • 原文地址:https://www.cnblogs.com/lynn-z/p/12874504.html
Copyright © 2011-2022 走看看